CMP

CMP

Operation:
Destination - Source -->; cc

Compatibility: 68000 Family

Assembler Syntax:
CMP <ea>, Dn

Attributes: Size = (Byte, Word, Long)

Description: Subtracts the source operand from the destination
data register and sets the condition codes according to the
result; the data register is not changed. The size of the operation
can be byte, word, or long.

Condition Codes:
\c32222
X Not affected.
N Set if the result is negative. Cleared otherwise.
Z Set if the result is zero. Cleared otherwise.
V Set if an overflow occurs. Cleared otherwise.
C Set if a borrow occurs. Cleared otherwise.

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

Instruction Fields:
Register field -- Specifies the destination data register.
Opmode field:
Byte\b \bWord\b \bLong\b \bOperation
000 001 010 (<Dn>)-(<ea>)

Effective Address field -- Determines the source operand. All
addressing modes are allowed as shown:
\mFFF

Note: CMPA is used when the destination is an address register. CMPI
is used when the source is immediate data. The assembler will
automatically makes these substitution.

Related Instructions:
CMPA,434
CMPI,435
CMPM,436
CMP2,437

CMP A,B         signed          unsigned
-------         ------          --------
B <; A           BLT             BLO (or BCS)
B <;= A          BLE             BLS
B = A           BEQ             BEQ
B <;>; A          BNE             BNE
B >; A           BGT             BHI
B >;= A          BGE             BHS (or BCC)

TST A            signed          unsigned
-------          ------          --------
A <;  0           BLT (or BMI)    NOP
A <;= 0           BLE             BZ (or BEQ)
A =  0           BZ (or BEQ)     BZ (or BEQ)
A <;>; 0           BNZ (or BNE)    BNZ (or BNE)
A >;  0           BGT             BNZ (or BNE)
A >;= 0           BGE (or BPL)    BRA
.432434