Loader

This file is part of Synchro-Sette December 1982 . Download the collection to get this file.
Date: December 1982
Type: Program
Platform(s): TS 1000

This program is a tape menu loader for the December 1982 issue of Synchro-Sette, presenting eight named programs the user can select by pressing a key. The menu displays program titles with corresponding number keys (1–8) and uses inverse-video characters to highlight both the border row and the prompt. Key selection is validated by checking that the character code falls between 28 and 37 (the ZX81’s internal codes for digits 1–9 and 0), then jumps to the appropriate LOAD statement via the computed GO TO at line 90 using 100*VAL A$. Line 900 provides a fallback LOAD “” for unmatched cases. The program switches between FAST and SLOW modes around the display and input loop to balance rendering speed with readable output.


Program Analysis

Program Structure

The program is organized into four logical phases:

  1. Initialization (lines 1–4): A REM statement (likely holding machine code or acting as a header label), switching to FAST mode, executing RAND USR 16514 to call a machine code routine, and POKE 16418,0 to reset the error register.
  2. Menu display (lines 5–13): Draws a border of inverse-space characters, then prints eight program titles with their corresponding key numbers in inverse video.
  3. Input loop (lines 14–90): Alternates between SLOW/FAST, polls INKEY$, validates the keypress, then dispatches via computed GO TO.
  4. LOAD targets (lines 100–900): Each hundred-line boundary holds a LOAD statement for the named program. Line 9998 saves the loader itself; line 9999 auto-reruns it.

Menu Layout

LineTitleKey
6SEASONS GREETINGS1
7MILEAGE2
8CHAINSAW3
9FRENZY4
10INVENTORY5
11SPACE DOCKING6
12QUOTE7
13BULLETIN8

Titles in the LOAD statements (lines 100–800) use the same inverse-character encoding as their display counterparts — letters like %S, %E, %G appear as inverse video in the filename strings, matching what was originally saved to tape.

Key Validation and Computed GO TO

Line 30 reads INKEY$ into A$ without any pause, relying on the GOTO 20 loop at line 40 to spin until a key is pressed. Line 50 checks CODE A$<28 OR CODE A$>37, which corresponds to the ZX81’s internal character codes for the digits 1 through 9 (codes 29–37) and 0 (code 28). Any other key returns to the prompt.

Line 90 uses the idiom GOTO 100*VAL A$: VAL A$ converts the key character to its numeric value (1–8), which is multiplied by 100 to land on lines 100, 200, … 800. VAL "number" in a GO TO is a standard memory-saving technique. Line 900 is reachable only if A$ evaluates to 9 (which cannot occur given the validation at line 50 rejects codes above 37, though code 37 maps to digit 8 — so digit 9 at code 36 would pass but land on line 900’s blank LOAD "").

Machine Code Usage

Line 3 executes RAND USR 16514, calling a Z80 routine at address 16514. This address falls within or just after the system variables area and likely performs display or hardware initialization not easily achievable from BASIC alone. The POKE 16418,0 on line 4 clears the ERR_NR system variable (address 16418), resetting any error state left by the machine code call.

The REM statement at line 1 is a common location for storing machine code on this platform, though here it also appears to serve as a title/version label with block graphic characters.

Display Techniques

The border row at line 5 is constructed from a long string of % (inverse space) pairs filling the 64-character-wide display row at row 22. The program header at row 2 is framed using \: and \ : block graphics (▌ and ▐) to create a bordered title box.

Line 20 double-prints the prompt at row 22: first as plain text \: ENTER ONE OF ABOVE\ : with block-graphic borders, then immediately overlaid with the same text in inverse video (%E%N%T%E%R...). This is an AT-cursor trick — the second PRINT overwrites the first at the same position, achieving an inverse-highlighted prompt without CLS.

The SLOW at line 14 and FAST at line 60 bracket the input wait: the display is rendered in SLOW mode so the screen remains visible, and FAST mode is restored before CLS and LOADing to speed up screen clearing.

Notable Anomalies

  • Line 9999 is RUN with no line number argument, which restarts the program from line 1 — useful if the user wants to re-select after a failed load, but it will also re-execute the machine code call at line 3.
  • The input loop at lines 20–50 does not use PAUSE 0 before reading INKEY$; instead it loops back to line 20, which re-renders the prompt on each iteration. This is slightly less efficient but keeps the prompt visually refreshed.
  • Digit 9 (internal code 36) would pass the validation at line 50 and jump to line 900, which contains LOAD "" — a wildcard load that will accept any program from tape. This may be an intentional escape hatch or an oversight.

Content

Appears On

Cassette to accompany the December 1982 issue of Synchro-Sette.

Related Products

Related Articles

Related Content

Image Gallery

Loader

Source Code

   1 REM Y% \.'\. :%KNOT $TAB \@@RND\: TAB \'.RNDTAN 
   2 FAST 
   3 RAND USR 16514
   4 POKE 16418,0
   5 PRINT AT 22,0;"% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ";AT 2,1;"\: DECEMBER 1982 LOADER PROGRAM\ :"
   6 PRINT AT 5,1;" SEASONS GREETING%S ";TAB 28;"%-% %1"
   7 PRINT AT 7,1;" MILEAG%E ";TAB 28;"%-% %2"
   8 PRINT AT 9,1;" CHAINSA%W ";TAB 28;"%-% %3"
   9 PRINT AT 11,1;" FRENZ%Y ";TAB 28;"%-% %4"
  10 PRINT AT 13,1;" INVENTOR%Y ";TAB 28;"%-% %5"
  11 PRINT AT 15,1;" SPACE DOCKIN%G ";TAB 28;"%-% %6"
  12 PRINT AT 17,1;" QUOT%E ";TAB 28;"%-% %7"
  13 PRINT AT 19,1;" BULLETI%N ";TAB 28;"%-% %8"
  14 SLOW 
  20 PRINT AT 22,6;"\: ENTER ONE OF ABOVE\ :";AT 22,6;"% %E%N%T%E%R% %O%N%E% %O%F% %A%B%O%V%E% "
  30 LET A$=INKEY$
  40 IF A$="" THEN GOTO 20
  50 IF CODE A$<28 OR CODE A$>37 THEN GOTO 20
  60 FAST 
  70 CLS 
  80 SLOW 
  90 GOTO 100*VAL A$
 100 LOAD "SEASONS GREETING%S"
 200 LOAD "MILEAG%E"
 300 LOAD "CHAINSA%W"
 400 LOAD "FRENZ%Y"
 500 LOAD "INVENTOR%Y"
 600 LOAD "SPACE DOCKIN%G"
 700 LOAD "QUOT%E"
 800 LOAD "BULLETI%N"
 900 LOAD ""
\n9998 SAVE "LOADE%R"
\n9999 RUN 

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

People

No people associated with this content.

Scroll to Top