<< Previous | Next >>

> CP r Compare Rabbit 2000/3000/3000A Instruction

> Opcode | Instruction | Clocks | Operation
> ---- | CP r | 2 | A - r
> BF | CP A | 2 | A - A
> B8 | CP B | 2 | A - B
> B9 | CP C | 2 | A - C
> BA | CP D | 2 | A - D
> BB | CP E | 2 | A - E
> BC | CP H | 2 | A - H
> BD | CP L | 2 | A - L

> Flags | ALTD | IOI/IOE
> S | Z | L/V | C | F | R | SP | S | D
> · | · | V | · | · |  |  |  |

> #### Description

> Compares A with r (any of the registers A, B, C, D, E, H, or L). This compare is accomplished by subtracting r from A. The result is:

>     A < r : S=1, C=1, Z=0, L/V=V
>     A = r : S=0, C=0, Z=1, L/V=V
>     A > r : S=0, C=0, Z=0, L/V=V

> where "V" indicates that the overflow flag is set on an arithmetic overflow result. That is, the overflow flag is signalled when the operands have different signs and the sign of the result is different from the argument you are subtracting from (A in this case). For example, the overflow flag will be set if A contains 0x80 and you're comparing it to 0x01. The result of the subtraction is 0x7F, which has a different sign than 0x80.

> This operation does not affect A.

> The opcode for this instruction is different than the same instruction in the Rabbit 4000.

<< Previous | Next >>