This program loads and launches a machine code routine that implements bold (double-struck) text printing on the system. The code is stored at address 57786 and occupies 29 bytes, sitting above the RAMTOP set by CLEAR 56575. After loading, execution is transferred to the machine code entry point via RANDOMIZE USR 57786. Lines 35 and 39 provide a simple confirmation message and listing before halting, while line 40 handles saving both the BASIC loader and the machine code block back to tape as a two-file package.
Program Analysis
Program Structure
The program is a classic two-part tape package: a BASIC loader and a companion machine code binary. The BASIC portion handles memory setup, loading, execution handoff, and re-saving, while the actual bold-print functionality resides entirely in the 29-byte machine code block.
10— REM label identifying the program’s purpose.20—CLEAR 56575sets RAMTOP, protecting the machine code area starting at 57786 from being overwritten by BASIC.30— Loads the machine code block to its fixed address, then immediately transfers control viaRANDOMIZE USR 57786, which installs the bold-print patch.35— Prints a confirmation message to indicate successful loading.39—LISTfollowed bySTOPdisplays the program listing and halts, giving the user a clean exit point.40— Saves the BASIC loader (withLINE 20auto-run) and then saves the raw machine code block as a second file, both under the namebold.
Memory Layout
| Address | Purpose |
|---|---|
| 56575 | RAMTOP (set by CLEAR); top of BASIC-accessible RAM |
| 57786 | Entry point and load address of the machine code routine |
| 57786–57814 | 29-byte machine code block (bold-print patch) |
Key BASIC Idioms
CLEARbeforeLOAD ""CODEis the standard idiom for reserving high-memory space for machine code, preventing the BASIC system from encroaching on it.RANDOMIZE USRis the conventional way to call a machine code subroutine from BASIC; the return value is discarded and any non-zero return is absorbed without error.- Placing the
SAVEcommands on line40— beyond theSTOPat line39— means they are only reached if the user explicitly typesGO TO 40orRUN 40, keeping the save step manual and deliberate. SAVE "bold" LINE 20encodes the auto-run line number into the BASIC file header, so the loader restarts automatically from20when loaded.
Machine Code Usage
The 29-byte routine at 57786 is not embedded in the BASIC listing itself (e.g., via REM or DATA); it is stored as a separate CODE file on tape. This keeps the BASIC source clean and the machine code relocatable as a standalone binary. The routine’s job — patching the system to produce bold output — likely works by intercepting or replacing a ROM character-output routine so that each character is printed twice with a one-pixel horizontal offset, a well-known technique for synthesizing bold text without a dedicated font.
Notable Techniques
- The gap between RAMTOP (56575) and the code address (57786) is 1211 bytes, leaving a comfortable buffer that may be intentional to avoid conflicts with system variables or other resident code in that region.
- Combining
LISTandSTOPon a single line (39) is a neat way to present the program to the user immediately after installation while preventing any further automatic execution. - Using a two-file save strategy (BASIC loader + CODE block) under the same filename
boldis standard practice for distributing machine code utilities, making sequential loading straightforward.
Potential Anomalies
There are no obvious bugs. One minor observation: if RANDOMIZE USR 57786 at line 30 returns normally, execution falls through to line 35 as expected. However, if the machine code patch redirects the ROM print routine permanently, subsequent output (including line 35‘s confirmation message) would itself be rendered in bold — which may be intentional as a demonstration of the patch’s effect.
Content
Source Code
10 REM bold print
20 CLEAR 56575
30 LOAD ""CODE : RANDOMIZE USR 57786
35 PRINT "Bold print now loaded"
39 LIST : STOP
40 SAVE "bold" LINE 20: SAVE "bold"CODE 57786,29
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
