Have a question about Assembly language programming integer

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

Solution

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

result is -40

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 res

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site