Shahzad HW8
Shahzad HW8
Points:10
X Y X AND Y
0 0 0
0 1 0
1 0 0
1 1 1
X Y X OR Y
0 0 0
0 1 1
1 0 1
1 1 1
X Y X NAND
Y
0 0 1
0 1 1
1 0 1
1 1 0
2. Convert decimal 68 to hex, then binary, then give its 2's compliment.
Decimal: 68
Hex: 44h
Binary: 0100 0100
Two’s Compliment: 1011 1100
6. We subtract 4 from 5. What are the settings of the zero and sign flags?
5-4=1
The zero flag is 0 (not set) as the result is not equal to zero
The sign flag is 0 (not set) as the result is positive
7. We compare 6 and 4. What are the settings of the zero and sign flags?
Scenario 1:
MOV RAX, 6
CMP Rax, 4 ; does 6 - 4
;Zero flag is 0 (not set) result is not zero
;Sign flag is 0 ( not set) as the result is positive
Scenario 2:
MOV RAX, 4
CMP RAX, 6 ; does 4 - 6
;Zero flag is 0 (not set) result is not zero
; Sign flag is 1 ( set) result is negative
10. Practically speaking, what does it mean when you get a carry? When you get an overflow?
Carry: It means the unsigned addition exceeded the bit limit
Overflow: Occurs when signed addition exceeds range (carry in and carry out don’t match)
11. We have this quadword in storage: 19283746abcdef01h. We load it into a 64-bit reg. What
is in the reg?
01 ef cd ab 46 37 28 19h
13. We store that reg back where it came from. What is in storage there, now?
18 28 37 46 ab cd ef 01h