# CoMPare register against upper and lower bounds

```NAME
Cmp2 -- Compare register against upper and lower bounds	(68020+)

SYNOPSIS
CMP2	<ea>,Rn

FUNCTION
Used to compare value of Rn (Dn or An) with two lower and upper
bounds, which are stored in memory, at address given by <ea> (in
Lower bound have to be stored before upper bound. Flags are set
following to the result of comparison.

If Rn is a data register Dn, and if operation is made on 8 or
16 bits, only the 8 or 16 bits of Dn are taken in count.
In opposite, in the case of Rn as an address register and if a 16
bits operation is granted, the 32 bits of An are compared to bounds
which are, them, extended on 32 bits by their signs.

FORMAT
<ea>
----------------------------------------=========================
|15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|-------|---|---|---|-----------|-----------|
| 0 | 0 | 0 | 0 | 0 | SIZE  | 0 | 1 | 1 |   MODE    | REGISTER  |
|---|-----------|---|-------|---|---|---|-----------|-----------|
|D/A| REGISTER  | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
-----------------------------------------------------------------

REGISTER
Register specifies the register Rn which contains the value to test.
If D/A = 0: Rn = Dn
If D/A = 1: Rn = An
<ea> specifies bounds, addressing modes allowed are:
--------------------------------- -------------------------------
|-------------------------------| |-----------------------------|
|      Dn       | -  |     -    | |    Abs.W      |111 |  000   |
|-------------------------------| |-----------------------------|
|      An       | -  |     -    | |    Abs.L      |111 |  001   |
|-------------------------------| |-----------------------------|
|     (An)      |010 |N° reg. An| |   (d16,PC)    |111 |  010   |
|-------------------------------| |-----------------------------|
|     (An)+     | -  |     -    | |   (d8,PC,Xi)  |111 |  011   |
|-------------------------------| |-----------------------------|
|    -(An)      | -  |     -    | |   (bd,PC,Xi)  |111 |  011   |
|-------------------------------| |-----------------------------|
|    (d16,An)   |101 |N° reg. An| |([bd,PC,Xi],od)|111 |  011   |
|-------------------------------| |-----------------------------|
|   (d8,An,Xi)  |110 |N° reg. An| |([bd,PC],Xi,od)|111 |  011   |
|-------------------------------| |-----------------------------|
|   (bd,An,Xi)  |110 |N° reg. An| |    #data      | -  |   -    |
|-------------------------------| -------------------------------
|([bd,An,Xi]od) |110 |N° reg. An|
|-------------------------------|
|([bd,An],Xi,od)|110 |N° reg. An|
---------------------------------

SIZE
00->one Byte operation
01->one Word operation
10->one Long operation

RESULT
X - Not affected
N - Undefined.
Z - Set if Rn is equal to one of the two bounds. Cleared otherwise.
V - Undefined.
C - Set if Rn is out of bounds. Cleared otherwise.