Repeat: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
m (fix markup)
Line 2,224: Line 2,224:
===Using self-modifying code===
===Using self-modifying code===
This method assumes the routine doesn't use the B register, or restores it before returning. Also, the actual "wrapper" used to repeat the passed function must be in RAM so that its instructions can be modified at runtime.
This method assumes the routine doesn't use the B register, or restores it before returning. Also, the actual "wrapper" used to repeat the passed function must be in RAM so that its instructions can be modified at runtime.
<syntaxhighlight lang="z80">

LD HL,myFunc
LD HL,myFunc
LD (repeatproc+1),HL
LD (repeatproc+1),HL