This the multi-page printable view of this section.Click here to print.

Return to the regular view of this page.

DEC Decrement

Decrement

Table of Contents

DEC decrements either an 8-bit register or an 16-bit register pair.

1 - DEC 8-bit Decrement

Decrement
76543210
 
\(r \longleftarrow r - 1\)
DEC r
00r101
 
\((HL) \longleftarrow (HL) - 1\)
DEC (HL)
00110101
 
\((IX+d) \longleftarrow (IX+d) - 1\)
DEC (IX+d)
11011101DD
0011010135
d
 
\((IY+d) \longleftarrow (IY+d) - 1\)
DEC (IY+d)
11111101FD
0011010135
d
Registers
Registerr
B000
C001
D010
E011
H100
L101
A111
Flags Affected
Flags
sz-h-p/v--
sset if result negative
zset if result is 0
hset if borrow from bit 4
p/vset if register was 0x80 before operation, reset otherwise
Opcode Matrix
ABCDEHL(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
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Register Memory

2 - DEC 16-bit Decrement

Decrement 16-bit register pair
76543210
 
\(dd \longleftarrow dd - 1\)
DEC dd
00dd1011
 
\(IX \longleftarrow IX - 1\)
DEC IX
11011101DD
001010112B
 
\(IY \longleftarrow IY - 1\)
DEC IY
11111101FD
001010112B
Registers
Valuedd
00BC
01DE
10HL
11SP
Flags Affected
None.
Opcode Matrix
BCDEHLSPIXIY
Op
DEC BC
0B16
DEC DE
1B16
DEC HL
2B16
DEC SP
3B16
DEC IX
DD2B210
DEC IY
FD2B210
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Register