Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

move into ax the value 7FF0h add to the lower 8 bits of ax the quantity 10h. cal

ID: 3603039 • Letter: M

Question

move into ax the value 7FF0h add to the lower 8 bits of ax the quantity 10h. call DumpRegs. In a comment indicate why you are seeing the values shown for CF and OF. add 1 to the upper 8 bits of ax. Call DumpRegs. In a comment indicate why you are seeing the values shown for CF and OF. add 2 to ax. Call DumpRegs. In a comment indicate why you are seeing the values shown for CF and OF. Your output should look as follows (where some of the uninteresting output has been omitted): The contents of ebx is: -5 The contents of ecx is: -5 EAX=00000005 EBX=00000006 ECX=00000007 EDX=00000008 . . . EAX=FFFFFFFF EBX=FFFFFFFE ECX=FFFFFFFD EDX=FFFFFFFC . . . . . . . CF=1 SF=0 ZF=1 OF=0 AF=0 PF=1 . . . . . . . CF=0 SF=1 ZF=0 OF=1 AF=1 PF=0 . . . . . . CF=0 SF=1 ZF=0 OF=0 AF=0 PF=0

Explanation / Answer

MOV DX, BX ADD DX, 0FFFFH CMC MOV DL, 0 RCL DL, 5 ; Get 32 in DX if we want to exit the loop ADD L0+1, DL ; Modify code - add 32 (or 0) to branch address L0: JMP SHORT L ; Short is essential - so address is a byte! NOP ... ; A sufficient number of NOPs so that L+32 NOP ; is in the NOPs... SUB L0+1, DL ; Restore code to original