Moire

Developer(s): Roger Valentine
Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Graphics

Moire is a short graphics demo that fills the screen with moiré interference patterns. It sweeps pairs of straight lines corner to corner across the full 256 by 176 display, one pixel step at a time, in four passes per cycle. Because the lines are drawn with OVER 1, each pass partly erases what the earlier ones left, and the overlapping lines produce shifting curved bands. Every cycle switches to a new random ink colour on a black screen, and it runs until BREAK is pressed.

From page 73, where it is listed as “Patterns 2” of Roger Valentine’s The Timex Sinclair 2068.

No author is named in the program. It is a different program from Moire Patterns.

Program Analysis

Program Structure

Line 5 sets OVER 1 and a black border and paper. The subroutine at line 100 draws, for each X from 0 to 255, a line from the bottom edge to the top-right corner and its mirror image from the top edge to the bottom-left corner. The subroutine at line 200 does the same between the top and bottom edges in the opposite diagonal. Line 25 runs them in the order 200, 100, 100, 200 for each colour.

Notable Techniques

  • Exclusive-OR plotting (OVER 1) means a line drawn twice disappears, so repeated passes build and dissolve the pattern instead of simply filling the screen.
  • Line 20 picks a random ink from 1 to 7 and loops until it differs from the previous one, held in A, so each cycle visibly changes colour.

Potential Issues

  • Colour is set per character cell, so wherever a new line passes, the whole cell takes the new ink, including older pixels in it. This is part of the effect rather than a bug.

This copy came from one of Don Lambert’s Oliger (JLO SAFE) disks. The only change for tape was removing the Oliger “/” from the SAVE at line 9000 and setting the program to autorun. It was tested in ZEsarUX on an emulated TS2068.

Image Gallery

Source Code

    5 OVER 1: BORDER 0: PAPER 0: INK 2: CLS 
   10 GO SUB 100
   15 LET A=2
   20 LET I=INT (RND*7)+1: IF I=A THEN GO TO 20
   25 INK I: LET A=I: GO SUB 200: GO SUB 100: GO SUB 100: GO SUB 200: GO TO 20
  100 FOR X=0 TO 255
  105 PLOT X,0: DRAW 255-X,175: PLOT 255-X,175: DRAW X-255,-175
  110 NEXT X
  115 RETURN 
  200 FOR X=0 TO 255
  205 PLOT X,175: DRAW 255-X,-175: PLOT 255-X,0: DRAW X-255,175
  210 NEXT X
  215 RETURN 
 9000 SAVE "MOIRE"

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