Revision as of 07:32, 22 December 2011
SBC will subtract one value from another, with Borrow (NOT Carry).
If the S bit is set (SBCS), the N and Z flags are set according to the result, and the C and V flags are set as follows: C if the result generated a borrow (a not-carry; unsigned underflow); V if the result generated a signed overflow.
SBC is used for multi-word subtraction. When used with SUB, you can perform 64 bit (etc) calculations.
SBC<suffix> <dest>, <op 1>, <op 2>
dest = op_1 - op_2 - NOT(Carry)
If R0 and R1 hold a 64 bit value, and R2 and R3 hold a second, you can subtract the second from the first, leaving the difference in R4 and R5. In each case, the first register specified (R0, R2, R4) holds the least significant word.
SUBS R4, R0, R2 SBC R5, R1, R3
The instruction bit pattern is as follows:
|31 - 28||27||26||25||24 - 21||20||19 - 16||15 - 12||11 - 0|
|condition||0||0||I||0 1 1 0||S||op_1||dest||op_2/shift|