Professional Documents
Culture Documents
024outlinel24 w9M PDF
024outlinel24 w9M PDF
Last Time
Operands
Data Movement Instructions
Today
Data Movement Instructions (from Wednesday)
Arithmetic and Logical Operations
Condition Code Registers
Next Time
Read: B&O 3.6
Control
Arithmetic Operations
int y = points[i].y;
-3(%ebx), %eax
Arithmetic Operations
Unary Operations
INC
DEC
NEG
NOT
D
D
D
D
Binary Operations
ADD S,D
SUB S,D
IMUL S,D
XOR S,D
OR S,D
AND S,D
Given:
0x100
0x104
0x108
0xFF
0xAB
0x10
%eax
%ecx
%edx
0x100
0x1
0x3
What is the destination and result for each? (do each independently)
a) incl 8(%eax)
a) addl $16, (%eax, %ecx, 4)
b) subl %edx, 0x108
c) addl %ecx, (%eax)
Shift Operations
arithmetic shift
SAL k,D
SAR k,D
logical shift
SHL k,D
SHR k,D
Condition Codes
Flow Control
CF - carry flag
1000
+ 1000
0000
- 0001
0111
+ 0001
1000
- 0001
0111
+ 0001
1000
+ 1000
ZF - zero flag
SF - sign flag
OF - overflow flag
1000
+ 0001
Setting CC based on t = a + b
CF set if
ZF set if
SF set if
OF set if