Crossware

Table of Contents        Previous topic       Next topic       

MICROPROCESSOR INSTRUCTION REFERENCE->CMP2

CMP2    Check Register against Bounds

Compatibility: 68020 and CPU32 only


Compare Rn < lower bound and Rn > upper bound -> Condition Codes

Assembler Syntax:    CMP2 <ea>,Rn

<ea> - data only

Size:    Byte, Word, Long

The value in register Rn is compared with the lower bound and upper bound specified by the effiective address.  (The lower bound is followed by the upper bound.)

If the register is a data register, and the size is byte or word, then only the bytes or words are compared.  If the register is an address register and the size is byte or word, then the lower and upper bounds are sign extended to 32 bits before being compared with the 32 bits of the register.

For signed comparisons, the arithmetically smaller value should be used as the lower bound.  For unsigned comparisons, the logically smaller value should be used as the lower bound.


Condition Codes:

N    Undefined
Z    Set if Rn is equal to either bound, else cleared
V    Undefined
C    Set if Rn is out bound, else cleared
X    Not affected

    
Allowable Addressing Modes
    
CMP2(An),Rn  CMP2(d16,PC),Rn
CMP2(d16,An),RnCMP2(d8,PC,Xn),Rn
CMP2(d8,An,Xn),RnCMP2(bd,PC,Xn),Rn
CMP2(bd,An,Xn),RnCMP2([bd,PC,Xn],od),Rn 1
CMP2([bd,An,Xn],od),Rn 1CMP2([bd,PC],Xn,od),Rn 1
CMP2([bd,An],Xn,od),Rn 1
CMP2(xxx).W,Rn
CMP2(xxx).L,Rn