0FFh + 1 |
00h – 1 |
00h – 1 |
.data
X SWORD 12FFh
.code
movsx ebx, X
inc bl
call DumpRegs
jz L1
call WaitMsg
L1: mov X, bx
movsx eax, X
call WriteHex
|
.data
X SWORD 0FF00h
.code
movsx ebx, X
dec bl
call DumpRegs
mov X, bx
js L1
call WaitMsg
L1: movsx eax, X
call WriteHex
|
.data
X SWORD 0FF00h
.code
movsx ebx, X
sub bl, 1
call DumpRegs
mov X, bx
js L1
call WaitMsg
L1: movsx eax, X
call WriteHex
|
| Output | Output | Output |
INC and DEC instructions do not affect the Carry flag.
ADD instruction performs the addition based on the size of the first argument.
The procedure WaitMsg, provided by the textbook author, displays the message “Press [Enter] to continue ....,” and waits for the user to press the Enter key.
[X + 1] + 1 |
0FF0Fh + 1 |
0101h + 1 |
.data
X SWORD 0FF00h
.code
add X+1, 1
call DumpRegs
jz L1
call WaitMsg
L1: movsx eax, X
call WriteHex
|
.code
mov bx, 0FF0Fh
add bl, 1
call DumpRegs
lahf
test ah, 00010000b
jz L1
call WaitMsg
L1: movsx eax, bx
call WriteHex
|
.code
mov bx, 0101h
add bx, 1
call DumpRegs
jp L1
call WaitMsg
L1: movsx eax, bx
call WriteHex
|
| Output | Output | Output |