--- title: "GRAPHICS" id: 71048 type: "computer_media" slug: "graphics-2" url: "http://localhost/computer_media/graphics-2/" markdown_url: "http://localhost/computer_media/graphics-2.md" published_at: "2026-08-27T00:40:28+00:00" modified_at: "2026-08-27T00:42:21+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/08/graphics.png" alt: "GRAPHICS screen" excerpt: "A looping graphics showcase cycles through sine waves, spirals, arc-based shapes, and random patterns—each paired with BEEP tones—before restarting automatically." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" genre: - name: "Demo" slug: "demo" taxonomy: "genre" url: "http://localhost/type/demo/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/GRAPHICS%20%28198x%29%28-%29%28TS2068%29%28US%29%28Program%29.zip" tsrun_member: "GRAPHICS (198x)(-)(TS2068)(US)(Program).tap" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2026/08/graphics.png" alt: "GRAPHICS screen" media_type_tags: "Demo" --- # GRAPHICS This TS2068 BASIC program presents a looping graphics demonstration featuring ten distinct visual sequences, each accompanied by BEEP-generated sound effects. Sequences include sine-wave plots combined with DRAW crosses, rolling CIRCLE chains, colored horizontal scan-line fills using INVERSE, spiral inward rectangles, radial line fans, random noise patterns, an outlined “US ARMY” shield graphic with arc-based DRAW calls using the three-argument (arc) form, and a polygon-based star/box pattern. The program concludes with a separate spiral section (credited in a REM to “2068 SPIRAL”) that computes polygon vertices using trigonometry stored in DIM arrays, drawing all connecting chords between vertex pairs. The variable `zo` is initialized to 0 at line 20 and used pervasively as a zero placeholder throughout, a common memory-saving idiom. After completing all sequences, the program restarts itself with `RUN` for continuous looping, and line 1650 provides a `SAVE` with autostart. *** ### Program Structure The program is organized as a linear sequence of self-contained display segments, each concluded by a `PAUSE 240` and `CLS` to give the viewer time before the next segment. After all segments complete, line `1630` executes `RUN`, restarting the demonstration from the beginning. Lines `1640`–`1650` are unreachable dead code providing a `CLEAR` and `SAVE` with autostart at line 10. | Lines | Segment Description | | --- | --- | | 10–50 | Title screen: “GRAPHICS” centered, brief PAUSE | | 60–120 | Sine wave (PLOT) combined with DRAW crosses at each point | | 130–170 | Rolling chain of CIRCLE calls, INK 2 | | 180–330 | Outlined shape (lines 180–230), then horizontal scan-fill with INVERSE wipe | | 340–470 | Colored horizontal stripes (STEP 5) then OVER 1 vertical lines | | 480–530 | Radial fan lines from two fixed points | | 540–670 | Random small box-and-diamond shapes scattered across screen | | 680–770 | Inward-spiraling rectangle using alternating DRAW calls | | 780–820 | Concentric circles with random INK colors, centered at (127,87) | | 830–920 | Parallelogram-like shape built from accumulated DRAW calls | | 930–1100 | US ARMY shield: fan lines, arc DRAW calls, OVER 1 text label | | 1110–1240 | Nested square spiral with diagonal connectors, random INK | | 1250–1310 | Star burst: random DRAW from screen center (127,87) | | 1320–1390 | Expanding concentric squares from center | | 1400–1420 | “SPIRALS” title card | | 1430–1630 | Polygon chord spiral: n-gons from n=1 to 20, all chords drawn | ### The `zo` Zero Variable Idiom Line `20` sets `LET zo=0`. This variable is then used throughout the program wherever a literal `0` would appear — in `DRAW` arguments, `FOR` loop starts, `INK` and `INVERSE` values, and `PAPER` settings. On the ZX Spectrum, storing a frequently-used small integer as a variable and referencing it by name is slightly shorter in tokenized form than repeating the full floating-point literal `0`, saving a few bytes per occurrence across a long program. ### DRAW Arc Syntax Several segments use the three-argument form of `DRAW`, e.g. `DRAW -10,zo,-2` (line 190) and `DRAW -30,-7,.77` (line 1030). The third argument is the arc angle in radians; a value of 0 gives a straight line, positive/negative values curve the line clockwise or counterclockwise. The US ARMY shield segment (lines 930–1060) makes deliberate use of this to form curved top and bottom edges of the shield outline. ### Polygon Chord Spiral (Lines 1430–1630) This segment, credited in a REM to “2068 SPIRAL”, computes the vertices of a regular n-gon for `n` from 1 to 20 and draws all chords between every pair of vertices — producing the visual effect of increasingly complex complete graphs. Key implementation details: - `DIM x(25)` and `DIM y(25)` store computed vertex coordinates. - Vertex angle: `a = i * (PI / (n/2))`, equivalent to `2*PI*i/n`, giving evenly spaced points on a circle of radius 87 pixels. - Chord drawing uses a double nested loop (`j` from 1 to n, `k` from j to n) for the upper triangle of the adjacency matrix, avoiding duplicate lines. - Line `1490` contains `IF n<3 THEN NEXT n`, skipping the inner `FOR i` loop body for `n`=1 and `n`=2 by jumping directly to the next `n`. - Line `1610` checks `INKEY$="z"` to trigger a `COPY` (printer dump) while the image is displayed. - `POKE 23609,20` at line 1430 sets the printer speed system variable (CDFLAG area), relevant to the `COPY` command behavior on this system. ### Sound Generation Sound is produced throughout using `BEEP` with very short durations (typically 0.005 or 0.01 seconds) tied to the loop variable `A`. The pitch formula `a/10+10` maps the loop counter to a rising musical pitch, producing a continuous ascending tone as graphics are drawn. The condition `a/10 - INT(a/10) < 0.05` (or similar thresholds) is used in some loops to reduce BEEP frequency, only sounding a note every 10 iterations approximately, preventing the audio from slowing down rendering too much. ### OVER and INVERSE Usage Lines 280–320 demonstrate a scan-line fill and wipe technique: first a `FOR` loop draws horizontal lines bottom-to-top using `DRAW 255,zo` (INK 1, normal video), then a second pass uses `INVERSE 1` to erase those lines top-to-bottom, effectively creating a wipe animation. Lines 390–450 use `OVER 1` (XOR drawing mode) to overlay vertical colored lines on top of the previously drawn horizontal stripes without erasing them, producing a color grid. ### Potential Anomalies - Line `1490`: `IF n<3 THEN NEXT n` — this exits the `FOR i` loop prematurely for small `n` by jumping to the outer `NEXT n`, which is valid but non-obvious control flow. - Lines `370` and `410`: `LET i=i+1: IF i=8 THEN LET i=2: INK i` — the `INK i` call only executes when `i` wraps to 2, so the `INK` attribute set by `PLOT INK i;` in the following line is the operative color-setting mechanism for other values of `i`. - Lines `1640`–`1650` are unreachable since line `1630` executes `RUN`, restarting the program. These lines exist solely for the `SAVE` with autostart and would need to be run manually from the editor. - The segment at lines 830–920 accumulates DRAW calls without resetting position via PLOT between many of them, so the figure drawn is highly dependent on the exact turtle-graphics position left by prior DRAW calls — this appears intentional for the abstract shape produced. ## Source Code ``` 10 REM "GRAPHICS" 20 BRIGHT 1:CLS :LET zo=0 30 BORDER 5:PAPER 7:INK zo:INVERSE zo 40 PRINT AT 10,12;"GRAPHICS" 50 PAUSE 60:CLS 60 RANDOMIZE 70 FOR A=20 TO 235 80 IF a/10- INT (a/10)<.05 THEN BEEP .005,a/10+10 90 PLOT A,87+60* SIN (A/40.5) 100 DRAW 20,20:DRAW -40,-40 110 NEXT A 120 PAUSE 240:CLS 130 INK 2 140 FOR A=20 TO 235 STEP 4 150 BEEP .005,a/10+10 160 CIRCLE A,87,20:NEXT a 170 PAUSE 240:CLS 180 INK zo:PLOT 0,160 190 DRAW 30,zo:DRAW 10,-10,-2 200 DRAW zo,-20:DRAW -10,zo 210 DRAW zo,10:DRAW -10,10,2 220 DRAW -20,zo:PLOT 35,130 230 DRAW zo,-130 240 LET i=1 250 INK 1 260 FOR A=zo TO 129 270 IF a/10- INT (a/10)<.2 THEN BEEP .005,a/10+10 280 PLOT 0,A:DRAW 255,zo:NEXT a 290 FOR A=129 TO 0 STEP -1 300 BEEP .005,a/10+10 310 INVERSE 1:PLOT 0,A 320 DRAW 255,zo:NEXT A 330 INVERSE zo:PAPER zo:INK 9:PAUSE 240:CLS 340 LET i=2 350 FOR A=zo TO 175 STEP 5 360 BEEP .005,a/10+10 370 LET i=i+1:IF i=8 THEN LET i=2:INK i 380 PLOT INK i;0,A:DRAW INK i;255,zo:NEXT a 390 OVER 1 400 FOR A=zo TO 255 STEP 5 410 LET i=i+1:IF i=8 THEN LET i=2:INK i 420 BEEP .005,a/10+20 430 PLOT INK i;A,zo 440 DRAW INK i;0,175:NEXT a 450 OVER zo 460 PAPER 7:INK 5 470 PAUSE 240:CLS 480 FOR A=-127 TO 128 490 IF a/10- INT (a/10)<.1 THEN BEEP .005,a/10+10 500 PLOT 127,zo:DRAW A,87 510 PLOT 127,175:DRAW A,-88 520 NEXT A 530 PAPER zo:PAUSE 240:CLS 540 FOR A=zo TO 50 550 LET B= INT (RND*241) 560 INK INT (RND*4)+4 570 PLOT b, INT (RND*161) 580 BEEP .01,b/10+10 590 DRAW 10,zo:DRAW zo,10 600 DRAW -10,zo:DRAW zo,-10 610 DRAW 5,5:DRAW 10,zo 620 DRAW -5,-5:DRAW 5,5 630 DRAW zo,10:DRAW -5,-5 640 DRAW 5,5:DRAW -10,zo 650 DRAW -5,-5:DRAW 5,5 660 DRAW zo,-10:NEXT A 670 PAPER 7:INK 9:PAUSE 240:CLS 680 LET A=255 690 LET B=175 700 FOR C=zo TO 43 710 BEEP .005,c 720 DRAW A,zo:LET A=A-2 730 DRAW zo,B:LET B=B-2 740 DRAW -A,zo:LET A=A-2 750 DRAW zo,-B:LET B=B-2 760 NEXT C 770 PAUSE 240:CLS 780 FOR A=5 TO 87 STEP 3 790 BEEP .005,a/4+9 800 CIRCLE INK INT (RND*4);127,87,A 810 NEXT A 820 PAUSE 240:CLS 830 INK 1 840 FOR A=zo TO 127 850 IF a- INT a<.11 THEN BEEP .005,a/8+10 860 PLOT A+31,40 870 DRAW 63,31:NEXT A 880 DRAW -127,100 890 DRAW zo,-100 900 DRAW zo,100:DRAW -63,-131 910 INK 2 920 PAUSE 240:CLS 930 FOR A=171 TO 235 940 IF a- INT a<.11 THEN BEEP .005,a/8+10 950 PLOT A,80:DRAW 20,-20 960 PLOT A,94:DRAW 20,20 970 PLOT A,80:DRAW -15,-15 980 PLOT A,94:DRAW -15,15 990 NEXT A 1000 PLOT 235,80 1010 DRAW zo,14,1 1020 DRAW -147,zo 1030 DRAW -30,-7,.77 1040 DRAW 30,-7,.77 1050 DRAW 147,zo 1060 OVER 1 1070 PRINT AT 11,15;"US ARMY" 1080 BEEP .01,35:BEEP .01,24 1090 OVER zo 1100 PAUSE 240:CLS 1110 FOR A=100 TO 1 STEP -10 1120 INK INT (RND*4) 1130 BEEP .01,a/4+10 1140 PLOT 127-(A/2),50-(A/2):DRAW A,zo 1150 DRAW zo,A:DRAW -A,zo 1160 DRAW zo,-A:DRAW A/2,A/2 1170 DRAW A,zo:DRAW -A/2,-A/2 1180 DRAW A/2,A/2:DRAW zo,A 1190 DRAW -A/2,-A/2 1200 DRAW A/2,A/2:DRAW -A,zo 1210 DRAW -A/2,-A/2 1220 DRAW A/2,A/2:DRAW zo,-A 1230 NEXT A 1240 PAUSE 240:CLS 1250 INK 2 1260 FOR A=zo TO 200 1270 IF a/10- INT (a/10)<.11 THEN BEEP .005,a/10+10 1280 PLOT 127,87 1290 DRAW INT (RND*256)-127, INT (RND*176)-87 1300 NEXT A 1310 PAUSE 240:CLS 1320 INK 4 1330 FOR A=zo TO 175 STEP 2 1340 IF a/10- INT (a/10)<.11 THEN BEEP .005,a/10+10 1350 PLOT 127-(A/2),87-(A/2) 1360 DRAW A,zo:DRAW zo,A 1370 DRAW -A,zo:DRAW zo,-A 1380 NEXT A 1390 PAUSE 240:CLS 1400 PRINT AT 11,11;"SPIRALS" 1410 PAUSE 240 1420 REM "2068 SPIRAL" from the Oct. RAMTOP 1430 POKE 23609,20 1440 BORDER 2:PAPER zo:INK 7:CLS 1450 DIM x(25):DIM y(25) 1460 FOR n=1 TO 20 1470 CLS 1480 FOR i=1 TO n 1490 IF n<3 THEN NEXT n 1500 LET a=i*(PI/(n/2)) 1510 LET x=87* COS a:LET y=87* SIN a 1520 LET x(i)=x:LET y(i)=y 1530 NEXT i 1540 FOR j=1 TO n 1550 BEEP .01,20 1560 FOR k=j TO n 1570 BEEP .002,55 1580 PLOT x(j)+128,y(j)+87:DRAW (x(k)+128)-(x(j)+128),(y(k)+87)-(y(j)+87) 1590 NEXT k:NEXT j 1600 PAUSE 200 1610 IF INKEY$="z" THEN COPY 1620 NEXT n 1630 RUN 1640 BORDER 7:PAPER 7:INK zo:CLS 1650 CLEAR :SAVE "GRAPHICS" LINE 10 ```