So I have this assignment where I have to write the following code in assembly language and then explain what happened with the EAX register.
I have already done so, but I get confused at myWord+2 because I do not understand why the eax register is 00000003? I thought we have to sum up the list and then add 2 to the eax.
This is my code
; summation of the list values
.386
.model flat, stdcall
.stack 4096
ExitProcess PROTO, dwExitCode: DWORD
.data
myWord WORD 4 DUP(1,2,3,4,5)
.code
main PROC
mov eax, 0 ; zeroing eax
mov ax, myWord+0 ; sum up the list values
add ax, myWord + 2
add ax, myWord + 4
add ax, myWord + 6
add ax, myWord + 8
INVOKE ExitProcess, 0
main ENDP
END main
and this is my EAX register when I debug it EAX = 00000003