This brings me to following approach with more easy calculation:
Code: Select all
ld c, N
loop djnz loop
dec c
jr nz, loop
Only the first iteration of B is undefined - giving a tolerance of about +/- 500us and a granularity in ms steps.
In SLOW mode you have to multiply with about factor 4, so it is C * 4ms +/- 2ms, giving an all in all running time of maximum 1 second with C=0.