Repeats CPI until either:
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.
If you want to find the first occurrence of 124 in the valid memory space:
LD HL,0000h LD BC,0000h LD A,124 CPIR
Note if you used CPDR it would find the last occurrence of 124 in the valid memory space.
|BC ≠ 0 and A ≠ (HL)||21|
|BC = 0 or A = (HL)||16|