Program Improvements

Author(s): Carl Bush; George Milonas; R. B. Mason
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v4 n5 (Volume 4, Issue 5)
Date: May 1983
Pages: 3

Here’s a more efficient way to simulate ON GOTO statements (Feb.83). Look at this short program:

  10 PRINT "WHAT IS YOUR COMMAND(1-4)?"
20 INPUT A
30 ON A GOTO 50, 70, 90, 110
40 GOTO 20
50 PRINT "NORTH"
60 GOTO 20
70 PRINT "SOUTH"
80 GOTO 20
90 PRINT "EAST"
100 GOTO 20
110 PRINT "WEST"
120 GOTO 20

To adapt it, change line 30 to:

  30 GOTO (50 AND A=1)+(70 AND A=2)+(90 AND A=3)+(110 AND A=4)+(40 AND A<1 OR A>4)

This line directs the computer to the designated line numbers when an A value matches. When A does not equal a listed value, the computer goes to line 0. Thus, the last part (40 AND A<1 OR A>4) sends the computer to the next line number.

Carl Bush, Baltimore, MD


Joe Glass noted his program Office Manager (Apr.83) gives an error 5 when you view files. Add:

 500 PRINT AT 21,0;"PRESS ENTER TO CONTINUE"
510 INPUT Z$
520 CLS
530 RETURN
2727 IF PEEK 16442<=5 THEN GOSUB 500
2912 IF PEEK 16442<=5 THEN GOSUB 500

George T. Milonas, Tacoma, WA


In Office Manager, menu choices 3 and 9 incorrectly imply you can alter phone book and report files. The word “ALTER” should read “ADD.”

To alter files, add this line:

2906 PRINT L

When you choose menu item 12 the slot number prints before the line. Then enter in the immediate mode:

LET F$(slot)="altered information"
GOTO 2900

Also, the program cannot reach line 250; it serves no purpose.

R.B. Mason, Arlington, VA

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