2.2.22 (2) CMP (W)
CMP (CoMPare)
Compare
Operation
Rd – (EAs), set CCR
Assembly-Language Format
CMP.W
<EAs>, Rd
Operand Size
Word
Condition Code
H: Set to 1 if there is a borrow at bit 11;
otherwise cleared to 0.
N: Set to 1 if the result is negative; otherwise
cleared to 0.
Z:
Set to 1 if the result is zero; otherwise
cleared to 0.
V: Set to 1 if an overflow occurs; otherwise
cleared to 0.
C: Set to 1 if there is a borrow at bit 15;
otherwise cleared to 0.
I
UI
H
U
N
Z
V
C
—
—
↕
—
↕
↕
↕
↕
Description
This instruction subtracts the source operand from the contents of a 16-bit register Rd (destination
register) and sets or clears the CCR bits according to the result. The contents of the 16-bit register
Rd remain unchanged.
Available Registers
Rd:
R0 to R7, E0 to E7
Rs:
R0 to R7, E0 to E7
Operand Format and Number of States Required for Execution
Notes
Instruction Format
1st byte
2nd byte
3rd byte
4th byte
Immediate
CMP.W
#xx:16, Rd
7
9
2
rd
IMM
4
Register direct
CMP.W
Rs, Rd
1
D
rs
rd
2
No. of
States
Addressing
Mode
Mnemonic
Operands
73