sbc

Subtract with carry

Subtracts a value and the carry flag C from A, or a register pair and C from HL.

SZHP/VNC ●●●●1●
  • ● set from the result
  • 1 always 1

Forms

  • Subtracts r and the carry flag from A.

  • sbc a, 1 byte · 7 cycles

    Subtracts (HL) and the carry flag from A.

  • sbc a, 2 bytes · 7 cycles

    Subtracts nn and the carry flag from A.

  • Subtracts the value pointed to by IX plus dd and the carry flag from A.

  • Subtracts rr and the carry flag from HL.

Pseudo-instructions

Other spellings the assembler accepts; each form shows the instruction it becomes.

  • Subtracts r and the carry flag from A.

  • Subtracts (HL) and the carry flag from A.

  • Subtracts nn and the carry flag from A.

  • Subtracts the value pointed to by IX plus dd and the carry flag from A.

Undocumented 1 row

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

  • Subtracts ixh/l and the carry flag from A.

Pseudo-instructions · Undocumented 1 row

Other spellings the assembler accepts; each form shows the instruction it becomes. Left out of Zilog's manual, but the Z80 runs them, and so does this emulator.

  • Subtracts ixh/l and the carry flag from A.

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
nn
An 8-bit immediate value, 0 to 255 or -128 to 127, written as a number, character constant or symbol. 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.
ixh/l
The high or low byte of ix: ixh or ixl. For iy, use iyh or iyl. More
        .org 0x8000
        ld a, 5
        ld b, 3
        sbc a, b
        halt