A <- A - r - CY
SBC
A,r
b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
---|---|---|---|---|---|---|---|
1 | 0 | 0 | 1 | 1 | r |
The contents of register r along with the Carry Flag (C in the F Register) are subtracted from the contents of the Accumulator, and the result is stored in the Accumulator. The r symbol identifies the registers A, B, C, D, E, H, or L, assembled as follows in the object code:
Register | r | Hex |
---|---|---|
A | 111 | $9F |
B | 000 | $98 |
C | 001 | $99 |
D | 010 | $9A |
E | 011 | $9B |
H | 100 | $9C |
L | 101 | $9D |
S | is set if result is negative, otherwise it is reset. |
Z | is set if result is 0, otherwise it is reset. |
H | is set if borrow from bit 4, otherwise it is reset. |
P/V | is set if overflow, otherwise it is reset |
N | is set. |
C | is set if borrow, otherwise it is reset. |
If the Accumulator contains $44, the Carry flag is set and Register C contains $11, then upon the execution of
SBC A,C
the Accumulator contains $32.