dec

Decrement

Subtracts one from a register, register pair or the byte at (HL), leaving C unchanged.

SZHP/VNC ●●●●1–
  • ● set from the result
  • 1 always 1
  • – not changed

The rows that do otherwise show their own flags.

Forms

  • Subtracts one from r.

  • dec 1 byte · 11 cycles

    Subtracts one from (HL).

  • Subtracts one from the memory location pointed to by IX plus dd.

  • Subtracts one from rr.

  • Subtracts one from IX.

Undocumented 1 row

Left out of Zilog's manual, but the Z80 runs them, and so does this emulator.

  • Subtracts one from ixh/l.

Operands

r
An 8-bit register: a, b, c, d, e, h or l.
(hl)
The byte in memory at the address stored in hl. More
(ix+dd)
The byte in memory at ix + dd, where dd is a signed displacement from -128 to 127, for example (ix+5) or (ix-3). (iy+dd) works the same way. More
rr
A register pair: bc, de, hl or sp.
ix
The ix index register. You can also use iy, with the same instruction size and timing. More
ixh/l
The high or low byte of ix: ixh or ixl. For iy, use iyh or iyl. More
        .org 0x8000
        ld b, 3
        dec b
        halt