Slide 7.1: Programming Laboratory III: calculating a string expression Slide 7.3: NEG instruction Home |
INC
and DEC
Instructions
INC
instruction adds 1 to a single operand, and the DEC
instruction subtracts 1 from a single operand.
INC — Increment |
|||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|||||||||||||||||||||||||||||||||||||||||||||
DEC — Decrement |
|||||||||||||||||||||||||||||||||||||||||||||
|
INC X+1 |
ADD X+1, 1 |
DEC [OFFSET X] |
.data X WORD 1234h .code inc X+1 movzx eax, X call WriteHex |
.data X WORD 1234h .code add X+1, 1 movzx eax, X call WriteHex |
.data X WORD 1234h .code mov ebx, OFFSET X dec [ebx] movzx eax, X call WriteHex |
Output | Output | Output |