34 Rabbit 2000/3000 Microprocessor
Description
ComparesthedatainAwiththedatawhoseaddressiscontained in:
•HL,or
• the sum of the data in IX and a displacement value d,or
• the sum of the data in IY and a displacement value d.
These compares are accomplished by subtracting the appropriate data ((HL), (IX+d), or (IY+d)) from A. The
result is:
A<x:S=1,C=1,Z=0, L/V=V
A=x:S=0,C=0,Z=1, L/V=V
A>x:S=0,C=0,Z=0, L/V=V
Where x is (HL), (IX+d), or (IY+d) and “V” indicates that the overflow flag is set on an arithmetic overflow
result. That is, the overflow flag is set when the operands have different signs and the sign of the result is dif-
ferent 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 overflow flag will be set.
This operation does not affect the data in A.
CP (HL)
CP (IX+d)
CP (IY+d)
Opcode Instruction Clocks Operation
BE CP (HL) 5 (2,1,2) A - (HL)
DD BE d CP (IX + d) 9 (2,2,2,1,2) A - (IX + d)
FE BE d CP (IY + d) 9 (2,2,2,1,2) A - (IY + d)
Flags ALTD I/O
S Z L/V C F R SP S D
• • V • • •