In: Computer Science
Assembly Language Programming:
a)If eax = 0FFFFFFFFH, and edx = 0FFFFFFFFH, then the instruction
imul edx
will leave the value ______________________________ in the edx register.
b)If eax = 0D000000DH, and edx = 50000005H, then the instruction
idiv dl
will leave the value ______________________________ in the eax register.
c)If ax = 3BC4H, then the following instructions
cmp ah, al
jg Label
will / will not cause a jump to Label.
d)If ax = 3BC4H, then the following instructions
cmp ah, al
ja Label
will / will not cause a jump to Label.
f) The following instructions
mov eax, 0
mov ecx, 1100B
L1: inc eax
loop L1
will leave the value ______________________________ in the eax register.
a) When the one-operand form of imul is passed a 32 bit argument (as in this case with edx) it effectively means eax * edx where both eax and eax are 32 bit registers. The product of two 32 bit values may not necessarily fit in 32 bits as the full multiply result can take up to 64 bits. The high 32 bits of the answer will be written to the edx register and the low 32 bits to the eax register; this is represented with the edx:eax notation
Net answer after eax*edx = FFFF FFFE 0000 0000 Hex
So edx = FFFF FFFE H
b) The IDIV (signed divide) instruction performs signed integer division, using the same operands as the DIV instruction.
eax = eax / dl = 2999 999C H
c) jg
jumps if Sign Flag = Overflow Flag
and Zero Flag = 0
(signed Greater, excluding
equal)
cmp ah, ah
jg Label ; will go "Label" if ah >s al
; where >s is "signed greater than"
Since 3BH - SIGNED C4H = 77H
So it will jump to Label as the result is positive, so ah > al.
d) ja
jumps if Carry Flag = 0
and Zero
Flag = 0
(unsigned above: no carry and not equal)
cmp ah, al
ja Label ; will go "Label" if ah >u al
; where >u is "unsigned greater than"
Since 3BH – C4H = (5910- 19610 ) = -ve answer
So It will not jump as subtraction as result is positive, as ah < al.
f) The LOOP instruction assumes that the ECX register contains the loop count. When the loop instruction is executed, the ECX register is decremented and the control jumps to the target label, until the ECX register value, i.e., the counter reaches the value zero.
While the ecx decreases, the eax increases to 1100 B.
So eax = 1100 B.