DECΒΆ

DEC M
Decrement
Description
Decrements M by 1.
M -= 1
Results
Allowed Instructions
Instruction Opcode CC (ADL/non-ADL) CC (.S) CC (.L)
dec a $3D 1F X
dec b $05 1F X
dec c $0D 1F X
dec d $15 1F X
dec e $1D 1F X
dec h $25 1F X
dec l $2D 1F X
dec ixh $DD, $25 2F X
dec ixl $DD, $2D 2F X
dec iyh $FD, $25 2F X
dec iyl $FD, $2D 2F X
dec (hl) $86 1F + 1R + 1W + 1 2F + 1R + 1W + 1
dec (ix+n) $DD, $35, n 3F + 1R + 1W + 1 4F + 1R + 1W + 1
dec (iy+n) $FD, $35, n 3F + 1R + 1W + 1 4F + 1R + 1W + 1
dec bc $ED, $0B 1F 2F
dec de $ED, $1B 1F 2F
dec hl $ED, $2B 1F 2F
dec sp $ED, $3B 1F 2F
dec ix $DD, $2B 2F 3F
dec iy $ED, $2B 2F 3F  
Notes
  • While this instruction can be combined with a jr nz,LoopLabel to create a great 8-bit loop, using dec with a 16-bit or 24-bit operand will not alter the flags, so you’ll need another method of checking if the register pair is zero.
See Also
INC