(hope the result of my efforts will be nice surprise for this community! )
The problem is simple: how to wait some predefined fraction of second (with minimum space requirement)?
I do not need to do anything in the meantime!
PAUSE 50 will wait approximately 1 second.
PAUSE 32767 will wait approx. 11 minutes.
PAUSE [anything larger] will wait forever.
I don't know if fractions are respected. Perhaps your application is a good way to find out? if not you could always experiment with your own construct.
300 FOR I = 1 TO 99
310 NEXT I
Frankly my ZX81 is always too slow to ever be bored with the speed of the outside world.
PS: I already tried something similar but seems to fast even repeating it few times:marste wrote:Sorry, forgot to mention in the post: should be machine code (and should consume as minimum amount of byte as possible)!...
WAIT: DJNZ WAIT
Frames is decremented 50 times per second (every frame displayed on TV) - 60 times for NTSC systems (US version).
You may do something in the loop as the counter is automatically decremented from the display routine in the background.
You have to be sure not to miss the zero, otherwise it will count quite long (about 11 minutes till next zero. 32767/50 seconds).
Just setup BC register with the desired time, 100 in the example is about 2 seconds.
The time is not very exact and not useful for long exact timer application (a watch for example) as it is based on a crystal with much tolerance, up to +/- 2%.
Bit 7 in B register should be set always.
Code: Select all
LD BC,100 SET 7,B LD ($4034),BC ; set timer loop: LD HL,($4034) LD A,$7F AND H OR L JR NZ,loop ; wait for zero
Frames is not decremented during FAST.
The granularity is 20ms only.
There maybe a more precise granularity but this is complex while counting scanlines (64us steps).
Not sure if you really need this.
Code: Select all
LD BC,number of frames to wait CALL $0F35
I will experiment both solution tomorrow!
Thank you in the meantime!!