Graphic

Date: 1986
Type: Program
Platform(s): TS 2068
Tags: Demo, Graphics

This program draws a continuously animating geometric pattern on screen using overlapping diagonal line plots. It uses the SOUND command to initialize the AY sound chip with a specific register configuration before entering the drawing routines. Lines 14 through 19 repeatedly PLOT a starting point and issue pairs of DRAW commands with equal-and-opposite slopes (63,175 and 62,-175), creating a dense web of crossing diagonal lines across the screen. The FOR loop ranges vary across lines, causing the pattern to grow and shift with each iteration before looping back via GO TO 15. The OVER 1 attribute causes lines to XOR with existing pixels, producing a moire-like interference effect as lines are redrawn.


Program Analysis

Program Structure

The program is divided into two functional phases: a one-time initialization block (lines 0–10) and a continuous drawing loop (lines 14–20). After setup, execution cycles between lines 15 and 20 indefinitely via GO TO 15, with line 14 only executing on the first pass.

  1. Line 0: REM block containing copyright and author attribution.
  2. Line 10: Screen clear, OVER 1 mode activation, and AY sound chip register setup.
  3. Lines 14–19: Six FOR loops each drawing overlapping diagonal line pairs.
  4. Line 20: GO TO 15 — returns to line 15, skipping line 14 on all subsequent iterations.

SOUND Chip Initialization

Line 10 uses the SOUND command to configure the AY-3-8912 sound chip registers directly. The parameters set register pairs for tone periods, noise, mixer, and amplitude:

RegisterValueFunction
0254Channel A tone period (low byte)
15Channel A tone period (high byte)
2255Channel B tone period (low byte)
35Channel B tone period (high byte)
4253Channel C tone period (low byte)
55Channel C tone period (high byte)
756Mixer control (tones/noise enables)
815Channel A amplitude
915Channel B amplitude
1015Channel C amplitude

Mixer register 7 = 56 (binary 00111000) enables noise on all three channels and disables tone output, with all amplitudes set to maximum fixed level (15). This produces a sustained noise burst on program start.

Drawing Technique

Each FOR loop in lines 14–19 iterates over a range of X coordinates at either y=0 or y=175. From each plotted point, two DRAW commands are issued: DRAW 63,175 followed by DRAW 62,-175. This traces a tall, narrow zigzag from the starting point, producing dense crossing diagonals across the 256×176 pixel screen area.

The loop ranges differ between lines, creating varying densities of coverage:

LineX rangeStart YIterations
1438–92055
1538–9217555
1643–87045
1728–10217575
1828–10217575
1928–6217535

OVER 1 and XOR Effect

OVER 1, set once in line 10, causes all subsequent PLOT and DRAW operations to XOR pixels with the existing screen content rather than overwriting them. As lines are redrawn across multiple loop iterations, pixels that are plotted an even number of times cancel out, creating a dynamic, shifting moire interference pattern characteristic of this technique.

Loop Design and Line 14 Anomaly

Because GO TO 15 is used at line 20, line 14 executes only once — on initial program run. Lines 17 and 18 are identical in both X range and starting Y coordinate, meaning that pass effectively doubles the stroke density for that particular range on every cycle through the main loop. It is unclear whether this is intentional for visual effect or an authoring oversight.

Notable Techniques

  • Using OVER 1 globally to achieve XOR pixel toggling without per-line mode switching.
  • Deliberately excluding line 14 from the infinite loop to create an asymmetric first frame.
  • Drawing lines whose combined horizontal span (63+62=125 pixels) is close to half the screen width, producing a structured rather than random web.
  • AY chip configured for noise-only output at startup with no subsequent SOUND commands, leaving the noise running continuously under the animation.

Content

Related Products

Related Articles

Related Content

Image Gallery

Graphic

Source Code

    0 REM                                                        ©1986 BYTE POWER                WRITTEN BY E & K BOISVERT         
   10 CLS : OVER 1: SOUND 0,254;1,5;2,255;3,5;4,253;5,5;7,56;8,15;9,15;10,15
   14 FOR x=38 TO 92: PLOT x,0: DRAW 63,175: DRAW 62,-175: NEXT x
   15 FOR x=38 TO 92: PLOT x,175: DRAW 63,-175: DRAW 62,175: NEXT x
   16 FOR x=43 TO 87: PLOT x,0: DRAW 63,175: DRAW 62,-175: NEXT x
   17 FOR x=28 TO 102: PLOT x,175: DRAW 63,-175: DRAW 62,175: NEXT x
   18 FOR x=28 TO 102: PLOT x,175: DRAW 63,-175: DRAW 62,175: NEXT x
   19 FOR x=28 TO 62: PLOT x,175: DRAW 63,-175: DRAW 62,175: NEXT x
   20 GO TO 15

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

Scroll to Top