This program is a loader for the “BROADWAY” font. It first clears memory down to address 64598, then uses POKEs to set the system variable RASP/BEEP (bytes at 23606–23607) to point to address 64088 (251×256+88), which configures a system pointer — specifically the CHARS system variable, used to repoint the character set. The machine code block is stored at 64599 and is 760 bytes long, fitting within the high memory region protected by the CLEAR command. The SAVE line on line 50 saves both the BASIC loader (with auto-run at line 1) and the accompanying CODE block in a single operation.
Program Analysis
Program Structure
The program is a two-phase loader: lines 10–45 form the runtime bootstrap that prepares memory and loads the machine code, while line 50 is a save/distribution utility that writes both the BASIC and CODE portions back to tape.
LINE 10—CLEAR 64598: Sets RAMTOP to 64598, reserving high memory from 64599 upward for the machine code block and preventing BASIC from overwriting it.LINE 20–30— POKEs to system variables 23606 and 23607.LINE 40—LOAD ""CODE: Loads the machine code block from tape to its saved address (64599).LINE 45—STOP: Halts execution; the machine code is expected to be entered separately (e.g., viaRANDOMIZE USR) or is auto-started by the CODE block itself.LINE 50— CombinedSAVEstatement for mastering the tape.
System Variable Manipulation (Lines 20–30)
Addresses 23606 and 23607 are the two-byte system variable CHARS, which holds a pointer to the character set base (offset by −256 from the first printable character). Poking 88 into 23606 (low byte) and 251 into 23607 (high byte) sets CHARS to 64344 (251×256+88). This redirects the ROM character lookup to a custom character set located within or near the machine code block at 64599, enabling the program to display custom fonts or graphics characters without patching the ROM.
| Address | System Variable | Value Poked | Effect |
|---|---|---|---|
| 23606 | CHARS (low) | 88 | Low byte of new character set pointer |
| 23607 | CHARS (high) | 251 | High byte → combined pointer = 64344 |
Memory Layout
The CLEAR 64598 command places RAMTOP at 64598, so the machine code occupies 64599 through 65358 (760 bytes). This is near the top of the 64 KB address space, a common placement strategy to keep machine code well clear of the BASIC program area and the UDG/stack region.
Save Line Technique
Line 50 chains two SAVE commands on a single line. The first, SAVE "BROADWAY" LINE 1, saves the BASIC program with auto-run at line 1. The second, SAVE "BROADWAY"CODE 64599,760, immediately saves the machine code block starting at 64599 for a length of 760 bytes. This produces a two-block tape image under the same name, which the loader on lines 10–40 is designed to load in sequence.
Notable Techniques
- Placing the
STOPon line 45 rather than after line 50 ensures the save utility line is never accidentally executed during normal loading. - Using
CLEARto set RAMTOP beforeLOAD ""CODEmeans the code address is protected even if the loader is restarted. - The custom
CHARSpointer (64344) points 255 bytes before the start of the code block at 64599, suggesting a 256-byte custom character set is embedded at the very beginning of the machine code.
Potential Anomalies
The STOP at line 45 will prevent any inline auto-execution of the machine code after loading. The machine code block would need to include its own startup mechanism (such as a JP instruction at a known entry point triggered externally, or the BASIC line 1 auto-run would need to include a RANDOMIZE USR call) — but no such call appears in this listing, suggesting the displayed BASIC is incomplete or the machine code self-installs an interrupt or replaces a system vector during load.
Content
Source Code
10 CLEAR 64598
20 POKE 23606,88
30 POKE 23607,251
40 LOAD ""CODE
45 STOP
50 SAVE "BROADWAY" LINE 1: SAVE "BROADWAY"CODE 64599,760
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
