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

The program (HW01.asm) will involve a modification of the Addsub. asm that is po

ID: 3753570 • Letter: T

Question

The program (HW01.asm) will involve a modification of the Addsub. asm that is posted. You will first move 4000h to a 16 bit register, and then 1000h and 1500h to two other 16 bit registers. Then subtract the second register content from the first register content, putting the result back into the first register. Then you will subtract the third register from the first register, putting the result back into the first register. Before the moves, 0 out the corresponding 32 bits registers from which you are going to use the 16 bit segments Each move line of code should have a comment that shows the base 10 equivalent of the content of the register. Each subtraction line of code should have a comment that shows the hex content of the first 16 bit register and its corresponding base 10 value. The hex values of the first 16 bit register should be read from the registers display in Visual Studio as the program is stepped through the subtract statements.

Explanation / Answer

.data

val1     dword 4000h

val2     dword 1000h

val3     dword 1500h

.code

main PROC

     xor eax,eax ;Clearing the 32 bit register eax

     xor ebx,ebx   ; Clearing the 32 bit register ebx

     xor ecx,ecx   ; Clearing the 32 bit register ecx

     mov ax,val1   ;ax= 16384

     mov bx,val2   ;bx=4096

     mov cx,val3   ;cx=5376

     sub ax,bx      ;ax=3000h=12288

     sub ax,cx      ;ax=1500h=5376

     call DumpRegs ; display the registers

     exit

main ENDP

END main