How can we make Commodore 64 BASIC pause for a specific time? We take a look at three techniques, including their strengths and weaknesses: 1) FOR/NEXT loops which are simple but somewhat inaccurate and not very CPU-accelerator-friendly, 2) polling the TIME variable which might be the best general approach, and 3) Using the esoteric WAIT command to watch particular bits in the C64's jiffy counter. Thanks to patron grymmjack for the question, and to Dr. Craig S. Bruce, Emily Christ, and Jarno Mielikäinen for their insight and help with the answers.
To support 8-Bit Show And Tell:
Become a patron: https://patreon.com/8BitShowAndTell
One-time donation: https://paypal.me/8BitShowAndTell
2nd channel: https://youtube.com/channel/UCAgWzEh5c8391eJnELDy9OA
End credits song is "Park Patrol" by Bedford Level Experiment. Check out the music video here: https://youtu.be/pA1MR3PuHxU
Index:
0:00 Question: how to sleep/pause/wait in BASIC?
0:23 1. FOR/NEXT loop
7:18 Why not linear?
11:55 2. Polling TI
16:04 A bug in the TI technique
20:50 3. WAIT 162,64
24:26 Why not WAIT 162,60?
29:50 Another WAIT approach
30:59 Conclusion and thanks!