How the repeat works is rather interesting, actually.
For example, LDIR acts almost exactly like LDI, in fact, this code acts almost exactly the same (except for speed
)
Effectively the pc does not change unless bc is zero; the instruction is executed over and over.
ldir_loop:
ldi
jp pe,ldir_loop