CP r

Operation

A <- A - r

Mnemonic

CP

Operands

r

b7b6b5b4b3b2b1b0
1 0 1 1 1 r

Description

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:

RegisterrHex
A111$BF
B000$B8
C001$B9
D010$BA
E011$BB
H100$BC
L101$BD

Condition Bits Affected

Sis set if result is negative, otherwise it is reset.
Zis set if result is 0, otherwise it is reset.
His set if borrow from bit 4.
P/Vis set if overflow, otherwise it is reset
Nis set.
Cis set if borrow, otherwise it is reset.

Example

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.