Since this is considered on topic, I'll provide the answer generated by Grok:
In the editor, after writing your program, invoke the compiler by typing RUN and pressing ENTER. The compiler processes the code and generates machine code in memory. By default, this code is linked with a small runtime environment that handles I/O and basic operations, making it executable immediately within HiSoft Pascal.
Set Compiler Options for Standalone Output:To make the program standalone, you need to ensure it doesn’t rely on the HiSoft Pascal editor or loader being present. HiSoft Pascal allows some control over this:
- Disable Debugging Checks: Turn off options like integer overflow or array bounds checking (if enabled) to reduce dependencies and size. Use the OPTIONS directive if available in your version (e.g., OPTIONS NOCHECK) before the PROGRAM line.
- Specify Start Address: The compiled code typically starts at a fixed address (often around 32768 or higher, above the HiSoft Pascal system). You can sometimes set this explicitly with a directive like ORG (e.g., ORG 32768), though this depends on the version.
Save the Compiled Machine Code:After compilation, the machine code resides in memory. To save it as a standalone object file:
- Use the SAVE command with a memory range. For example, if your compiled code starts at 32768 and is 1000 bytes long, you’d enter something like:
SAVE "MYPROG" CODE 32768, 1000
Test the Standalone File:Load the saved file back into a fresh Spectrum (without HiSoft Pascal loaded) using:
Then start it with:
(Adjust the address if you used a different ORG.)