This program loads and activates a machine code routine that replaces the normal character output with a bold (heavy) print style on a Sinclair computer. The machine code is stored starting at address 57786 and is invoked via RANDOMIZE USR 57786, a common technique for executing arbitrary machine code from BASIC. The bold effect is toggled by poking address 23607 with either 220 (bold) or 60 (normal), which modifies the system font or print routine behavior. The program saves itself as a BASIC file with an auto-run LINE 20 parameter, and also saves the machine code block (29 bytes starting at 57786) as a separate CODE file named “bold.”
Program Analysis
Program Structure
The program is a loader and installer for a small machine code routine. It follows a straightforward sequence: reserve memory, load the code, activate it, display instructions, then save everything back to tape.
LINE 10— REM label identifying the program’s purpose.LINE 20—CLEAR 56575reserves protected memory above 56575, ensuring the machine code area at 57786 is not overwritten by BASIC.LINE 30— Loads the CODE block from tape and immediately executes it viaRANDOMIZE USR 57786.LINEs 35–39— Print usage instructions to the screen.LINE 40—LISTdisplays the current program in the new bold font as a demonstration, thenSTOPhalts execution.LINE 50— Saves the BASIC program (auto-run from line 20) and the 29-byte machine code block back to tape.
Machine Code Usage
The machine code routine is 29 bytes long, residing at address 57786. It is invoked with RANDOMIZE USR 57786, which calls the routine as a subroutine and discards the return value — a standard idiom for running machine code from BASIC without a separate POKE/CALL mechanism. The routine patches the system to redirect or modify character output so that each character is rendered in a bold style.
Toggle Mechanism via POKE 23607
Address 23607 is a system variable (P-RAMT area or a vector byte used by the ROM print routines). The program documents two values for this address:
| Value | Effect |
|---|---|
220 | Bold (heavy) character output active |
60 | Normal character output restored |
This suggests the machine code installs a patch that reads this byte at print time to decide whether to apply the bold rendering, making the effect reversible without reloading anything.
Memory Layout
The CLEAR 56575 command sets RAMTOP just below the machine code’s load address of 57786, protecting the routine from being overwritten by BASIC’s heap. The gap between 56575 and 57786 is 1210 bytes, which is likely intentional padding or alignment.
Save Strategy
LINE 50 performs two saves in sequence. First, SAVE "bold" LINE 20 saves the BASIC program with an auto-run parameter so it restarts from LINE 20 on load. Second, SAVE "bold"CODE 57786,29 saves exactly 29 bytes of machine code starting at address 57786. When the tape is later loaded, the user must load both the BASIC file and the CODE file (in that order, since LINE 30 issues LOAD ""CODE automatically).
Notable Techniques
- Combining
LOAD ""CODEandRANDOMIZE USRon a single line (LINE 30) using the colon separator allows the machine code to be loaded and immediately executed in one step. - Using
LISTonLINE 40as a live demonstration of the bold font is an elegant self-referential test — the program listing itself becomes the sample output. - The 29-byte footprint of the machine code is notably compact, consistent with a minimal ROM-patching or character-redraw routine.
Potential Anomalies
The CLEAR 56575 value and the machine code address 57786 do not leave the code immediately above RAMTOP; the 1210-byte gap is unusual and may indicate the routine was originally developed for a specific memory configuration or that some of the intervening addresses are used for data by the routine. No bugs are apparent in the BASIC itself.
Content
Source Code
10 REM bold print
20 CLEAR 56575
30 LOAD ""CODE : RANDOMIZE USR 57786
35 PRINT "Bold print now loaded"
37 PRINT "Please use this program for all listings you send to LIST"
38 PRINT "To return to regular printing, just POKE 23607,60"
39 PRINT "To get these heavy characters, Poke 23607,220"
40 LIST : STOP
50 SAVE "bold" LINE 20: SAVE "bold"CODE 57786,29
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
