--- title: "Mailing List" id: 63203 type: "computer_media" slug: "mailing-list" url: "http://localhost/computer_media/mailing-list/" markdown_url: "http://localhost/computer_media/mailing-list.md" published_at: "2026-01-30T21:13:39+00:00" modified_at: "2026-04-03T07:57:57+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/01/mailing-list.png" excerpt: "A tape-based mailing label manager using machine code dispatch, dynamic CODE block sizing, and a block-character deletion flag to suppress records from printing." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Kristian Boisvert" slug: "boisvert-kristian" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-kristian/" genre: - name: "Business" slug: "business" taxonomy: "genre" url: "http://localhost/type/business/" - name: "Database" slug: "database" taxonomy: "genre" url: "http://localhost/type/database/" media_contents: - id: 63048 title: "Byte Power February 1987" type: "computer_media" url: "http://localhost/computer_media/byte-power-february-1987/" media_type: "Program" programmers: - name: "Kristian Boisvert" slug: "boisvert-kristian" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-kristian/" mediadate: "1987" producer_company: - id: 25181 title: "Byte Power" type: "company" url: "http://localhost/company/byte-power/" images: - url: "http://localhost/wp-content/uploads/2026/01/mailing-list.png" - url: "http://localhost/wp-content/uploads/2026/01/mailing-list-2.png" article_media: - id: 63088 title: "Mailing List" type: "article" url: "http://localhost/article/mailing-list-2/" media_type_tags: "Business, Database" --- # Mailing List 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: 1. **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. 2. **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`, where `go=65535` and the MC writes the target line number low/high bytes into address 65535. 3. **File-name resolver (lines 300–320):** Scans a fixed memory region to extract the filename string. 4. **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`/`STOP` diagnostic. 5. **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 30851` at line 20 invokes the main MC menu on first run. - `RANDOMIZE USR 30140` at line 9010 is the post-load entry point, used when the loader detects that flag byte 23681 is non-zero. - `RANDOMIZE USR 37068` at 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` (where `go=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=65535` stores the PEEK address in a variable purely for readability and slight tokenisation saving; `GO TO PEEK go` is used consistently as the MC→BASIC dispatch. - Line 90’s `PAUSE 60: CLEAR 65535: NEW` sequence for quitting is clean: it waits about one second, releases all memory, and wipes the program. - Line 9920 checks `PEEK 65535=255` before `RUN`; 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 `FOR` loop in lines 310–320 uses the same variable `x` in 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. ## 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 ```