|
Slide 6.2: A sample program: finding Fibonacci numbers Slide 6.4: MOVZX instruction Home |
|
MOV instruction: Both operands must be the same size.
| Zero Extension of an Integer | |
|---|---|
| Source (8 bits) | Destination (16 bits) |
1 0 0 1 1 0 0 1 |
0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 1 |
| Sign Extension of an Integer | |
|---|---|
| Source (8 bits) | Destination (16 bits) |
1 0 0 1 1 0 0 1 |
1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 |
var is an unsigned integer.
var is negative, the method is not working.
EAX = WORD |
AX = WORD |
AX = SWORD |
|---|---|---|
.data var WORD 100h .code mov eax, var call WriteHex |
.data var WORD 100h .code mov eax, 0 mov ax, var call WriteHex |
.data var SWORD 0F1F0h ; F1F0h = -3600 .code mov eax, 0 mov ax, var call WriteHex |
| Output | Output | Output |