DEC decrements either an 8-bit register or an 16-bit register pair.
This the multi-page printable view of this section.Click here to print.
DEC decrements either an 8-bit register or an 16-bit register pair.
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 |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
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 |
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 |
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
---|---|---|---|---|---|---|---|---|
\(dd \longleftarrow dd - 1\) | ||||||||
DEC dd | ||||||||
0 | 0 | dd | 1 | 0 | 1 | 1 | ||
\(IX \longleftarrow IX - 1\) | ||||||||
DEC IX | ||||||||
1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | DD |
0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 2B |
\(IY \longleftarrow IY - 1\) | ||||||||
DEC IY | ||||||||
1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | FD |
0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 2B |
Value | dd |
---|---|
00 | BC |
01 | DE |
10 | HL |
11 | SP |
None. |
BC | DE | HL | SP | IX | IY | |
---|---|---|---|---|---|---|
Op |
DEC BC
0B16 |
DEC DE
1B16 |
DEC HL
2B16 |
DEC SP
3B16 |
DEC IX
DD2B210 |
DEC IY
FD2B210 |
Instruction
Opcode hexSize bytesCycle count
| Register |