CPDR
Repeats CPD until either:
- BC=0
- A=HL
Syntax
No operands.
CPDR
Effects
The carry is preserved, N is set and all the other flags are affected as defined. P/V denotes the overflowing of BC, while the Z flag is set if A=(HL) before HL is decreased.
Uses
Say you want to find the last occurrence of 124 in the valid memory space:
LD HL,0000h
LD BC,0000h
LD A,124
CPDR
Note if you used CPIR it would find the first occurrence of 124 in the valid memory space.
T-States
BC ≠ 0 and A ≠ (HL) | 21 |
BC = 0 or A = (HL) | 16 |
See Also
page revision: 4, last edited: 31 Oct 2014 12:56