T/S 1000 Digital clock

The following program was excerpted from the book: HIGHFALUTIN’ COMPUTIN’ by Bob Orrfelt. It is reprinted here with permission from the author. Look for more excerpts in upcoming issues. You can obtain your own copy of this book from Sunset Electronics.

Cover of Highfalutin' Computin' with Bob Orrfelt on your Timex Sinclair 1000 Computer
Cover of Highfalutin' Computin' with Bob Orrfelt on your Timex Sinclair 1000 Computer

Program 4-3 (from Chapter IV, which is a study on the fundamentals of Basic programming), is a Digital Clock that produces large numerals five lines high.

Lines 100-130 define the four strings needed to form parts of the numerals. [g ] indicates a graphics mode space, so A$ is three black squares. Five C$’s each printed just below the last one, form a 1. These are used in the PRINT statements.

Lines 200-250 define constants needed to compact the program. Lines 2310-360 are used to set the starting time. U is the starting ten minutes digit and B becomes the units minutes digit. Lines 400-430 insert two colons at the proper position.

Lines 500-990 are the timing loops for the clock. The hours two digits are unique. Hours from 1 to 9 have a blank for the first digit, and only a 1 is needed for the hours of 10 through 12. Line 520 tests for the 1. If C is greater than 9; the program GOSUBs to line 2000 and inserts the 1. At 12:59:59 + one second line 970 resets the hour to 1 and clears the screen. The clock then starts off at 1:00:00. Lines 800-810 adjust the units seconds loop to one second.

Lines 1000-1095 are the PRINT statements to form the digits. THere are five ATs on each PRINT line. N, O, P, Q and R are the screen line locations. X is the column position. A$, B$, C$ and D$ are the black squares used to form the digits.

  10 REM "D.C"
20 REM (C)R.ORRFELT
30 REM AUG 1982
100 LET A$="ggg" [g ][g ][g ]
110 LET B$="g g" [g ][ ][g ]
120 LET C$=" g" [ ][ ][g ]
130 LET D$="g " [g ][ ][ ]
200 LET N=8
210 LET O=9
220 LET P=10
230 LET Q=11
240 LET R=12
250 LET K=1000
310 PRINT " INPUT HR AND MIN"
320 INPUT A
330 INPUT B
340 CLS
350 LET U=INT (B/P)
360 LET B=B-P*U
400 PLOT 18,24
410 PLOT 18,20
420 PLOT 38,24
430 PLOT 38,20
500 FOR H=A TO R
510 LET C=H
520 IF C>O THEN GOSUB 2000
530 LET X=5
540 GOSUB K+C*P
600 FOR T=U TO 5
610 LET X=Q
620 GOSUB K+T*P
630 FOR M=B TO O
640 LET X=15
650 GOSUB K+M*P
700 FOR D=0 TO 5
710 LET X=21
720 GOSUB K+D*P
730 FOR S=0 TO O
740 LET X=25
800 FOR Z=1 TO O
810 NEXT Z
900 NEXT S
910 NEXT D
920 NEXT M
930 LET B=0
940 NEXT T
950 LET U=0
960 NEXT H
970 LET A=1
980 CLS
990 GOTO 400
1000 PRINT AT N,X;A$,AT O,X;B$,AT P,X;B$,AT Q,X;B$,AT R,X;A$
1005 RETURN
1010 PRINT AT N,X;C$,AT O,X;C$,AT P,X;C$,AT Q,X;C$,AT R,X;C$
1015 RETURN
1020 PRINT AT N,X;A$,AT O,X;C$,AT P,X;A$,AT Q,X;D$,AT R,X;A$
1025 RETURN
1030 PRINT AT N,X;A$,AT O,X;C$,AT P,X;A$,AT Q,X;C$,AT R,X;A$
1035 RETURN
1040 PRINT AT N,X;B$,AT O,X;B$,AT P,X;A$,AT Q,X;C$,AT R,X;C$
1045 RETURN
1050 PRINT AT N,X;A$,AT O,X;D$,AT P,X;A$,AT Q,X;C$,AT R,X;A$
1055 RETURN
1060 PRINT AT N,X;A$,AT O,X;D$,AT P,X;A$,AT Q,X;B$,AT R,X;A$
1065 RETURN
1070 PRINT AT N,X;A$,AT O,X;C$,AT P,X;C$,AT Q,X;C$,AT R,X;C$
1075 RETURN
1080 PRINT AT N,X;A$,AT O,X;B$,AT P,X;A$,AT Q,X;B$,AT R,X;A$
1085 RETURN
1090 PRINT AT N,X;A$,AT O,X;B$,AT P,X;A$,AT Q,X;C$,AT R,X;A$
1095 RETURN
2000 LET C=C-P
2010 LET X=1
2020 GOTO 1010

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