CP

Comparison

\(A - s\)

76543210
 
CP r
10111r
 
CP n
11111110FE
n
 
CP (HL)
10111110BE
 
CP (IX+d)
11011101DD
10111110BE
d
 
CP (IY+d)
11111101FD
10111110BE
d
Registers
Registerr
B000
C001
D010
E011
H100
L101
A111
Flags Affected
Flags
sz-h-p/v-c
sset if result negative
zset if result is 0
hset if borrow from bit 4
p/vset if overflow
cset if borrow
Opcode Matrix
ABCDEHL(HL)(IX+d)(IY+d)n
Op
CP A
BF14
CP B
B814
CP C
B914
CP D
BA14
CP E
BB14
CP H
BC14
CP L
BD14
CP (HL)
BE17
CP (IX+d)
DDBEnn319
CP (IY+d)
FDBEnn319
CP n
FEnn27
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Register Memory Implicit

Last modified November 16, 2021: Add flags to math operations (63d34c2)