Documentation

BBC MICRO · AGENT HANDBOOKALPHA · USE AT YOUR OWN RISK

BBC BASIC and memory

Match the actual language

The BBC Micro's usual BASIC II and the Master's BASIC IV are not ARM/RISC OS BASIC V/VI, BBC BASIC for Windows or SDL BASIC. Do not borrow a keyword merely because an online page says “BBC BASIC”. Check the edition and target.

Loading is not typing

LOAD reads a saved tokenized BASIC program; CHAIN loads and runs it. *EXEC feeds text to the command interpreter as typed input: numbered lines enter a program; they are not automatically a running program.

In this project's BeebAsm disc recipes, use PUTBASIC for numbered BASIC programs and PUTTEXT for a textual !BOOT command file. Inspect and reuse an existing known-good disc recipe rather than inventing a tokenizer/loader. The EGFX basic-program.py selects reachable helpers and writes compact text; PUTBASIC is the subsequent tokenization step. They are different operations.

Account for memory ownership

EGFX BASIC host contract

The EGFX BASIC guide requires MODE 1 then top-level HIMEM=&2400, before any PROC call or allocation; it checks TOP<=&2200. These constraints come from the EGFX profile: check the paired source/API revision.

For the DFS example with PAGE=&1900:

Region Budget / ownership
&1900 to below &2200 2304 bytes maximum program under this contract.
&2200 to below &2400 512 bytes remaining if program uses the maximum; variables, strings, DIM blocks and stack must still fit.
&2400 upward EGFX state, staging and request scratch up to &2BFF; see the EGFX API reference for every region.
&3000..&7FFF 20 KiB MODE 1 screen in the conventional host bitmap layout; Master shadow selection is additional state.

Keep the original library guards. A 3–4 KiB tokenized program starting at &1900 does not fit this program budget. First measure reachable-helper compaction and heap/stack headroom. A larger application needs an explicitly designed, tested layout, supported overlay strategy or selected Tube profile; do not remove guards, invent BASIC V library loading, silently switch target, or change the ROM to hide an application layout error.

Sources and further reading

These are original summaries and links to the sources.