Retrace Your Steps

Developer(s): David Margrave
Date: 1983
Type: Program
Platform(s): ZX81, TS 1000
Tags: Graphics

Move a point from the lower left corner with the 5, 6, 7 and 8 keys, leaving a line behind; every position is stored in two 1000-element arrays. Press R and the screen clears and the drawing is replayed in order, then the program stops. Needs 16K.

RUN in SLOW mode, as the article says. BREAK quits early.

Published in Syntax October 1983 (Retrace Your Steps).

Related Articles

This program lets you draw on your screen using arrow keys and stores your drawing in an array.

Image Gallery

Source Code

  10 CLS
  20 DIM X(1000)
  30 DIM Y(1000)
  40 FOR Z=1 TO 1000
  50 IF INKEY$="5" THEN LET X(Z)=X(Z)-1
  60 IF INKEY$="8" THEN LET X(Z)=X(Z)+1
  70 IF INKEY$="6" THEN LET Y(Z)=Y(Z)-1
  80 IF INKEY$="7" THEN LET Y(Z)=Y(Z)+1
  90 PLOT X(Z),Y(Z)
 100 IF INKEY$="R" THEN GOSUB 5000
 110 LET X(Z+1)=X(Z)
 120 LET Y(Z+1)=Y(Z)
 130 NEXT Z
5000 CLS
5010 FOR Z=1 TO 1000
5020 PLOT X(Z),Y(Z)
5030 NEXT Z
5040 STOP

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