C-64 Time delay code?

Ethan Dicks ethan.dicks at gmail.com
Thu Jan 28 13:30:32 CST 2016

On Thu, Jan 28, 2016 at 12:40 PM, Kelly Fergason <kfergason at gmail.com> wrote:
> The C64 had TI$.  Its been a while... but you could do something like this:
> 10 TI$="000000"
> insert lots of program...
> 100 if TI$="000030" then print "30 seconds have passed! "

Using "equals" there can cause issues if somehow 31 seconds pass then
you check (perhaps the user hit RUN/STOP, waited, then CONTINUE...)

What's safer is

100 TI$="000000"
110 IF (TI < 1800) GOTO 110

Just reset TI/TI$ like line 100 every time you want to wait (you can't
set TI, only TI$), then loop until enough "jiffies" (1/60 sec) have
passed.  You could make it fancier with a subroutine that uses a
variable (in seconds) and does the math for you.

Many ways to do it.


More information about the cctalk mailing list