Jump to content

BBC BASIC

From Alfawiki
Adapted from the English Wikipedia article BBC BASIC, available under CC BY-SA 4.0Updated 9 August 2025
Acorn Computers Ltd
Company typePrivate
IndustryComputer hardware and software
Founded1978
FateDefunct
Headquarters
Cambridge
,
United Kingdom
ProductsBBC Microcomputer, Archimedes computer, BBC BASIC

BBC BASIC is an interpreted variant of the BASIC programming language, originally created by Acorn Computers Ltd following its selection by the BBC for the BBC Literacy Project in 1981.

Initially embedded on ROM within the BBC Microcomputer equipped with a 6502 microprocessor, BBC BASIC later advanced alongside Acorn's Archimedes computer, which utilized their proprietary ARM CPU. Acorn incorporated an integrated assembler, first targeting the 6502 processor and subsequently adapted for the ARM2 chip.

The BBC's initial requirement mandated compatibility with Microsoft BASIC. Building upon their earlier Atom BASIC, Acorn enhanced it by adding structured programming capabilities. With the increased memory resources available on later Archimedes models, BBC BASIC expanded to include a richer array of structured programming constructs akin to those found in the ALGOL 60 language family.

In addition to Acorn's native Archimedes version, third-party vendors developed compiled editions. Following the closure of Acorn Computers Ltd, development and support persisted, enabling BBC BASIC to be accessible on multiple platforms either through emulators such as on MS Windows or as native implementations.

Precursor languages

In 1964 at Dartmouth College, two mathematics professors created Dartmouth BASIC to provide all students with accessible programming capabilities on the college’s computer. Earlier high-level languages like FORTRAN and COBOL were considered too complex for novices. Dartmouth BASIC (Beginner’s All-Purpose Symbolic Instruction Code) featured syntax based on formulas and a simplified structure inspired by FORTRAN.

Throughout the late 1960s and into the 1970s, BASIC became established as the standard language for small computing systems with the rise of microcomputers. The release of the Altair 8800 cemented BASIC’s prevalence, with its first available language being the Altair BASIC developed by Paul Allen and Bill Gates. Most subsequent microcomputers adopted some form of BASIC as their main user interface.

BBC's involvement

During the 1970s, the BBC Continuing Education Department examined how computing technology would influence British society. Their 1979 Microelectronics Report submitted to the Manpower Services Commission raised issues regarding workplace division and employee disengagement.

The BBC aimed to select a microcomputer that could be used for their programming initiatives while also being available commercially for public experimentation. The chosen system needed to be robust, expandable, and feature a BASIC interpreter compatible with Microsoft BASIC VN5.

In partnership with government agencies, the BBC initiated the Computer Literacy Project (1980–1989), which sought to enhance public understanding and education through the use of the BBC Microcomputer manufactured by Acorn Computers Ltd. BBC BASIC was integral to this educational programming environment.

Acorn's involvement

Acorn initially created System BASIC and Atom BASIC for their early computers based on the 6502 microprocessor, which were sold as kits. The Proton model, originally designed as a Front-end processor, was adapted into the standalone BBC Microcomputer to satisfy BBC requirements.

To meet a critical specification, Acorn enabled connectivity with a Z80 processor computer, ensuring compatibility with the CP/M operating system.

Sophie Wilson was responsible for developing Acorn’s BASIC dialects. The version used on the BBC Micro aligned with Microsoft BASIC standards set by the BBC and incorporated structured programming elements inspired by ALGOL 60.

BBC Micro

The initial release of BASIC I was the standard interpreter provided on the earliest BBC Micro models.

Following that, BASIC II was introduced for the Acorn Electron and later BBC Micro units from 1982 onwards (including Model B). This version incorporated commands such as OPENUP and OSCLI, enabled offset assembly programming, and resolved various bugs.

BASIC III was developed with both UK and US markets in mind during Acorn's efforts to penetrate the American market. Its primary distinction was allowing the COLOUR command to be spelled COLOR in the US variant. Additionally, BASIC III served as the foundation for HI-BASIC, designed for use with external second processors.

The CMOS-based BASIC IV, available on BBC Master computers, took advantage of the 65SC12 processor's instruction set to reduce program size and introduce new features like LIST IF, EDIT, TIME$, as well as faster floating-point operations alongside bug corrections.

In 1986, a revised BASIC IV version was included with the Master Compact model, featuring rewritten mathematical routines that improved execution speed by approximately 30% compared to earlier Master series editions.

HI-BASIC existed in two variants derived from BASIC III and BASIC IV, optimized to run from elevated memory locations (&B800) on second processors to maximize available program space. One version was compatible with the Zilog Z80 second processor.

BAS128, distributed with both the BBC Master and Master Compact on tape and disc media, loaded into main RAM utilizing 64 KB of Sideways RAM to accommodate larger programs; however, it operated slower than ROM-based interpreters.

This interpreter supports both traditional BASIC code and embedded 6502 assembly language enclosed within square brackets ([ ]), which increased its utility in industrial automation and scientific research contexts.

Additional information/identifying BASIC version

Since BBC MOS and RISC OS were typically delivered on ROM chips, each operating system release contained a specific edition of BASIC. Determining the exact version involves querying the OS identity and inferring from that information.

On BBC Micro systems, both standard BASIC and enhanced HIBASIC are executable on the 6502 second processor. The initial PAGE setting (&800) signals operation on a second processor; HIMEM differentiates BASIC (&8000) from HIBASIC (&B800).

