Brandy
A portable BBC BASIC V/VI interpreter in ANSI C — David Daniels' 2000 project to let Acorn RISC OS BASIC programs run unchanged on Linux, Windows, DOS and beyond, now carried on by the Matrix Brandy fork.
Created by David (Dave) Daniels; the actively maintained Matrix Brandy fork is led by Michael McConnell
Brandy is not a new language. It is an act of preservation with a compiler’s discipline: a BBC BASIC V/VI interpreter written from scratch in portable ANSI C, built so that the BASIC Acorn Computers shipped with the Archimedes and RiscPC could keep running after the machines themselves became museum pieces. David Daniels released version 1.00 on 8 November 2000 under the GNU GPL, and its aim was stated plainly in the documentation: write an interpreter compatible with Acorn’s, emulate enough of the RISC OS environment that programs need no changes, and make it behave almost identically on every operating system it is built for.
That is a harder target than it sounds. BBC BASIC V is not a generic BASIC. It has named procedures and functions, LOCAL variables, multi-line IF, WHILE, CASE, REPEAT, an inline ARM assembler, indirection operators for raw memory access, and a graphics and sound model welded to the RISC OS VDU system. Reimplementing it faithfully means reimplementing a good deal of the machine around it — which is why Brandy’s source tree contains files for MOS emulation, VDU handling, Teletext rendering and SYS call dispatch alongside the usual tokeniser, evaluator and heap.
The result is that a BBC BASIC program written for a 1990s Acorn desktop can be loaded on a Linux laptop in 2026 and run, graphics and all.
History and Origins
BBC BASIC began life on the BBC Micro in the early 1980s and was, by the standards of home-computer BASICs, unusually good — structured, fast, and with an assembler built into the language. When Acorn moved to the ARM processor with the Archimedes in 1987, the language moved with it as BASIC V, written in hand-optimised ARM assembler and supplied with RISC OS. BASIC VI was the same language with 64-bit IEEE floating-point arithmetic in place of Acorn’s five-byte format.
By the late 1990s the Acorn desktop line was ending, and a large body of BASIC V code was tied to hardware and an operating system with a shrinking install base. Daniels’ response was to rewrite the interpreter in C rather than emulate the hardware. Brandy 1.00 arrived in November 2000; the source copyright reads “Brandy is copyright (C) 2000-2014 David Daniels.”
Early development was rapid and, notably, collaborative. Versions 1.01 through 1.06 all shipped inside eight weeks of the first release, fixing tokenisation bugs, big-endian and alignment problems, and the kinds of edge cases only a compatibility project generates — DEF PROC1FORa%=1 TO 10 being parsed with FOR swallowed into the procedure name, &FFFFFFFF being stored as &FF, PRINT ""1 producing the wrong spacing. Outside contributors then extended the reach of the project:
- Darren Salt (V1.11, September 2001) added Acorn five-byte float reading, improved eight-byte float handling on platforms with different native formats, gzip file support, and
configure-based installation on Linux. - Crispian Daniels (V1.13, November 2002) contributed a Mac OS target plus new
RNDand graphics code, with Dirk Engling adding FreeBSD in the same release. - Julian Smith and Stefan Haubenthal (V1.16, January 2004) added OpenBSD and Amiga targets.
- Sprow and Mark de Wilde contributed fixes across V1.18–V1.20.
Version 1.20, dated 31 December 2006, made the most consequential internal change of the original line by replacing the obsolete jlib graphics library with SDL. The project was registered on SourceForge in January 2007, and the final release there, 1.20.1, was posted on 23 November 2016.
Then it stopped. In 2018, Michael McConnell forked 1.20.1 and began releasing again as Matrix Brandy — the name adopted at V1.21.4 on 18 July 2018 specifically to distinguish the fork from the SourceForge base and from the other forks that had accumulated. Matrix Brandy is where the language lives today.
Design Philosophy
Compatibility first, everything else second. The documentation is explicit that Brandy is a BASIC interpreter and nothing more: “No attempt has been made to support features of operating systems other than RISC OS, for example, it is not possible to make operating system calls from within a program except under RISC OS.” Rather than exposing the host OS to the BASIC programmer — which would let programs run under Brandy but not under RISC OS — the project emulates the RISC OS side of the boundary and leaves the host invisible. Portability, in this design, means the program is portable, not just the interpreter.
Emulate the environment, not the machine. Brandy is not an Archimedes emulator. There is no ARM CPU simulation of the host BASIC; the interpreter is native C. What it emulates is the API surface a BASIC program sees: the MOS calls, the VDU driver, screen modes, Teletext, and a selected set of RISC OS SYS calls. This is far cheaper than full emulation and delivers native-speed integration with the host filesystem and terminal, at the cost of never being bit-exact with real hardware.
Portable C, honestly scoped. The interpreter is ordinary C with target-specific declarations isolated in target.h, which is how it reached RISC OS, Linux, the BSDs, macOS, Windows, DOS and AmigaOS over the years. The trade-off is stated in the documentation without spin:
The Acorn ARM BASIC interpreter is written in ARM assembler. Brandy is in C and there is therefore no chance that it will come remotely close to the Acorn interpreter in terms of speed. The RISC OS version, for example, runs between two and five times slower when working with integers and is up to twelve times slower when floating point numbers are used extensively.
That comparison is the project’s own, measured on the RISC OS build against Acorn’s assembler interpreter on the same platform, and it is a like-for-like ratio rather than an absolute figure — the documentation immediately adds that “the performance is quite respectable on a faster processor,” which is the real point. A modern machine outruns a RiscPC by so much that a 2–12× interpreter penalty disappears into the gap. Matrix Brandy later clawed back some of that overhead: V1.21.21 (July 2019) moved centisecond-timer polling to its own thread, because checking it on every command iteration to detect ESCAPE had been expensive, and reported execution as “much faster than before, and slightly faster again when ESCAPE is disabled via *FX200.”
Key Features
The full BASIC V/VI language. Structured programming as Acorn shipped it — a long way from GOTO-driven microcomputer BASIC:
| |
REPEAT...UNTIL, WHILE...ENDWHILE, CASE...OF...WHEN...OTHERWISE...ENDCASE, multi-line IF...THEN...ELSE...ENDIF, LOCAL and LOCAL ERROR handling, and libraries loaded with LIBRARY and INSTALL are all present.
64-bit floating point. Brandy has always used 64-bit IEEE doubles rather than Acorn’s five-byte format, which is why V1.22.0 changed its self-identification to BASIC VI in July 2019 — recognising in the version string what the implementation had done since 2000.
Libraries with private state. Version 1.05 (December 2000) added variables private to a library and allowed LIBRARY and INSTALL to take lists — modest module support in a language that had none.
Graphics, screen modes and Teletext. The SDL build provides BBC-style graphics: MODE, GCOL, PLOT, DRAW, MOVE, CIRCLE, FILL, and VDU sequences. Matrix Brandy’s most distinctive addition is a full Mode 7 Teletext implementation with a hand-reconstructed Acorn system font based on RISC OS 3.1, an SAA5050-like teletext font, a character frame buffer, flashing text, concealed characters, double height, and directly addressable teletext screen memory at &FFFF7C00–&FFFF7FFF. Text-only builds are available for headless use.
Networking from BASIC. Added in V1.21.6 (July 2018), with IPv6 in V1.21.8:
| |
BGET# returns -1 when no data is waiting — explicitly not an error, since an interactive viewdata service sends nothing when idle — and -2 once the remote end has closed and the buffer is drained. PRINT# and INPUT# are deliberately unimplemented for sockets, since BBC BASIC’s internal file format is meaningless to a remote host.
Memory-mapped hardware access. The indirection operators (? byte, ! word, $ string) are the BBC BASIC way of touching memory, and Matrix Brandy extends that idiom to the Raspberry Pi: /dev/gpiomem is mmap’d when available, with SYS "RaspberryPi_GPIOInfo" TO present%, gpiomem% reporting whether GPIO is usable and where it sits in Brandy’s address space.
Interpreter conveniences. Command-line options include -size for workspace (16 KB up to roughly 2 GB), -lib to preload libraries, -load, -chain and -quit for scripting, -path for search directories, and -ignore to suppress errors for unsupported features. A shebang line at the top of a program is skipped, so BASIC works as a scripting language on Unix. Since V1.23.2 a configuration file sets defaults.
Evolution
The project falls cleanly into two eras.
| Era | Versions | Dates | Character |
|---|---|---|---|
| David Daniels’ Brandy | 1.00 – 1.20.1 | Nov 2000 – Nov 2016 | Building the interpreter and porting it: new OS targets, float format compatibility, jlib replaced by SDL |
| Matrix Brandy (Michael McConnell) | 1.21.0 – 1.23.6 | Jul 2018 – Oct 2025 | Extending the environment: Teletext, networking, GPIO, performance, packaging |
The first era was about correctness and reach. The second has been about making Brandy a place where new BBC BASIC gets written rather than only old BBC BASIC gets run. Matrix Brandy released twenty-two versions in the twelve months after the fork — V1.21.0 on 1 July 2018 through V1.21.21 on 8 July 2019 — absorbing Banana Brandy — J. G. Harston’s fork — at V1.21.5 in July 2018, and adding Teletext, mouse support, AUTO, *SPOOL, networking, and a long run of BASIC-language fixes. By V1.23.6 in October 2025 it was still adding language features: segment and sector drawing, floating-point MOD and DIV, and BBCSDL-compatible name# floating-point variables.
Other forks exist. Napoleon Brandy, by David Burnard, is a separate SourceForge development of Daniels’ Brandy for Windows and DOS with graphics support; its latest release, 0.00.13, is dated 7 November 2017, and the project describes itself as alpha-stage and functionally incomplete. Matrix Brandy is the one that reached the distributions.
Matrix Brandy’s own documentation describes Linux x86-64, Linux x86-32 and 32-bit ARM Raspberry Pi as fully supported, with Windows (32- and 64-bit) and RISC OS marked experimental and Mac OS X described as highly experimental, and notes that it also builds on OpenBSD and other UNIX-like systems. That is a narrower and more honest claim than the union of everything the original Brandy was ever ported to, and worth respecting: an Amiga or DOS build from the 2000s exists in the archives, but is not what the current project supports.
Current Relevance
Brandy occupies an unusual position: the original is dormant, the language it implements belongs to defunct hardware, and yet the software is in active development and shipping in Debian stable.
- It is in the distributions.
apt install brandygets you a maintained BBC BASIC VI on Debian or Ubuntu, with a manual page and a Salsa-hosted source package. - It is still released. Matrix Brandy 1.23.6 landed in October 2025 with new drawing primitives, six months after 1.23.5 brought GCC 14 static-analysis fixes and window zoom support — this is not archived source.
- It runs on the Raspberry Pi. ARM-32 Pi is a fully supported target with GPIO access, which puts a BBC-lineage BASIC on the machine explicitly designed to revive BBC-Micro-style computing education.
- It anchors a community. Stardot and RISC OS enthusiasts use it as a cross-check on what Acorn’s interpreter actually did, and contribute patches when it disagrees.
What it is not is a general-purpose modern language. There is no package ecosystem, no concurrency model, no FFI beyond the emulated RISC OS SYS interface, and single-file programs with LIBRARY includes are the extent of the module system. Choose Brandy because you want BBC BASIC — for old code, for teaching, for Teletext, or for the pleasure of it — not because you are picking a language for new production work.
Why It Matters
Brandy is a good answer to a question every computing platform eventually faces: what happens to the software when the hardware is gone? The usual answer is emulation — reproduce the machine, run the original binaries, accept the sealed box. Brandy took the other path, reimplementing the language in portable source so the programs become first-class citizens of whatever machine you have now. It reads Acorn-tokenised files, understands Acorn’s five-byte floats, emulates the VDU system, and then integrates with your actual filesystem, terminal and network stack. Old programs run; new ones can do things the Archimedes never could.
It also demonstrates how a compatibility project survives its founder’s departure. Daniels wrote the interpreter over sixteen years and stopped. Because the code was GPL C with a clean target abstraction and thorough documentation — internals notes, a message-by-message error reference, an explicit list of divergences from Acorn’s interpreter — someone else could pick it up in 2018 and be shipping releases within days. The forks (Matrix, Banana, Napoleon) are not fragmentation so much as evidence that the codebase was legible enough to build on, and the largest of them absorbed another rather than competing with it.
Finally, Brandy is a quiet argument on BBC BASIC’s behalf. The dialect is routinely lumped in with the line-numbered BASICs it superseded, but BASIC V had named procedures and functions, local variables, proper loop constructs, a CASE statement, structured error handling, and an inline assembler — in 1987. Running that language on a Raspberry Pi, driving GPIO pins through memory-mapped I/O and talking to a viewdata service over IPv6, makes a case that no amount of nostalgia could: the design has held up.
Sources
- Matrix Brandy BASIC VI — the actively maintained fork, its documentation and changelog
- MatrixBrandy on GitHub — source,
docs/history.txt,docs/ChangeLog,docs/use.txt - Brandy Basic V Interpreter on SourceForge — David Daniels’ original project
- Brandy BASIC at MDFS::Software — archived binaries and fork listing
- Debian package: brandy and the Ubuntu brandy(1) manual page
- Napoleon Brandy Basic V Interpreter on SourceForge
Timeline
Notable Uses & Legacy
Debian and Ubuntu
Brandy is packaged as the brandy binary in Debian and Ubuntu, so installing a BBC BASIC VI interpreter on a mainstream Linux system is a single package-manager command. Debian bullseye carried version 1.20.1, bookworm 1.22.14, and trixie 1.23.5, with the Debian source repository hosted on Salsa. This packaging is the main reason Brandy is the BBC BASIC most Linux users encounter first.
Running Acorn-era BASIC programs on modern hardware
Brandy's stated aim is source-code compatibility with Acorn's BASIC V/VI interpreter, emulating enough of the RISC OS environment that a program runs identically under RISC OS on an Archimedes or RiscPC and under Brandy on Linux or Windows. It reads Acorn-tokenised program files as well as plain text, which makes it a practical tool for opening decades-old BBC Micro and Archimedes listings without an emulator.
Telstar and the viewdata revival
Networking added in Matrix Brandy V1.21.6 opens a TCP connection through OPENUP using an "ip4:host:port" pseudo-filename, with BGET#, GET$#, BPUT# and EOF# operating on the socket. The project ships a client for the Telstar viewdata service as a Mode 7 example, pairing the interpreter's Teletext emulation with live network access — a period-accurate terminal written in BASIC.
Raspberry Pi GPIO programming
Matrix Brandy exposes Raspberry Pi GPIO in a deliberately BBC Micro-flavoured way: if it can open /dev/gpiomem for read-write it memory-maps it, and a SYS "RaspberryPi_GPIOInfo" call reports availability and the base address, with further SYS calls for pin operations. Memory-mapped I/O ports driven from BASIC is exactly how hardware control worked on the BBC Micro, transplanted onto a modern single-board computer.
The Stardot and RISC OS retrocomputing communities
Matrix Brandy's changelog credits patches and bug reports from contributors on the Stardot forums and GitHub, covering nested FOR..NEXT behaviour, plotting accuracy, Teletext edge cases and drawing primitives. The project functions as a shared reference implementation for people who care about precisely how Acorn's BASIC behaved.
Teaching and hobby programming
Both the original SourceForge project and the Debian package position Brandy for education and end users. BBC BASIC's named procedures, functions, local variables and structured control flow make it a far better teaching language than its 1980s reputation suggests, and Brandy delivers that dialect on hardware students actually have.