Improving Display

Author(s): Will Hiatt
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v2 n8 (Volume 2, Issue 8)
Date: August 1981
Pages: 10-11

One problem with creating graphic displays on the ZX80 is users’ inability to interact with display. This program allows you to manipulate a cursor on 14 screen lines and to insert characters where desired.

The program operates in two modes, each identified by the type of cursor displayed. The asterisk cursor indicates direction mode and will accept the following commands:

R= cursor right     U= cursor up
L= cursor left      D= cursor down
I= to insert mode   S= stop program
(NL)= repeat last instruction

A question mark replaces the asterisk as cursor to indicate that the program has entered insert mode. During insert mode, the cursor continues to move in the last direction entered in direction mode. The command ND (for new direction) shifts control from insert back to direction mode. (NL) repeats insertion of the last character chosen and moves the cursor to the next position. Any other input is inserted as a character at the cursor position.

Insert mode input can be character codes (see p.75 of your ZX80 manual) or single-character keyboard symbols, except those identified as not available (p. 117 of your manual — these cause interesting crashes).

You can move the asterisk cursor beyond the side edges of the display to alter characters in the end horizontal positions (columns 1 and 32). If you move past the top or bottom rows, however, you will disrupt the display, but the computer will still accept the R command. When the ZX80 recovers, you can use the top row.

Once you’ve entered the program, type RUN (NL). A screen full of colons will appear; the cursor will not be visible until after you enter a direction command (R,L,U, or D). If you want to modify the initial backgound, change the 14 in line 150 to the new symbol’s character code.

This program runs in 1K RAM; if you have more memory, you can expand display space by increasing the second value of the loop on line 100. Some alterations of the program may affect the initial POKE of the cursor, so check line 140.

 100 FOR X=1 TO 448
110 PRINT ":";
120 NEXT X
130 LET N=20
140 LET Q=17083
150 LET C1=14
160 INPUT A$
170 LET X=CODE(A$)
180 LET A$=TL$(A$)
190 LET Y=CODE(A$)
200 LET Z=CODE(TL$(A$))
210 LET F=0
220 IF N=20 THEN LET C=C1
230 IF X=1 THEN GO TO 330
240 IF N=20 THEN GO TO 300
250 IF Y=41 THEN GO TO 420
260 LET C=X*100+Y*10+Z-3108
270 IF NOT Y=1 THEN LET F=2
280 IF Y=1 THEN LET C=X
290 GO TO 330
300 IF X=46 THEN GO TO 450
310 IF X=56 THEN STOP
320 LET D=X
330 IF D=55 THEN LET P=Q+1
340 IF D=49 THEN LET P=Q-1
350 IF D=58 THEN LET P=Q-33
360 IF D=41 THEN LET P=Q+33
370 POKE Q+F,C
380 LET C1=PEEK(P+F)
390 POKE P+F,N
400 LET Q=P
410 GO TO 160
420 LET N=20
430 LET F=1
440 GO TO 390
450 LET N=15
460 GO TO 390
Syntactic Sum: -20876, 4K

(NOTE: This program won’t run with Syntactic Sum LOADed.–SB)


In 8K, use A$(2 TO)(shift 4) to replace TL$(A$). This saves 3 bytes, says John Sampson of NY.

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