SUB

SUB

Operation:
Destination - Source -->; Destination

Assembler Syntax:
SUB <ea>, Dn

SUB Dn, <ea>

Attributes: Size = (Byte, Word, Long)

Description: Subtracts the source operand from the destination
operand and stores the result in the destination location.
The size of the operation may be specified as byte, word, long or Quad.

Condition Codes:

X Set the same as the carry bit.
N Set if the result is negative. Cleared otherwise.
Z Set if the result is zero. Cleared otherwise.
V Set if an overflow is generated. Cleared otherwise.
C Set if a carry is generated. Cleared otherwise.

Example:

1)
D1 = $11111111
D2 = $22222222
SUB.B D2,D1

Result: D2 = $111111FF


2)
D1 = $11111111
D2 = $22222222
SUB.W D1,D2

Result: D2 = $22221111




Notes: SUB can use as source also AN.
Only ADD/SUB/CMP/MOVE can use AN as source.