Likewise, under RISC OS, conventional BASIC ("BASIC V") coexists with BASIC64 ("BASIC VI"), with BASIC64 providing extended precision mathematics. The following code snippet distinguishes between them:

<syntaxhighlight lang="bbcbasic">IF INSTR(REPORT$,"VI") THEN PRINT "BASIC64" ELSE PRINT "BASIC"</syntaxhighlight>

In general, programs should avoid explicitly testing for specific BASIC or platform versions and instead manage returned data dynamically.

Acorn Archimedes (RISC OS)

With the shift to 32-bit ARM processors and elimination of the previous 16 KB code size restriction, BBC BASIC V expanded considerably; for example, version 1.04 reached 61 KB in size. Current RISC OS distributions continue to include BBC BASIC V, whose source code for RISC OS 5 is available under an Apache 2.0 license via RISC OS Open.

Enhancements introduced included:

  • Structured control flow constructs such as WHILE-ENDWHILE, IF-THEN-ELSE-ENDIF, and CASE-OF-WHEN-OTHERWISE-ENDCASE
  • Procedure parameters coupled with RETURN
  • Support for local arrays and modular procedure libraries through commands like LIBRARY, INSTALL, and OVERLAY
  • Localized data storage (LOCAL DATA) and error management (LOCAL ERROR)
  • Relative addressing with RESTORE
  • Advanced array handling capabilities alongside new operators
  • Stepwise debugging via STEP TRACE
  • Commands enabling interaction with sound hardware, mouse input, and graphics

Graphics-related commands retained backward compatibility while sound instructions evolved—such as ENVELOPE, which became a no-operation under RISC OS. The inline 6502 assembler was replaced by an ARM assembler appropriate for the new architecture. Acorn promoted BASIC V as "the fastest interpreted BASIC worldwide" and among the most capable available.

BASIC VI extended numeric support by implementing IEEE 754 standard 8-byte floating-point numbers in contrast to the 5-byte format used in BASIC I.

Both BBC BASIC V and VI were standard components on Acorn Archimedes and RiscPC computers. Additionally, a version of BBC BASIC V operated on the ARM second processor within the BBC Micro environment.

Paul Fellows authored the Archimedes BASIC Compiler (ABC), initially released by DABS Press. This compiler translated nearly all of BBC BASIC V—excluding EVAL expressions—into machine code. Written itself in BBC BASIC V, ABC supported inline assembler syntax and substantially improved application performance, elevating BBC BASIC V’s status as a viable language for professional software development.

Other platforms

BBC BASIC has been adapted for a wide range of systems.

A version compatible with the NS32016 processor was provided alongside the Acorn 32016 coprocessor and the Acorn ABC computer.

In addition to the BBC Micro’s Zilog Z80 second processor variant, there existed a Z80-based iteration of BBC BASIC designed for CP/M operating systems. This Z80 edition was also implemented on devices such as the Tiki 100 desktop, Cambridge Z88 portable computer, and Amstrad NC100/NC200 laptops. Furthermore, it has been ported to TI-83 Plus and TI-84 Plus graphing calculators. Thanks to J. G. Harston—who also developed a PDP-11 version—a ZX Spectrum adaptation was launched in 2002 and continues to receive updates.

For IBM PC-compatible machines, BBC BASIC was available as BBCBASIC (86) for DOS, which prioritized faithful BBC Micro compatibility, and as BBasic, which introduced enhancements to the BASIC language itself.

In 2001, Richard T. Russell (also responsible for the Z80 and x86 versions) released BBC BASIC for Windows. This version supports nearly all features of BASIC IV and much of BASIC V/VI syntax, incorporating advanced capabilities such as record and structure types along with the ability to invoke Windows API calls or external DLL functions. The latest editions offer sophisticated features comparable to those found in C programming, with an external library providing object-oriented support.

Russell additionally created BBC BASIC for SDL, which maintains close compatibility with the Windows variant while adding data structures, PRIVATE variables, event-driven interrupts, enhanced numeric precision, and other improvements. Launched in February 2019 and actively maintained through 2024, it runs on Windows, MacOS, Linux, Raspberry Pi OS, Android, iOS, and any platform supporting SDL. This version enables programs to execute as applets via Web Assembly or to be compiled into standalone executables (.exe, .dmg, .zip, .apk). It preserves strong compatibility with original BBC Micro features such as SOUND and ENVELOPE statements and the MODE 7 teletext display mode. Its integrated assembler automatically adapts to the underlying CPU architecture (x86 or ARM), facilitating advanced application development through direct API access from either BASIC or assembly code.

A GPL-licensed clone known as Brandy, written in portable C, is available; its derivative project Matrix Brandy continues active development.

A BBC Micro emulator for the Amiga created by Ariadne Software delivered high-speed performance but exhibited slower assembly execution due to partial 6502 CPU emulation. Although this limited its suitability for most commercial games, it supported educational titles and was included in an academic Amiga 500 package targeted at schools.

Benjamin Ryves developed a BBC BASIC V (Z80) version specifically for TI-83/84+ calculators.

In the early 1980s, Aztec Software produced a Commodore 64 adaptation named Shado. There have also been experimental patched versions of Acorn’s 6502-based HI-BASIC running on the C64 through kernel interface modifications.

There are ongoing initiatives aiming to bring a 6502-based BBC BASIC environment to Apple II computers; one example is the Applecorn project.

BBC BASIC serves as the programming language for the Agon Light—an open-source 8-bit Z80 single-board computer and microcontroller created by Bernardo Kastrup and launched in 2022.