SBC Subtract with Carry

Subtraction with Carry
76543210
 
\(A \longleftarrow A - r - Carry\)
SBC A, r
10011r
 
\(A \longleftarrow A - n - Carry\)
SBC A,n
11011110DE
 
\(A \longleftarrow A - (HL) - Carry\)
SBC A, (HL)
100111109E
 
\(A \longleftarrow A - (IX+d) - Carry\)
SBC A, (IX+d)
11011101DD
100111109E
d
 
\(A \longleftarrow A - (IY+d) - Carry\)
SBC A, (IY+d)
11111101FD
100111109E
d
 
\(A \longleftarrow A - ss - Carry\)
SBC HL, ss
11101101ED
01dd0010
Registers
Registerr
B000
C001
D010
E011
H100
L101
A111
Registers
Valuedd
00BC
01DE
10HL
11SP
Flags Affected
Flags
sz-h-p/v-c
sset if result negative
zset if result is 0
hset if borrow from bit 4
p/vset if overflow
cset if borrow
Opcode Matrix
ABCDEHL(HL)(IX+d)(IY+d)nBCDEHLSP
A
SBC A,A
9F14
SBC A,B
9814
SBC A,C
9914
SBC A,D
9A14
SBC A,E
9B14
SBC A,H
9C14
SBC A,L
9D14
SBC A,(HL)
9E17
SBC A,(IX+d)
DD9Enn119
SBC A,(IY+d)
FD9Enn119
SBC A,n
DEnn27




HL











SBC HL,BC
ED42215
SBC HL,DE
ED52215
SBC HL,HL
ED62215
SBC HL,SP
ED72215
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Register Memory Implicit

Last modified November 16, 2021: Add flags to math operations (63d34c2)