CPI¶
- CPI
- Compare and Increment
- Description
- Performs
cp a,(hl), then incrementsHLand decrementsBC.cp a,(hl) inc hl dec bc
- Uses
- This instruction is not very useful on its own, as
cp a,(hl)is both smaller and faster than a singleCPI, but more often used is the repeating version ofCPI:CPIR
- This instruction is not very useful on its own, as
- Results
Register/Flag 16-bit (non-ADL) 24-bit (ADL) SflagSet if result is negative; else reset ZflagSet if A=(HL); else resetHflagSet if borrow from bit 4; else reset P/VflagSet if BC≠ 0 after the operation; else resetNflagSet CflagNot affected - Allowed Instructions
Instruction Opcode CC (ADL/non-ADL) CC (.S) CC (.L) cpi $ED, $A1 2F + 1R 3F + 1R 3F + 1R - Notes
- Although this instruction increments
HL, it decrementsBC.
- Although this instruction increments
- See Also
- CP, CPD, CPDR, CPIR, LDI