MOVZX Instruction
The MOVZX instruction (move with zero-extend) copies the contents of a source operand into a destination operand and zero-extends the value to either 16 or 32 bits.
|
Zero Extension of an Integer
|
|
Source (8 bits) |
Destination (16 bits) |
1 0 1 0 1 0 1 0 |
0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 |
MOVZX — Move with Zero-Extend (386+) |
Usage: MOVZX dest, src
|
Flag |
O
|
D
|
I
|
S
|
Z
|
A
|
P
|
C
|
|
Result |
|
|
|
|
|
|
|
|
Copies a byte or word from a source operand to a destination operand and zero-extends into the upper half of the destination.
|
|
Clocks |
|
|
Operands |
286 |
386 |
486 |
Size Bytes |
|
reg, reg |
|
3 |
3 |
3 |
|
reg, mem |
|
6 |
3 |
3-7 |
|
|
†This instruction is used to copy an 8-bit or 16-bit operand into a larger destination, which must be a register.
AX = SWORD |
EAX = SWORD |
EAX = BYTE |
.data
var SWORD 0F1F0h
.code
mov eax, 0
movzx ax, var
call WriteHex
|
.data
var SWORD 0F1F0h
.code
mov eax, 0
movzx eax, var
call WriteHex
|
.data
var BYTE 0F0h
.code
mov eax, 0
movzx eax, var
call WriteHex
|
|
Output |
Output |
Output |
“I’m not arguing, I’m just explaining why I’m right.”
― Unknown
|