Lecture_2
Lecture_2
LECTURE#2
Asra Masood
7th Edition
Kip Irvine
(descriptions of individual
levels follow . . . )
Level 4
• Application-oriented languages
• C++, Java, Pascal, Visual Basic . . .
• Programs compile into assembly
language (Level 4)
Level 3
• Instruction mnemonics that have a
one-to- one correspondence to
machine language
• Programs are translated into
Instruction Set Architecture Level -
machine language (Level 2)
next: Data
Representation
Irvine, Kip R. Assembly Language for Intel-Based Computers 7/e, 2014. 17
WHAT'S NEXT
• Welcome to Assembly
Language
• Virtual Machine Concept
• Data Representation
• Boolean Operations
Every binary
number is a
sum of
powers of 2
37 =
Irvine, Kip R. Assembly Language for Intel-Based Computers 7/e, 2014.
100101 23
BINARY ADDITION
• Starting with the LSB, add each pair of digits,
include the carry if present.
carry:
1
0 0 0 0 0 1 0 0 (4
)
+ 0 0 0 0 0 1 1 1 (7
)
0 0 0 0 1 0 1 1 (11
)
bit 7 6 5 4 3 2 1
position: 0
21 / 16 = 1, rem
5
16 + 5 = 21
1
C6
75
A2 47
24
2E
Practice: The address of var1 is 00400020. The address of
the next variable after var1 is 0040006A. How many bytes
are used by var1?
Irvine, Kip R. Assembly Language for Intel-Based Computers 7/e, 2014. 32
SIGNED INTEGERS
The highest bit indicates the sign. 1 =
negative, 0 = positive
sign
bit
1 1 1 1 0 1 1 0
Negativ
e
0 0 0 0 1 0 1 0 Positiv
e
0000110 0000110
0 0
– 0000001 1111110
1 1
0000100
1
Practice: Subtract 0101 from 1001.
NOT
AND
OR
Example: X
Y
• Example: X
Y
X
mu Z
Y x
Two-input
multiplexer