DEC 8-bit Decrement
Decrement
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
---|---|---|---|---|---|---|---|---|
\(r \longleftarrow r - 1\) | ||||||||
DEC r | ||||||||
0 | 0 | r | 1 | 0 | 1 | |||
\((HL) \longleftarrow (HL) - 1\) | ||||||||
DEC (HL) | ||||||||
0 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | |
\((IX+d) \longleftarrow (IX+d) - 1\) | ||||||||
DEC (IX+d) | ||||||||
1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | DD |
0 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 35 |
d | ||||||||
\((IY+d) \longleftarrow (IY+d) - 1\) | ||||||||
DEC (IY+d) | ||||||||
1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | FD |
0 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 35 |
d |
Register | r |
---|---|
B | 000 |
C | 001 |
D | 010 |
E | 011 |
H | 100 |
L | 101 |
A | 111 |
Flags Affected
Flags |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
s | set if result negative | ||||||||
z | set if result is 0 | ||||||||
h | set if borrow from bit 4 | ||||||||
p/v | set if register was 0x80 before operation, reset otherwise |
Opcode Matrix
A | B | C | D | E | H | L | (HL) | (IX+d) | (IY+d) | |
---|---|---|---|---|---|---|---|---|---|---|
Op |
DEC A
3D14 |
DEC B
0514 |
DEC C
0D14 |
DEC D
1514 |
DEC E
1D14 |
DEC H
2514 |
DEC L
2D14 |
DEC (HL)
35111 |
DEC (IX+d)
DD35nn323 |
DEC (IY+d)
FD35nn323 |
Instruction
Opcode hexSize bytesCycle count
| Register | Memory |
Last modified November 16, 2021: Add flags to math operations (63d34c2)