Real Time Clock for Your TS2068

See all articles from The Plotter v3 n4
Author(s): Dick Scoville
Publication: The Plotter
Pub Details: The Plotter v3 n4 (Volume 3, Issue 4)
Pages: 7

The TS2068 doesn’t have a real time clock built in. If you want to keep time, here is a short program that will track it for you, even while running other programs. The only limitation the program imposes is that you will no longer be able to use the commands RUN, CLEAR or NEW. If you should, you will erase either the variables used by your “clock” or the entire program.

REAL TIME CLOCK PROGRAM

 8400 REM *** TIME
8402 PRINT "INPUT": PRINT
8403 PRINT "HR MIN SEC"
8404 INPUT U: INPUT V: INPUT W
8405 FOR I = 23672 TO 23674
8406 POKE I, 0
8407 NEXT I
8408 LET TM = 8420
8410 LET O1S = 60*60*(U-1)+60*V+W
8420 LET V = PEEK 23672/256 + PEEK 23673 + 256 * PEEK 23674: LET U = V * 4.2585
8425 LET U = U + O1S + .5
8427 LET V = INT (U/3600)
8428 LET W = INT (U/60)-60*V
8429 LET U = INT (U-60*60*V)-60*W
8430 LET V = V+1: IF V > 12 THEN LET V = V-12
8431 CLS: PRINT "HR MIN SEC"
8435 PRINT V; TAB 4; W ; TAB 8; U;" "
8436 STOP

Transcription note: the listing is corrected. As printed, line 8420 reads LET U = U * 4.2585, which shows the wrong time; corrected to LET U = V * 4.2585.

After you type in the program, start by typing “GOTO 8400”. It will ask you for the current time, which you enter, one value at a time. As soon as you’ve entered the second, it will start keeping time. To ask for time, type “GOTO tm”

If you wish to see the program update the time on the screen, change line 8431 from ‘CLS’ to ‘PRINT AT 0.0:’. In line 8435 add ‘:””‘ to the end of the line. And change line 8436 to ‘GOTO tm’. To end the screen display, type “BREAK”.

This program was created by Dick Scoville and originally published in the Triangle TS User Group Newsletter. Our thanks to both for permission to bring it to you here.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.