Digital Clock

Author(s): R. F. Fraser-Smith
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v2 n11 (Volume 2, Issue 11)
Date: November 1981
Pages: 15

This program operates as a digital clock, showing A.M. or P.M. and changing at 12:00. To start the clock, run the program, enter A.M. or P.M. and enter the current time as a 3 or 4 digit number. For example, type 216 for 2:16 or 1005 for 10:05.

While the clock is running, you can move it back 1 minute by pressing the J key and up 1 minute by pressing the K key. Pressing D or F, the SLOW and FAST keys, will cause the clock to run slower or faster by 1/60th second per minute.

If you are fascinated enough to keep it running for days and make fast and slow adjustments, you may find that P differs from 3572. Type PRINT P to see its new value and change line 70.

Byte savers: Line 10, use shift W for OR. Line 30, key INPUT first, then cursor left and key PRINT, use shift W for OR.

  10 PRINT "A.M. OR P.M."
20 INPUT M$
30 PRINT " INPUT TIME IN FORM 352 OR 1107"
40 INPUT T
50 LET H=INT (T/100)
60 LET M=T-H*100
70 LET P=3572
80 CLS
90 GOTO 200
100 LET M=M+1
110 IF INKEY$="F" THEN LET P=P-1
120 IF INKEY$="D" THEN LET P=P+1
130 IF INKEY$="J" THEN LET M=M-2
140 IF M=60 THEN LET H=H+1
150 IF M=60 THEN LET M=0
160 IF H=13 THEN LET H=1
170 LET C$=M$
180 IF H=12 AND M=1 AND C$="A.M." THEN LET M$="P.M."
190 IF H=12 AND M=1 AND C$="P.M." THEN LET M$="A.M."
200 PRINT AT 21,18;H;".";M;" ";M$;" "
210 PAUSE P
220 POKE 16437,255
230 GOTO 100
Syntactic Sum: 30942, 8K

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