Instruction Reference Manual 35
Description
Compares the data in A with an 8-bit constant n. This compare is accomplished by subtracting n from A. The
result is:
A<n:S=1,C=1,Z=0, L/V=V
A=n:S=0,C=0,Z=1, L/V=V
A>n:S=0,C=0,Z=0, L/V=V
“V” indicates that the overflow flag is set on an arithmetic overflow result. That is, the overflow flag is sig-
nalled 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 if A contains 0x80 and you're comparing it to 0x01 the over-
flow flag will be set.
This operation does not affect the data in A.
CP n
Opcode Instruction Clocks Operation
FE n CP n 4 (2,2) A-n
Flags ALTD I/O
S Z L/V C F R SP S D
• • V • •