This program renders a decorative television set graphic on screen using a combination of BASIC DRAW/CIRCLE commands, UDG (User Defined Graphics) characters, and PRINT AT statements. Four UDG characters (\\a through \\d) are defined in lines 30–70 by POKEing pixel data into the UDG memory area, forming parts of the TV cabinet corners and body. Two rounded-rectangle shapes are drawn with arced corners using DRAW with a radian argument, simulating the TV screen bezel and outer casing, while two CIRCLE commands add antenna knobs. A decorative border outline is then drawn using a series of DRAW commands restored from line 230, and text labels including “TS 2068,” “I LOVE MY,” and “TIMEX/SINCLAIR COMPUTER” are printed at specific screen positions.
Program Structure
The program is organized into a clear sequence of rendering passes. Lines 20–70 handle initialization and UDG definition. Lines 80–140 draw the two rounded-rectangle shapes representing the TV body and screen bezel, plus antenna knobs. Lines 160–200 lay down a grid of UDG characters forming the TV cabinet area. Lines 210–230 draw a decorative outer border. Lines 240–250 print text overlays. Lines 260–410 contain the DATA blocks consumed by the DRAW loops. Line 420 halts execution, and line 430 saves the program.
UDG Definition
Lines 30–70 define four UDGs (\\a, \\b, \\c, \\d) by RESTOREing to line 40 and POKEing 32 bytes (4 characters × 8 bytes each) into USR "\\a" and successive addresses. The DATA values use the literal token A (likely intended as 0 or a variable, though in context it reads as the numeric value of the variable A which is uninitialized and thus 0) for the padding rows. This means rows 2 and 3 of each UDG character are effectively zero, giving each glyph a top-heavy or bottom-heavy pixel pattern depending on which bytes are nonzero.
Rounded Rectangle Drawing
Two rounded rectangles are drawn to simulate the TV outline and screen border. Each is constructed in an 8-step loop (lines 90–100 and 120–130) using DRAW x,y,r where a nonzero r produces a circular arc and r=0 produces a straight line. The DATA for the first shape is at lines 260–330 and for the second at lines 340–410. The technique of alternating straight DRAW segments with quarter-circle arcs (r=1.57 ≈ π/2) is a standard Sinclair idiom for drawing rounded rectangles.
Decorative Border via DRAW Loop
Line 210 plots an origin point at (3,12), then line 220 RESTOREs to line 230 and loops 17 times, reading pairs x,y and executing DRAW x,y to trace the outer decorative border of the TV set. The embedded character codes \\{20}\\{1}\\{20}\\{0} in line 220 are OVER 1 and OVER 0 control sequences embedded directly in the line, toggling the OVER attribute mid-statement to produce the border effect without overwriting previously drawn content.
Text Placement
Lines 240 and 250 use PRINT AT to overlay text on the graphic. Notably, line 250 uses AT PI,9 — since PI ≈ 3.14159, this truncates to row 3, placing “I LOVE MY” at row 3, column 9. This is an incidental use of the constant PI as a row number rather than a deliberate technique, but it is valid BASIC since AT accepts any numeric expression.
Notable Techniques
- RESTORE with a specific line number is used multiple times to re-read different DATA blocks without consuming data sequentially from the top.
- UDGs \\a–\\d form corner and body tiles for the TV cabinet, printed in a grid pattern across lines 160–200.
- Two CIRCLE calls at lines 140–150 render small circular knobs on the TV face.
- The
DRAW x,y,rarc technique withr≈π/2creates smooth quarter-circle corners on both rounded rectangles.
Anomalies and Notes
The DATA values A in lines 40–70 refer to the variable A, which is never assigned a value before these lines execute. In Sinclair BASIC, uninitialized numeric variables default to 0, so those DATA entries effectively store 0, making the second and third rows of each UDG blank. This appears to be an inadvertent use of a variable name where a literal 0 was intended, but the result is functionally equivalent.
Line 420 uses STOP to prevent the program from falling into the DATA lines after the drawing is complete. Line 430 saves the program with LINE 10 for auto-run.
Source Code
10 REM RICK JOHNSON CINCINNATIOH. T/S GROUP SCREEN DISPLAY
20 INK 9:PAPER 6:BORDER 4:BRIGHT 0:OVER 0:INVERSE 0:CLS
30 RESTORE 40:FOR b=0 TO 31:READ a:POKE USR "\a"+b,a:NEXT b
40 DATA 0,A,A,15,16,63,32,63
50 DATA 0,A,A,255,0,255,0,255
60 DATA 0,A,A,240,8,252,4,252
70 DATA 0,A,A,60,66,255,129,255
80 PLOT 70,90:RESTORE 260
90 FOR b=1 TO 8
100 READ x,y,r:DRAW x,y,r:NEXT b
110 PLOT 65,80:RESTORE 340
120 FOR b=1 TO 8
130 READ x,y,r:DRAW x,y,r:NEXT b
140 CIRCLE 180,150,6
150 CIRCLE 180,130,6
160 PRINT AT 15,4;"\d \d \d \d \d \d \d \d \d \d"
170 PRINT " \d \d \d \d \d \d \d \d \d \d"
180 PRINT " \d \d \d \d \d \d \d \d \d \a\b\c"
190 PRINT " \a\c \d \d \d \d \d \d \d \d \d \a\c"
200 PRINT " \a\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\c"
210 PLOT 3,12
220 RESTORE 230:FOR b=1 TO 17:\{20}\{1}\{20}\{0} READ x,y:DRAW x,y::NEXT b
230 DATA 249,0,0,-10,-249,0,0,10,25,42,200,0,25,-42,-40,0,-20,42,35,0,-13,20,-174,0,-13,-20,2,3,196,0,-3,5,-190,0
240 PRINT AT 13,6;"T S 2068"
250 PRINT AT PI,9;"I LOVE MY"; AT 5,9;"TIMEX/"; AT 6,11;"SINCLAIR"; AT 8,10;"COMPUTER"
260 DATA 80,0,0
270 DATA 10,10,1.57
280 DATA 0,50,0
290 DATA -10,10,1.57
300 DATA -80,0,0
310 DATA -10,-10,1.57
320 DATA 0,-50,0
330 DATA 10,-10,1.57
340 DATA 120,0,0
350 DATA 15,15,1.57
360 DATA 0,55,0
370 DATA -15,15,1.57
380 DATA -120,0,0
390 DATA -15,-15,1.57
400 DATA 0,-55,0
410 DATA 15,-15,1.57
420 STOP
430 SAVE "T V" LINE 10
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
