
Z8 Microcontrollers
Instruction Descriptions and Formats
ZiLOG
12-24
UM001600-Z8X0599
CP
COMPARE
CP
Compare
CP dst, src
Instruction Format:
Operation:
dst - src
The source operand is compared to (subtracted from) the destination operand, and the appropriate flags
are set accordingly. The contents of both operands are unaffected.
Note:
Address modes R or IR can be used to specify a 4-bit Working Register. In this format, the source or
destination Working Register operand is specified by adding 1110B (EH) to the high nibble of the
operand. For example, if Working Register R12 (CH) is the destination operand, then ECH will be used
as the destination operand in the Op Code.
Example:
If Working Register R3 contains 16H and Working Register R11 contains 20H, the statement:
CP R3, R11
Op Code: A2 3B
sets the C and S Flags, and the Z and V Flags are cleared.
dst
src
OPC
OPC
OPC
src
dst
dst
src
6
6
Cycles
OPC
(Hex)
Address
dst
Mode
src
A2
A3
r
r
r
Ir
10
10
A4
A5
R
R
R
IR
10
10
A6
A7
R
IR
IM
IM
Flags:
C:
Cleared if there is a carry from the most significant bit of the result. Set otherwise indicating a
borrow.
Set if the result is zero; cleared otherwise.
Set if result bit 7 is set (negative); cleared otherwise.
Set if arithmetic overflow occurs; cleared otherwise.
Unaffected
Unaffected
Z:
S:
V:
D:
H:
E
src
E
dst
or