MODified Squares

Developer(s): Peter McMullin
Date: 1986
Type: Program
Platform(s): ZX81, TS 1000, TS 2068
Tags: Graphics

A 4 by 4 grid of squares, each drawn eighteen times and turned a little each time so that the corners spiral inward; neighbouring squares turn opposite ways. Like MODified Triangles it uses a one-line MOD subroutine, and it is Program 2 of Peter McMullin’s adaptation of Paul W. Carlson’s “MODified Shapes for IBM” (COMPUTE!, May 1986).

Printed for the TS2068 (line 865) and for a ZX81 with the JLO video system and JOBASIC or PIXL-ATR (line 855), or any hi-res package with a DRAW or LINE command, with margin notes for the TS2068 versions of lines 25 and 30; the reader deletes the line for the other machine. As printed, with both lines in place, it stops at line 855 with variable V not found.

Published in Sinc-Link November-December 1986 (ZX81 Resources).

Related Articles

Update on ZX81 disk drives, Dungeons of Ymir, correction to program in prior article.

Image Gallery

Source Code

   2 REM For ZX81: INITIALIZE JOBASIC OR PIXL-ATR ETC.
   3 GOTO 40
   5 REM MODULO SUBROUTINE
   6 LET RES=ARG-INT (ARG/MOD)*MOD
   7 RETURN
  10 REM IBM>SINCLAIR PLOT SCALING
  15 LET XX1=(X1/1.25)+XSET
  20 LET XX2=(X2/1.25)+XSET     2068: USE
  25 LET YY1=191-(Y1/1.1)       YY1=175-(Y1/1.3)
  30 LET YY2=191-(Y2/1.1)       YY2=175-(Y2/1.3)
  35 RETURN
  40 DIM X(4)
  50 DIM Y(4)
  60 DIM Z(4)
  70 DIM T(4)
  80 LET XSET=-3
 100 LET SU=.12
 110 LET RU=1-SU
 200 FOR I=0 TO 3
 210 FOR J=0 TO 3
 220 LET ARG=I
 230 LET MOD=2
 240 GOSUB 5
 250 LET RI=RES
 260 LET ARG=J
 270 GOSUB 5
 280 IF RI=RES THEN GOTO 400
 300 LET Y(1)=49
 310 LET Y(2)=0
 320 LET Y(3)=0
 330 LET Y(4)=49
 340 GOTO 500
 400 LET Y(1)=0
 410 LET Y(2)=49
 420 LET Y(3)=49
 430 LET Y(4)=0
 500 LET X(1)=20
 510 LET X(2)=20
 520 LET X(3)=89
 530 LET X(4)=89
 600 FOR N=0 TO 17
 610 LET X1=X(4)+I*69
 620 LET Y1=Y(4)+J*49
 700 FOR M=1 TO 4
 710 LET X2=X(M)+I*69
 720 LET Y2=Y(M)+J*49
 800 LET ARG=M
 810 LET MOD=2
 820 GOSUB 5
 830 LET C=RES+1
 835 REM SET INK COLOUR BY C
 840 GOSUB 10
 850 REM DRAW SIDE (JOBASIC)
 855 IF USR V THEN LPRINT D;XX1,YY1;XX2,YY2
 860 REM DRAW SIDE (2068)
 865 PLOT XX1,YY1: DRAW XX2-XX1,YY2-YY1
 870 LET X1=X2
 875 LET Y1=Y2
 880 LET ARG=M
 885 LET MOD=4
 890 GOSUB 5
 895 LET NJ=RES+1
 900 LET Z(M)=RU*X(M)+SU*X(NJ)
 910 LET T(M)=RU*Y(M)+SU*Y(NJ)
 920 NEXT M
1000 FOR P=1 TO 4
1010 LET X(P)=Z(P)
1020 LET Y(P)=T(P)
1030 NEXT P
1040 NEXT N
1050 NEXT J
1060 NEXT I
1070 IF INKEY$="" THEN GOTO 1070
1080 STOP

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