This program is a menu-driven tape loader for the April 1983 issue of Synchro-Sette, presenting eight programs (Logarithms, Grafit, Guess It, Paint Brush, Measurement Conversion, Torpedo, Baby Syntext, and Bulletin) as a numbered selection screen. The title and menu entry prompt are displayed twice — once in normal video and once overprinted in inverse video — to create a highlighted effect without CLS. Line 5 POKEs address 16418 (the ZX81 FAST/SLOW mode flag or a similar system variable) to 0 as an initialisation step. The input loop at lines 400–430 accepts a single INKEY$ keypress: pressing the key mapped to code 37 triggers a blank LOAD “” (auto-load next tape), while codes 29–36 correspond to digit keys 1–8 to select a specific program. The selected program’s name is extracted from the comma-delimited string A$ by iterating through it and counting commas, then issued directly as a LOAD command with the extracted filename.
Program Analysis
Program Structure
The program divides into four logical phases:
- Initialisation (line 5): A POKE to system variable address 16418 sets it to 0 before anything else runs.
- Menu display (lines 100–330): The title is printed at row 2, then the comma-delimited string
A$is parsed in a nested loop to extract and print each of the eight program names. - Input handling (lines 400–440): A polling loop waits for a valid INKEY$ keypress, distinguishing a “load next” key (code 37) from a digit selection (codes 29–36).
- Program selection and load (lines 450–610): The chosen number is matched against a re-scan of
A$, and the corresponding name substring is passed directly toLOAD.
Data Encoding in A$
All eight program titles are packed into a single comma-delimited string A$ at line 10. Trailing commas act as delimiters and terminators. Several titles contain ZX81 inverse-video escapes (e.g. %S, %T, %H) embedded directly in the string, meaning the displayed menu entries and the LOAD filenames include inverse-video characters. This is the canonical technique for storing a variable-length list in early Sinclair BASIC without arrays.
Menu Rendering Technique
The title banner at line 100 is printed in normal characters first, and the prompt at line 400 is similarly printed normally then immediately overprinted in inverse video at the same AT position (line 400 prints normally, line 400 re-prints with inverse). This creates a highlighted-text effect without needing a separate PRINT statement with a contrasting INK or PAPER attribute.
Each menu entry is printed at AT 3+2*N,5, giving two rows of vertical spacing per entry. A right-aligned hyphen and the entry number are printed with TAB 29;"-";N. Lines 300–310 also print a RAM requirement label (“2K” or “16K”) at column 1, with items 5–8 labelled as 16K programs.
Comma-Parsing Loop
The display loop (lines 200–330) and the selection loop (lines 500–610) both parse A$ by scanning character-by-character for commas. In the display phase, a nested FOR N / FOR I structure counts comma occurrences to segment the string; on finding a comma at position I, it prints A$(A TO I-1) and updates the start pointer A=I+1 via a GOTO 240 back into the outer loop. In the selection phase, a GOSUB 600 is triggered on each comma; the subroutine checks whether the running comma-count B matches the user’s choice VAL B$ and if so executes LOAD A$(A TO N-1).
Input Handling
| Key Code | Action |
|---|---|
| 37 | LOAD "" — load next program from tape blindly |
| 29–36 | Digits 1–8 — select and load named program |
| Anything else | Loop back to line 400 (ignored) |
The loop uses INKEY$ polling without a PAUSE preceding it, so it busy-waits. CODE B$ is used rather than comparing B$ directly to digit characters, which is a minor efficiency on the ZX81 where character codes for digits start at 28 (with code 29 being “1”). The VAL B$ at line 600 converts the single-character key string to its numeric digit value for comparison against the counter B.
Content
Source Code
5 POKE 16418,0
10 LET A$="LOGARITHM%S,GRAFI%T,GUESS IT,PAINT BRUS%H,MEASUREMENT CONVERSIO%N,TORPED%O,BABY SYNTEX%T,BULLETI%N,"
100 PRINT AT 2,3;"% %A%P%R%I%L%/%8%3% %L%O%A%D%E%R% %P%R%O%G%R%A%M% "
110 LET A=1
200 FOR N=1 TO 8
210 FOR I=A TO LEN A$
220 IF A$(I)="," THEN GOTO 300
230 NEXT I
240 NEXT N
250 GOTO 400
300 PRINT AT 3+2*N,5;A$(A TO I-1);TAB 29;"-";N;AT 3+2*N,1;"2K"
310 IF N>4 THEN PRINT AT 3+2*N,1;"16K"
320 LET A=I+1
330 GOTO 240
400 PRINT AT 22,11;"ENTER ONE";AT 22,11;"%E%N%T%E%R% %O%N%E"
410 LET B$=INKEY$
420 IF CODE B$=37 THEN LOAD ""
430 IF CODE B$<29 OR CODE B$>36 THEN GOTO 400
440 LET A=1
450 LET B=1
500 FOR N=A TO LEN A$
510 IF A$(N)="," THEN GOSUB 600
520 NEXT N
530 LET B=B+1
540 LET A=N+1
550 GOTO 500
600 IF B=VAL B$ THEN LOAD A$(A TO N-1)
610 GOTO 530
\n9998 SAVE "LOAD4/8%3"
\n9999 GOTO 1
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
