Assembly Part 4 Flashcards
CF is set to 1 when
The carry out from the most significant bit (unsigned overflow) is 1
ZF is set to 1 if
T == 0
SF is set to 1 if
T < 0 (as signed)
OF is set to 1 if
Two-complement signed overflow
Does Leaq instruction set (means set to 1) condition codes?
No
Explicitly set flags with ______ instruction
CmpX
Cmpq src1, src2
Cmpq b,a
Same as computing a-b, but not assigning the result to a destination. Flags are set to 0 or 1
Explicitly set flags with ____ instruction
Test
Testq src2, src1
Testq b,a
The same as computing a&b, but not assigning the result to destination
The setX instruction set a ____ _____ based on combination of condition codes
Stores ____ value in one of the ______ registers and does not alter remaining bits
Single byte
1-bit, 1-byte
CmpX <scrc1>, <src2></src2></scrc1>
Computes scr2 - scr1 but does save the result anywhere
Conditions codes are set to 0 or 1 based on the computation
Src1 and src2 must be of the same size
TestX <src1>, <src2></src2></src1>
Computes <src2> & <Src1> but does not save the result anywhere
Conditions codes (ZF and SF) are set to 1 or 0 based on the computation
Scr1 and src2 must be of the same size</Src1></src2>
JX destination
Jump to different part of code depending on condition codes
CmovX operand1, operand2
Move a value or not depending on condition codes
Memory address review
Imm
Mem[Imm]
Note that this special case contains no parentheses, but still specifies a address in memory were we will go and access the value
TestX instruction changes what flags
ZF set to 1 when a&b == 0
SF is set to 1 when a&b < 0
OF and CF cannot be set to one by testX
What flags cannot be set to 1 by testX?
OF, CF
CmovX operand1, operadn2
Move a value (or not) depending on the condition codes