DEC
This instruction subtracts one from the destination operand and stores the result in the same operand.
The flags are modified as follows:
- If the subtraction produces a result that cannot fit in the destination operand, then
CF=1. Otherwise,CF=0. - If the result is zero, then
ZF=1. Otherwise,ZF=0. - If the most significant bit of the result is
1, thenSF=1. Otherwise,SF=0. - If the operand is negative and the result is positive, then
OF=1. Otherwise,OF=0.
Usage
vonsim
DEC destdest can be a register or a memory address (see operand types).
Encoding
- Register
0100011w,00000rrr - Memory (direct)
0100011w,11000000, addr-low, addr-high - Memory (indirect)
0100011w,11010000 - Memory (indirect with offset)
0100011w,11100000, disp-low, disp-high
Where w is the operand size bit. w=0 indicates 8-bit operands, and w=1 indicates 16-bit operands.
rrr encodes a register according to the following table:
rrr | w=0 | w=1 |
|---|---|---|
000 | AL | AX |
001 | CL | CX |
010 | DL | DX |
011 | BL | BX |
100 | AH | SP |
101 | CH | -- |
110 | DH | -- |
111 | BH | -- |