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

Have a question about Assembly language programming. integer expression calculat

ID: 3791937 • Letter: H

Question

Have a question about Assembly language programming.

integer expression calculation.asm

I have finished with my coding, but my codes do not print out of the result of Res.

in memory it should be d8 ff ff ff, but it shows 00 00 00 00

need help!! thank you!

.386

.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword

.data
varA DWORD 10
varB DWORD 20
varC DWORD 30
varD DWORD 40
Res DWORD ?

.code
main1 proc

   mov EAX,varA ;EAX = 10
   mov EBX,varB ;EBX = 20
   mov ECX,varC ;ECX = 30
   mov EDX,varD ;EDX = 40

   add EAX,EBX ;EAX: (A+B)
   add ECX,EDX ;ECX: (C+D)
   sub EAX,ECX ;EAX: (A+B)-(C+D)
  
   mov Res,EAX ;Res: (A+B)-(C+D)

invoke ExitProcess,0
main1 endp
end main1

Explanation / Answer

output:(add syscall for printf to print the result for the above code)

result is -40

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote