Illusions

Developer(s): Tad Hendrickson
Date: 1986
Type: Program
Platform(s): TS 2068
Tags: Graphics

Draws a wire-frame globe five times, each view turned a little further, and stores each finished screen in memory with a short machine-code block copy (LDIR, POKEd from DATA). It then copies the five pictures back to the screen one after another, over and over, so the globe appears to rotate. Each view takes about a minute to draw in BASIC. The first article explains how to change the direction of rotation (left, right, up, down) and the globe’s size, and how to fit seven or fifteen smaller views by saving only part of the screen.

The first printing did not run as printed, and the September 1986 Plotter reprinted it (Illusions: A Recap, by Rod Gowen and Tad Hendrickson) in a version that runs: white on black, a smaller globe (radius 60) in the top two thirds of the screen, 4096 bytes copied per view instead of the whole 6144-byte screen, and a NEXT v added so the display loop shows all five views. That version is the main file. The recap suggests adding :CLS to line 280 and removing CLS from line 70 to see other effects.

The first printing is included as a second file, with corrections so it runs (INK 0: PAPER 7: BORDER 7 in line 70, which was printed with = signs, and a missing bracket in line 190). It also adds 325 NEXT V: as printed, line 330 went back before NEXT V, so only the first view was shown.

Published in The Plotter July-August 1986 (Illusions), and again, revised, in September 1986 (Illusions: A Recap).

Image Gallery

Source Code

   5 PAPER 0: BORDER 0
  10 FOR a=65510 TO 65521: READ byte: POKE a,byte: NEXT a
  20 FOR a=65522 TO 65533: READ byte: POKE a,byte: NEXT a
  30 LET p2=PI/2: LET sp=p2/9
  40 LET ep=sp/5: LET dt=PI/15
  50 LET b=1
  60 FOR v=1 TO 5
  70 INK 7: CLS
  80 PRINT AT 21,5;"...constructing view#";v
  90 LET dp=ep*v
 100 FOR i=dp TO PI STEP sp
 110 LET a=COS (i)
 120 LET first=1
 130 FOR t=0 TO PI STEP dt
 140 LET x=a*SIN (t)
 150 LET y=b*COS (t)
 160 LET px=x*60+127
 170 LET py=y*60+115
 180 IF first THEN  PLOT px,py: LET first=0
 190 IF NOT first THEN  DRAW (px-(PEEK 23677)),(py-(PEEK 23678))
 200 NEXT t
 210 NEXT i
 220 PRINT AT 21,0;"                             "
 230 READ code
 240 POKE 65512,code
 250 RANDOMIZE USR 65510
 260 NEXT v
 268 CLS
 270 RESTORE 420
 280 FOR v=1 TO 5
 290 READ code
 300 POKE 65527,code
 310 RANDOMIZE USR 65522
 320 NEXT v
 330 GO TO 270
 400 DATA 17,208,0,33,0,64,1,0,16,237,176,201
 410 DATA 17,0,64,33,208,0,1,0,16,237,176,201
 420 DATA 132,148,164,180,196

First printing (July-August 1986), as corrected:
  10 FOR A=65510 TO 65521:READ BYTE:POKE A,BYTE:NEXT A
  20 FOR A=65522 TO 65533:READ BYTE:POKE A,BYTE:NEXT A
  30 LET P2=PI/2:LET SP=P2/9
  40 LET EP=SP/5:LET DT=PI/15
  50 LET B=1
  60 FOR V=1 TO 5
  70 CLS:INK 0:PAPER 7:BORDER 7
  80 PRINT AT 21,5;"...constructing view#";V
  90 LET DP=EP*V
 100 FOR I=DP TO PI STEP SP
 110 LET A=COS(I)
 120 LET FIRST=1
 130 FOR T=0 TO PI STEP DT
 140 LET X=A*SIN(T)
 150 LET Y=B*COS(T)
 160 LET PX=X*80+127
 170 LET PY=Y*80+87
 180 IF FIRST THEN PLOT PX,PY: LET FIRST=0
 190 IF NOT FIRST THEN DRAW (PX-(PEEK 23677)),(PY-(PEEK(23678)))
 200 NEXT T
 210 NEXT I
 220 PRINT AT 21,0;"                             "
 230 READ CODE
 240 POKE 65512,CODE
 250 RANDOMIZE USR 65510
 260 NEXT V
 270 CLS
 280 RESTORE 1020
 290 FOR V=1 TO 5
 300 READ CODE
 310 POKE 65527,CODE
 320 RANDOMIZE USR 65522
 325 NEXT V
 330 GOTO 280
1000 DATA 17,208,0,33,0,64,1,0,24,237,176,201
1010 DATA 17,0,64,33,208,0,1,0,24,237,176,201
1020 DATA 132,156,180,204,228

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