CP

From GbdevWiki
Revision as of 09:03, 25 May 2012 by Beannaich (Talk | contribs) (Created page with 'The flags are updated as if a SUB instruction had been carried out. The only difference is that the Accumulator is not modified by this instruction. == Instructions == CP …')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The flags are updated as if a SUB instruction had been carried out. The only difference is that the Accumulator is not modified by this instruction.

Instructions

CP B    - $B8 - 1 Machine Cycle
CP C    - $B9 - 1 Machine Cycle
CP D    - $BA - 1 Machine Cycle
CP E    - $BB - 1 Machine Cycle
CP H    - $BC - 1 Machine Cycle
CP L    - $BD - 1 Machine Cycle
CP (HL) - $BE - 2 Machine Cycles
CP A    - $BF - 1 Machine Cycle
CP $NN  - $FE - 2 Machine Cycles

Flags

Z: 1 if result is zero; 0 otherwise
N: 1
H: 1 if borrow from bit 4; 0 otherwise
C: 1 if borrow; 0 otherwise