Block Search // CPI (ComPare and Increment)
The contents of the memory location addressed by the HL register is compared with the contents of the Accumulator. With a true compare, a condition bit is set. Then HL is incremented and the Byte Counter (register pair BC) is decremented.
If the HL register pair contains 1111h, memory location 1111h contains 3Bh, the Accumulator contains 3Bh, and the Byte Counter contains 0001h. Upon the execution of a CPI instruction, the Byte Counter contains 0000h, the HL register pair contains 1112h, the Z flag in the F register is set, and the P/V flag in the F Register is reset. There is no effect on the contents of the Accumulator or to address 1111h.