SUB

SUB

Operation:
Destination - Source -->; Destination

Compatibility: 68000 Family

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, or long.

Condition Codes:
\c22222
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.

Instruction Format:
\i1+--+3Reg,3Opmode,u6Effective Address,3Mode,3Reg,

Instruction Fields:
Register field -- Specifies any of the eight data registers.
Opmode field:
Byte\b \bWord\b \bLong\b \bOperation
000 001 010 <ea>+<En>-->;<Dn>
100 101 110 <ea>+<En>-->;<Dn>

Effective Address field -- Determines the addressing mode.
a. If the location specified is a source operand, all
addresssing modes are allowed as shown:
\mFFF
* Byte operations cannot be used with the Address Register
Direct mode.

b. If the location specified is a destination operand,
only memory alterable addressing modes
are allowed as shown:
\m3F8

Notes:
1. The Dn mode is used when the destination is a data register;
the destination <ea> mode is invalid for a data register.
2. The assembler automatically converts SUB to SUBA when
the destination is an address register and SUBI when
the source is immediate data.

Related Instructions:
SUBA,487
SUBI,488
SUBQ,489
SUBX,490
.485487