.386
.MODEL FLAT, stdcall
.STACK 4096
ExitProcess PROTO, dwExitCode:DWORD
.data
arr1 DWORD 25, 89, 49, 80
arr2 DWORD 30, 100, 50, 150
.code
_main PROC
sub eax, eax
add eax, [arr1 + 0]
add eax, [arr1 + 4]
add eax, [arr1 + 8]
add eax, [arr1 + 12]
INVOKE ExitProcess, 0
_main ENDP
END
When I took out sub
the sum of adding the values in the array was wrong but I don't understand why. To my understanding sub eax, eax
clears the register but I could be wrong. I was told to use something like movsx
instead of sub
but isn't movsx
only used when going between different data type sizes?