Substraction is identical to addition, but the first operand (SRC2) is negated (you know, A-B=A+(-B)).
Short version :
The first operand (SRC2) is substracted from the second operand (SRC1)
and the result is written into the second operand (SRC1).
Long version : The source register (SRC2) is substracted from the sign-extended immediate field (Imm16) and the result is written to the destination register (SRC1).
; D4 = 123h ; R1 = 1h SUB R1 D4 ; D4= D4+(-R1) = 123h+FFFFFFFEh = 122h SUB R1 4 D4 ; D4= 4567h+(-R1) = 4h+FFFFFFFEh = 3h
Note that substraction by an immediate value is possible by adding the 2s-complement value.
NEGation of a register is an alias that substracts this register from 0.
The result is truncated to the 32 lower bits. No borrow bit is generated or directly available. However, when no borrow condition is detected, other versions of this instruction can skip 1, 2 or 3 half-words SUBS1, SUBS2 and SUBS3).