HL <- HL - ss - CY
SBC
HL,ss
b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 | |
---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | $ED |
0 | 1 | ss | 0 | 0 | 1 | 0 |
The contents of the register pair ss (any of register pairs BC, DE, HL, or SP) and the Carry Flag (C flag in the F Register) are subtracted from the contents of register pair HL, and the result is stored in HL. In the assembled object code, operand ss is specified as follows:
Register Pair | r | Hex |
---|---|---|
BC | 00 | $42 |
DE | 01 | $52 |
HL | 10 | $62 |
SP | 11 | $72 |
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 12, otherwise it is reset. |
P/V | is set if overflow, otherise it is reset. |
N | is reset. |
C | is set if borrow, otherwise it is reset. |
If the HL register pair contains $9999, register pair DE contains $1111, and the Carry flag is set, then upon the execution of
SBC HL,DE
HL contains $8887.