- Copy the
.basfile toexamples/ - Register it in
src/demos.rs(alphabetically in theDEMOSarray) - Document it in
docs/demos.md
The COR24 BASIC interpreter has two execution modes:
- Immediate mode (no line numbers): Lines are executed as they are read.
Examples:
hello.bas,calc.bas. - Stored mode (numbered lines): Lines are stored in memory, then executed
only when a
RUNcommand is issued.ENDandSTOPreturn to immediate mode — they do not halt the interpreter. OnlyBYEexits cleanly.
The web runner feeds source as UART input followed by an EOT byte (0x04).
For stored-mode programs, the runner must detect numbered lines and
automatically append RUN\nBYE\n before the EOT marker. This logic lives in
src/runner.rs Session::new().
When adding a demo:
- If the
.basfile uses line numbers, verify the runner auto-appendsRUN\nBYE\n. - If the file uses
END/STOPinstead ofBYE, ensure the runner handles it —ENDalone will cause the interpreter to block on input forever. - Always test: the program must produce output and stop (status != 0 in the p-code VM).
bash scripts/build-pages.sh
git add examples/ src/ src/ docs/ pages/
git commit -m "add <name> demo"
git pushDo not run trunk directly — always use scripts/build-pages.sh.