sub

Sizes

byte, word, long

Default Size

word

Affected Flags

X
N
Z
V
C
✱
✱
✱
✱
✱

Operands

Op 1
Dn/An/(An)/d(An)/d(An,Xn)/Ea/<label>/d(PC)/d(PC,Xn)/Im
Op 2
Dn/An/(An)/d(An)/d(An,Xn)/Ea/<label>

Subtracts the value of the first operand from second operand and stores in the second. If the second operand is an address register, the SUBA instruction is used instead.

move.l #$100, d0
sub.b #$01, d0 ; only affects low byte

* --- Borrow: subtracting more than available ---
move.l #$00, d1
sub.b #$01, d1 ; carry flag set (borrow)

* --- Overflow ---
move.l #$80, d2
sub.b #$01, d2 ; $7F, V flag set