Slide 6.4: MOVZX instruction Slide 6.6: LAHF instruction Home |
MOVSX
Instruction
MOVSX
instruction (move with sign-extend) copies the contents of a source operand into a destination operand and sign-extends the value to either 16 or 32 bits.
Sign Extension of an Integer | |
---|---|
Source (8 bits) | Destination (16 bits) |
0 1 0 1 0 1 0 1 |
0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 |
1 0 1 0 1 0 1 0 |
1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 |
MOVSX — Move with Sign-Extend (386+) |
||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
AX = BYTE |
SDWORD = SWORD |
SWORD = SDWORD |
---|---|---|
.data var BYTE 0F0h .code mov eax, 0 movsx ax, var call WriteHex |
||
Output | Output | Output |
-3600 | 0FFFFF123h |