Tapestry

This file is part of and Synchro-Sette February 1983. Download the collection to get this file.
Date: February 1983
Type: Program
Platform(s): TS 1000

This program draws two successive animations on screen: first, a rectangular spiral that fills the display by printing a randomly chosen block-graphic character along each side, shrinking inward with each pass; second, a series of concentric circles drawn using trigonometric PRINT AT positioning, stepping through 360 degrees in 10-degree increments for radii from 10 down to 2. The random character selection at line 5 (and again at line 240) picks from characters 128–138, with the high-bit toggle controlled by a Boolean expression `128*(RND<0.5)`, alternating between normal and inverse block graphics. After the circle animation completes, the screen pauses briefly, clears, and the whole program restarts via RUN. The spiral is driven by four boundary variables (A, B, D, E) that tighten each iteration, terminating when the left column meets or exceeds the right column.


Program Analysis

Program Structure

The program divides into three logical phases:

  1. Initialisation (lines 1–5): Sets the four boundary variables and picks an initial random display character.
  2. Rectangular spiral (lines 50–220): Iteratively draws the four sides of a shrinking rectangle using PRINT AT, tightening the bounds each pass until the boundaries collapse.
  3. Concentric circles (lines 230–290): Uses sine and cosine to place characters around circles of decreasing radius, followed by a pause, clear, and RUN to loop.

Spiral Mechanism

Four variables track the current rectangle: A (top row), B (bottom row), D (left column), E (right column). Each complete pass draws the left edge (top→bottom), the bottom edge (left→right), the right edge (bottom→top), and the top edge (right→left). After each pass, B and E shrink by 1 while A and D grow by 1, closing the rectangle inward. The termination condition at line 210 checks D>=E.

Character Selection Technique

Line 5 generates Z$ with the expression CHR$ (INT (RND*11+128*(RND<0.5))). This selects a character code in the range 128–138 (the block graphic set). The sub-expression 128*(RND<0.5) evaluates the Boolean comparison as 1 or 0, multiplies by 128, and thereby randomly chooses between the normal block graphic range (128–138) and, when zero, codes 0–10 — effectively producing either a block graphic or a control/space character. The same expression is reused at line 240 for each concentric ring, giving each circle a distinct random character.

Trigonometric Circle Drawing

Lines 250–280 loop A from 0 to 360 in steps of 10 degrees. The angle is converted to radians at line 260 as B=A*PI/180, then PRINT AT 10+C*COS B, 15+C*SIN B places the character around a circle of radius C character cells, centred approximately at row 10, column 15. The outer loop runs C from 10 down to 2, so circles are drawn largest-first.

Variable Reuse

The variables A and B, used as boundary coordinates in the spiral phase, are repurposed in the circle phase (lines 250–280) as the angle counter and the radian value respectively. This is intentional economy rather than a bug, since the spiral phase has completed before these lines are reached.

Key BASIC Idioms

  • 128*(RND<0.5) — Boolean-as-integer multiplication to conditionally add an offset.
  • STEP -1 on FOR loops to traverse edges in reverse (lines 110, 170).
  • RUN at line 320 for an infinite loop, reinitialising all variables cleanly.
  • PAUSE 200 (≈3.5 seconds) providing a brief rest between the two animation phases.

Variable Summary

VariableSpiral phase roleCircle phase role
ATop row boundaryAngle counter (degrees)
BBottom row boundaryAngle in radians
CLoop counter for each edgeCircle radius (10→2)
DLeft column boundaryUnused
ERight column boundaryUnused
Z$Character to printCharacter to print

Content

Appears On

Cassette to accompany the February 1983 issue of Synchro-Sette.

Related Products

Related Articles

Related Content

Image Gallery

Tapestry

Source Code

   1 LET A=0
   2 LET B=21
   3 LET D=0
   4 LET E=31
   5 LET Z$=CHR$ (INT (RND*11+128*(RND<0.5)))
  50 FOR C=A TO B
  60 PRINT AT C,D;Z$
  70 NEXT C
  80 FOR C=D TO E
  90 PRINT AT B,C;Z$
 100 NEXT C
 110 FOR C=B TO A STEP -1
 120 PRINT AT C,E;Z$
 130 NEXT C
 140 LET B=B-1
 150 LET D=D+1
 160 LET E=E-1
 170 FOR C=E TO D STEP -1
 180 PRINT AT A,C;Z$
 190 NEXT C
 200 LET A=A+1
 210 IF D>=E THEN GOTO 230
 220 GOTO 5
 230 FOR C=10 TO 2 STEP -1
 240 LET Z$=CHR$ (INT (RND*11+128*(RND<0.5)))
 250 FOR A=0 TO 360 STEP 10
 260 LET B=A*PI/180
 270 PRINT AT 10+C*COS B,15+C*SIN B;Z$
 280 NEXT A
 290 NEXT C
 300 PAUSE 200
 310 CLS 
 320 RUN 
 9998 SAVE "TAPESTR%Y"
 9999 RUN 

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

People

No people associated with this content.

Scroll to Top