Cp compare (byte) – Zilog Z80380 User Manual
Page 68
5-34
Z380
™
U
SER
'
S
M
ANUAL
DC-8297-03
Z
ILOG
CP
COMPARE (BYTE)
CP [A,]src
src = R, RX, IM, IR, X
Operation:
A
–
src
The source operand is compared with the accumulator and the flags are set accordingly.
The contents of the accumulator and the source are unaffected. Two’s complement
subtraction is performed.
Flags:
S:
Set if the result is negative; cleared otherwise
Z:
Set if the result is zero; cleared otherwise
H:
Set if there is a borrow from bit 4 of the result; cleared otherwise
V:
Set if arithmetic overflow occurs, that is, if the operands are of different signs and the
result is of the same sign as the source; cleared otherwise
N:
Set
C:
Set if there is a borrow from the most significant bit of the result; cleared otherwise
Addressing
Execute
Mode
Syntax
Instruction Format
Time
Note
R:
CP [A,]R
10111-r-
2
RX:
CP [A,]RX
11y11101 1011110w
2
IM:
CP [A,]n
11111110 ——n—
2
IR:
CP [A,](HL)
10111110
2+r
X:
CP [A,](XY+d)
11y11101 10111110 ——d—
4+r
I
Field Encodings:
r:
per convention
y:
0 for IX, 1 for IY
w: 0 for high byte, 1 for low byte