Z80 Assembly 15: Timers, Delays, and the Refresh Register (R)

Creating Software Delay Loops Since the Z80 runs at a fixed clock speed, you can create a precise time delay by executing a loop a fixed number of times, knowing the exact number of clock cycles each instruction takes. The Delay Routine: A delay routine typically uses nested loops and relies on the DJNZ instruction, as it’s efficient for looping. Example: Basic 16-bit Delay Loop This example uses the BC register pair for a longer delay (B for the outer loop, C for the inner loop). ...

September 27, 2025