UM012811-0904
eZ8 CPU Instruction Set Description
eZ8 CPU
User Manual
91
CP
Compare
CP dst, src
Operation
dst - src
Description
The source operand is compared to (subtracted from) the destination operand and the flags
are set according to the results of the operation. The contents of both the source and desti-
nation operands are unaffected.
Flags
Attributes
Escaped Mode Addressing
Using Escaped Mode Addressing, address modes R or IR specify a Working Register. If
the high nibble of the source or destination address is
EH
(1110B), a Working Register is
inferred. For example, if Working Register R12 (
CH
) is the desired destination operand,
use
ECH
as the destination operand in the opcode. To access Registers with addresses
E0H
to
EFH
, either set the Working Group Pointer, RP[7:4], to
EH
or use indirect addressing.
C
Set if a borrow is required by bit 7; reset otherwise.
Z
Set if the result is zero; reset otherwise.
S
Set if Bit 7 of the result is set; reset otherwise.
V
Set if an arithmetic overflow occurs; reset otherwise.
D
Unaffected.
H
Unaffected.
Mnemonic
Destination, Source
Opcode (Hex)
Operand 1
Operand 2
Operand 3
CP
r1, r2
A2
{r1, r2}
—
—
CP
r1, @r2
A3
{r1, r2}
—
—
CP
R1, R2
A4
R2
R1
—
CP
R1, @R2
A5
R2
R1
—
CP
R1, IM
A6
R1
IM
—
CP
@R1, IM
A7
R1
IM
—