Assembly 80x86 Problem 1 (a-h) For each part of this problem, assume the \"befor
ID: 3824376 • Letter: A
Question
Assembly 80x86
Problem 1 (a-h)
For each part of this problem, assume the "before" values when the gives instruction is executed. Give the requested "after" values. (The operands are word size to reduce the number of pairs of bits to combine) Before Instruction After (a) BX: FA 75 CX: 31 02 and bx, cx BX, SF, ZF (b) BX: FA 75 CX:31 02 or bx, cx BX, SF, ZF (c) BX: FA 75 CX: 31 02 or bx, cx BX, SF, ZF (d) BX: FA 75 not bx BX (e) AX: FA 75 and ax,00fh AX, SF, ZF (f) AX: FA 75 or ax, 0fff0h AX, SF, ZF (g) AX: FA 75 xor ax, 0ffffh AX, SF, Zf (h) AX: FA 75 test ax,0004h AX, SF, ZFExplanation / Answer
(a) We have bx: FA 75 and cx: 31 02
AND bx, cx would perform bit-wise 'and' operation on bx and cx and store the response in bx.
bx = 1111 1010 0111 0101
cx = 0011 0001 0000 0010
1111 1010 0111 0101
AND 0011 0001 0000 0010
-------------------------------------------
0011 0000 0000 0000
which is 30 00
Since the resultant MSB is 0 and the result overall is non-zero, SF = 0 and ZF = 0
Hence the after values are: BX: 30 00, SF: 0, ZF: 0
(b) We have bx: FA 75 and cx: 31 02
OR bx, cx would perform bit-wise 'or' operation on bx and cx and store the response in bx.
bx = 1111 1010 0111 0101
cx = 0011 0001 0000 0010
1111 1010 0111 0101
OR 0011 0001 0000 0010
-------------------------------------------
1111 1011 0111 0111
which is FB 77
Since the resultant MSB is 1 and the result overall is non-zero, SF = 1 and ZF = 0
Hence the after values are: BX: FB 77, SF: 1, ZF: 0
(c) We have bx: FA 75 and cx: 31 02
XOR bx, cx would perform bit-wise 'xor' operation on bx and cx and store the response in bx.
bx = 1111 1010 0111 0101
cx = 0011 0001 0000 0010
1111 1010 0111 0101
XOR 0011 0001 0000 0010
-------------------------------------------
1100 1011 0111 0111
which is CB 77
Since the resultant MSB is 1 and the result overall is non-zero, SF = 1 and ZF = 0
Hence the after values are: BX: CB 77, SF: 1, ZF: 0
(d) We have bx: FA 75
NOT bx would perform bit-wise 'not' operation on bx store the response in bx.
bx = 1111 1010 0111 0101
NOT 1111 1010 0111 0101 = 0000 0101 1000 1010
which is 05 8A
Since the resultant MSB is 0 and the result overall is non-zero, SF = 0 and ZF = 0
Hence the after values are: BX: FB 77, SF: 0, ZF: 0
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.