This program implements a mailing-label management system, storing up to eight 32-character address records in a DIM’d string array and supporting tape-based save/load, label printing via LPRINT, and machine code routines. The variable `go` holds the address 65535, which is PEEKed to obtain a jump target stored there by the machine code, providing a dynamic GO TO dispatch mechanism. A machine code block is loaded separately as CODE at address 39342 (and a second block at 29000), with its length calculated at save time using `PEEK 65534*256+560`. Line 9910 saves both the BASIC program (auto-running at line 9000) and the companion CODE block, with a rewind-and-verify pass included. Records marked with a block character (█) in position 1 are treated as deleted and suppressed from printing.
Program Structure
The program is organised into several functional blocks separated by REM labels:
- Initialisation (lines 10–20): Clears memory to 29000, dimensions the address array, sets the dispatch variable, and launches a machine code routine before jumping to the address stored at 65535.
- Named subroutine stubs (lines 50–260): Each lettered option (F, Q, B, A, L, S) is reached by the machine code menu dispatcher via
GO TO PEEK go, wherego=65535and the MC writes the target line number low/high bytes into address 65535. - File-name resolver (lines 300–320): Scans a fixed memory region to extract the filename string.
- Loader entry point (lines 9000–9020): Re-initialises the environment after a tape load, checks a flag byte at 23681, and either launches the MC menu or falls through to a
LIST/STOPdiagnostic. - Save routine (lines 9900–9920): Persists both the BASIC program and the companion CODE block, verifies both, and re-runs if the MC is already resident.
Machine Code Integration
Two machine code blocks are used. The first, loaded implicitly as part of the program’s CODE block at address 29000 (10300 bytes), provides the interactive menu and keyboard handler. The second, referenced at address 39342, appears to be a printer driver or label-formatting helper (noted in the REM at line 210 as residing at 64000 or in the printer buffer area).
RANDOMIZE USR 30851at line 20 invokes the main MC menu on first run.RANDOMIZE USR 30140at line 9010 is the post-load entry point, used when the loader detects that flag byte 23681 is non-zero.RANDOMIZE USR 37068at line 250 is called after LPRINT to flush or reset the printer driver.- The MC communicates its chosen menu target back to BASIC by writing a line-number value into address 65535;
GO TO PEEK go(wherego=65535) then dispatches to it.
Dynamic CODE Block Sizing
Line 160 calculates the length of the CODE block for saving with the expression PEEK 65534*256+560. This reads the high byte of a 16-bit value stored at 65534 by the machine code, multiplies by 256, and adds 560 as a base offset, yielding the actual byte count of the MC block at runtime. This avoids hard-coding a length that might change between versions.
Data Model and Deletion Flag
Address records are stored in a$(8,32) — eight fixed-width 32-character slots. A record whose first character is the block graphic █ (CHR$ 143 / char 128+15) is treated as logically deleted: line 220 suppresses it from LPRINT output with IF a$(x,1)<>"█" THEN LPRINT a$(x).
File Name Resolution
The subroutine at lines 300–320 uses an unusual bidirectional scan to locate the filename. It first walks backward from address 39759 to 39750 skipping spaces, then walks forward from 39750 to the final value of x to concatenate characters into n$. This implies the MC places a filename string in a fixed scratchpad region around address 39750–39759.
Notable Idioms and Anomalies
LET go=65535stores the PEEK address in a variable purely for readability and slight tokenisation saving;GO TO PEEK gois used consistently as the MC→BASIC dispatch.- Line 90’s
PAUSE 60: CLEAR 65535: NEWsequence for quitting is clean: it waits about one second, releases all memory, and wipes the program. - Line 9920 checks
PEEK 65535=255beforeRUN; a value of 255 (unwritten RAM) would indicate the MC has not yet written a valid target, making the guard a safety check against spurious jumps. - The
LPRINT ''at line 240 (two consecutive newlines) is used as a configurable label separator with a comment inviting the user to adjust it for their own label stock. - The
FORloop in lines 310–320 uses the same variablexin both loops; the first loop’s terminal value becomes the second loop’s limit, which is valid BASIC but relies on the variable retaining its post-loop value.
Content
Source Code
1 REM MAILING LIST ©1987
10 CLEAR 29000: DIM a$(8,32): LET go=65535
20 INK 0: RANDOMIZE USR 30851: GO TO PEEK go
50 REM F. BREAK PROGRAM
60 GO TO 10000
80 REM Q. QUIT PROGRAM
90 PAUSE 60: CLEAR 65535: NEW
100 REM B. LOAD FILE
110 GO SUB 300: LOAD n$CODE 39342: RUN
150 REM A. SAVE FILE
160 GO SUB 300: SAVE n$CODE 39342,PEEK 65534*256+560: GO SUB 9050: VERIFY n$CODE : RUN
200 REM LPRINT STRING
210 REM Driver at 64000 or Printer Buffer.
215 REM This line may be used to set your printer.
220 FOR x=1 TO 8: IF a$(x,1)<>"█" THEN LPRINT a$(x)
230 NEXT x
240 LPRINT '': REM THIS LINE IS USED TO SEPARATE EACH LABEL (ADJUST FOR YOUR OWN LABELS
250 PRINT #2;: RANDOMIZE USR 37068: GO TO PEEK go
255 REM SAVE PROGRAM
260 GO TO 9900
300 REM FIND FILE NAME
310 LET n$="": FOR x=39759 TO 39750 STEP -1: IF PEEK x=32 THEN NEXT x
320 FOR x=39750 TO x: LET n$=n$+CHR$ PEEK x: NEXT x: RETURN
9000 REM LOADER
9010 INK 7: CLEAR 29000: DIM a$(8,32): LET go=65535: PRINT AT 10,0; INK 0;"STILL LOADING...": LOAD ""CODE : INK 0: IF PEEK 23681<>0 THEN RANDOMIZE USR 30140: GO TO PEEK go
9020 CLS : LIST 9900: STOP
9050 PRINT AT 10,0;" Please Rewind Tape To Verify..."''': INK 7: RETURN
9900 REM SAVE PROGRAM
9910 SAVE "MAILING" LINE 9e3: SAVE "MAILING C"CODE 29000,10300: GO SUB 9050: VERIFY "": VERIFY ""CODE
9920 INK 0: IF PEEK 65535=255 THEN RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

