Kaleidoscope (Time Designs)

Developer(s): Zack Xavier Haquer
Date: 1986
Type: Program
Platform(s): ZX81, TS 1000, TS 1500
Tags: Graphics

A kaleidoscope display in machine code. It picks a random point and prints a fill character at it and at its three mirror images around the centre of the screen, over and over, cycling through the characters in the line 2 REM. Load it and it runs at once; press BREAK to stop. Change the line 2 REM to change the pattern; the author suggests symmetrical characters such as O, *, =, +, the grey squares and their inverses.

The article first gives the same program in BASIC, to show how slow it is, then a loader to POKE 172 bytes into a 1 REM line. The download has the finished machine-code program (16K), the 2K version from Listing 4, which blanks the right-hand column so the display file is fully expanded, and the BASIC prototype.

Published in Time Designs November/December 1986 (Kaleidoscope).

Related Articles

Many "Kaleidoscope" programs have appeared over the years. These simple, but fascinating graphics displays have been adapted to virtually every computer ever built. The ZX81/TS family is no exception. Unfortunately, since the Z80 CPU in these machines is {effectively} clocked at only -5 mHZ in SLOW mode, the result is rather slow and BO-RING.

Image Gallery

Source Code

LISTING 1: BASIC Prototype
  10 LET F$="«=» ▒«*»«▒»"
  20 POKE 16418,0
  30 LET POINT=0
  40 LET POINT=POINT+1
  50 IF POINT>LEN F$ THEN GOTO 3
0
  60 LET A$=F$(POINT)
  70 LET B=INT (RND*12)
  80 LET C=INT (RND*16)
  90 GOSUB 250
 100 GOSUB 350
 110 GOSUB 1000
 120 GOSUB 250
 130 GOSUB 400
 140 GOSUB 1000
 150 GOSUB 300
 160 GOSUB 350
 170 GOSUB 1000
 180 GOSUB 300
 190 GOSUB 400
 200 GOSUB 1000
 210 GOTO 40
 250 LET X=16+C
 260 RETURN
 300 LET X=16-C
 310 RETURN
 350 LET Y=12+B
 360 RETURN
 400 LET Y=12-B
 410 RETURN
1000 PRINT AT Y,X;A$
1010 RETURN

LISTING 2: Machine-code Loader
   1 REM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
   2 FAST
   3 FOR A=16514 TO 16685
   4 SCROLL
   5 INPUT B
   6 POKE A,B
   7 PRINT A,PEEK A
   8 NEXT A

TABLE 1: Machine-code Decimal Data
 17: 51: 65: 19: 26:254:118: 40:
247:237: 83: 22: 64: 17: 75:  0:
237: 75: 50: 64:  3: 98:104:205:
  9: 19:229: 98:105:205:  9: 19:
193:124:129: 48:  1:  4:103:125:
144: 48:  1: 37:111: 43: 34: 50:
 64: 69: 76:203: 57:203: 57:203:
 57:203: 57:  6: 12:184: 56:  3:
144: 24:250: 71:197:205:246: 64:
205:  0: 65:205: 10: 65:193:197:
205:246: 64:205:  5: 65:205: 10:
 65:193:197:205:251: 64:205:  0:
 65:205: 10: 65:193:205:251: 64:
205:  5: 65:205: 10: 65:205: 70:
 15: 56:144:201: 62: 16:129: 79:
201: 62: 16:145: 24:249: 62: 12:
128: 71:201: 62: 12:144: 24:249:
 42: 12: 64: 35:197: 14:  0:203:
 56:203: 25:203: 56:203: 25:203:
 56:203: 25:  9:193:120:129:  6:
  0: 79:  9:237: 91: 22: 64: 26:
203:183:119:201:

LISTING 3: M/C KALEIDOSCOPE
   1 REM (the 172 Table 1 bytes, printed as their ZX81 tokens/characters)
   2 REM «=» ▒«*»«▒»
   3 SLOW
   4 RAND USR 16514
   5 SAVE "KSCOPE"
   6 RUN

LISTING 4: 2K Changes
   3 SLOW
   4 POKE 16418,0
   5 FOR A=0 TO 23
   6 PRINT AT A,31;" "
   7 NEXT A
   8 POKE 16418,2
   9 RAND USR 16514
  10 SAVE "KSCOPE2K"
  11 RUN

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