I am trying to track the EAX register through each snippet of the code in a MASM32 program. I need help with explaining why it is the value it is. This is what I have:
.DATA
alfa BYTE 96h
.CODE
start:
MOV EAX,0 ; move 0 to eax
MOV AL,alfa ; move 96h to AL, this says the value of eax is now positive 150
MOVZX EAX,alfa ; still says EAX is 96h and value is positive 150
MOVSX EAX,alfa ; says value is negative 106 and eax register is FFFFFF96
call DumpRegs
call WriteInt
exit
END start
I am using DumpRegs
to display the registers and WriteInt
to print the value of EAX. I have some questions:
- When
MOV AL, alfa
, it movesalfa
into the EAX register, isn't AL an 8-bit register? why does it do this? Why doesWriteInt
say that the value is +150? - What do
MOVZX
andMOVSX
do? - What does
MOVZX EAX, alfa
do? None of the values had changed? MOVSX EAX, alfa
, why is it -106 and the EAX register FFFFFF96? Is it because it is negative?