A <- A - r
CP
r
b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
---|---|---|---|---|---|---|---|
1 | 0 | 1 | 1 | 1 | r |
The contents of the register r are compared to the contents of the Accumulator. If there is a true compare, the Z flag is set. The execution of this instruction does not affect the contents of the Accumulator. The r symbol identifies the registers A, B, C, D, E, H, or L, assembled as follows in the object code:
Register | r | Hex |
---|---|---|
A | 111 | $BF |
B | 000 | $B8 |
C | 001 | $B9 |
D | 010 | $BA |
E | 011 | $BB |
H | 100 | $BC |
L | 101 | $BD |
S | is set if result is negative, otherwise it is reset. |
Z | is set if result is 0, otherwise it is reset. |
H | is set if borrow from bit 4. |
P/V | is set if overflow, otherwise it is reset |
N | is set. |
C | is set if borrow, otherwise it is reset. |
If Register B contains $60 and the Accumulator contains $63, then upon the execution of
CP B
the P/V flag in the F Register is reset.