Skip to main content

sub/sbc

The sub and sub with carry instructions perform the subtractions as shown in the table below. All flags are updated accordingly.

InstructionEncodingSemanticsCycles
sub acc, reg801 000 rrracc←acc−reg8\mathit{acc} \gets \mathit{acc} - \mathit{reg8}3/41/52
sbc acc, reg801 001 rrracc←acc−reg8−CF\mathit{acc} \gets \mathit{acc} - \mathit{reg8} - \mathit{CF}3/41/52
sub acc, imm800 000 011 imm8acc←acc−imm8\mathit{acc} \gets \mathit{acc} - \mathit{imm8}3
sbc acc, imm800 001 011 imm8acc←acc−imm8−CF\mathit{acc} \gets \mathit{acc} - \mathit{imm8} - \mathit{CF}3
sub ab, reg1611 10 00 wwab←ab−reg16\mathit{ab} \gets \mathit{ab} - \mathit{reg16}7
  1. 4 cycles for unprefixed sub acc, [pi]/sbc acc, [pi]
  2. 5 cycles for sub acc, [pi]/sbc acc, [pi] with prefix_a16 (the sequence prefix_a16; sub acc, [pi] takes 6 cycles)