I'm currently learning x86 assembly language.
I have the following code
.386
.MODEL FLAT, STDCALL
.STACK 4096
ExitProcess PROTO, dwExitCode: DWORD
.CODE
main PROC
MOV AX, 7FF0h
ADD AL, 10h
invoke ExitProcess, 0
main ENDP
END main
Before I moved 10h
into AL
, AX
contain the value 0x7FF0
After moving 10h
into AL
, I was expecting the AX
value to be 0x8000
, but instead, the value in AX
was 0x7F00
.
How come adding 0x10
to 0xF0
in the right-most byte (the least significant byte) did not carry over 1
into the second right-most byte? In other words, how come adding 0x10
to 0x7FF0
did not result in 0x8000
?
My guess is because when I added 0x10
, I added 0x10
to AL
(AL
at the time of addition contain 0xF0
), therefore adding 0x10
to 0xF0
result in 0x100
, but the carried over 1
is not preserved.
Is my assumption correct?