I have an array containing sbytes which get get added to each other using the
The code works fine, except now I am trying to move
to a variable called total_sum which would hold SWORDs. However, I am not sure how to do that.
The error I'm getting is
error A2022: instruction operands must be the same siz
which I understand to mean that the formats I am trying to convert between are different.
Could someone help point me in the right direction?
Here is the relevant code:
mov esi, OFFSET array
mov ecx, LENGTHOF array
mov total_sum, 0
movsx edx, byte ptr [esi]
add ebp, edx
mov eax, ebp
mov [total_sum], ebp
mov byte ptr [total_sum], ebp
The variable is declared as a byte, the register is 4 bytes. The assembler is not sure what do you mean - truncate the register, or use four bytes that start at label total_sum.