BBC BASIC: Difference between revisions
imported>Maury Markowitz →BBC's involvement: the report in question does not appear to say anything about Modern Times, and that passage appears to be editorializing |
Undid revision 1036160980 by Matthiaspaul (talk) |
||
| Line 4: | Line 4: | ||
{{Infobox programming language | {{Infobox programming language | ||
| name = | | name = | ||
| logo = <!-- (filename) --> | | logo = <!-- (filename) --> | ||
| logo caption = | | logo caption = | ||
| Line 39: | Line 39: | ||
'''BBC BASIC''' is an [[Interpreted Language|interpreted]] version of the [[BASIC]] programming language. It was developed by [[Acorn Computers Ltd]] when they were selected by the [[BBC]] to supply the computer for their [[BBC Literacy Project]] in 1981. | '''BBC BASIC''' is an [[Interpreted Language|interpreted]] version of the [[BASIC]] programming language. It was developed by [[Acorn Computers Ltd]] when they were selected by the [[BBC]] to supply the computer for their [[BBC Literacy Project]] in 1981. | ||
It was originally supplied on an installed [[ROM]] for the [[BBC Microcomputer]] which used a [[6502 microprocessor]]. When Acorn produced the [[Acorn Archimedes|Archimedes]] computer which used their [[ARM architecture family|ARM]] processor, further versions of BBC BASIC were produced. Acorn included a built in [[ | It was originally supplied on an installed [[ROM]] for the [[BBC Microcomputer]] which used a [[6502 microprocessor]]. When Acorn produced the [[Acorn Archimedes|Archimedes]] computer which used their [[ARM architecture family|ARM]] processor, further versions of BBC BASIC were produced. Acorn included a built in [[assembly language|assembler]], first for the 6502 and later for the [[ARM2]] processor. | ||
Initially the BBC specified compatibility with [[Microsoft BASIC]]. Acorn were already extending their earlier [[Atom BASIC]] to include [[structured programming]] constructs. Particularly on the later Archimedes computers as the memory constraints reduced, BBC BASIC incorporated a more complete set of structured programming constructs commonly found in the [[ALGOL 60]] group of computer languages. | Initially the BBC specified compatibility with [[Microsoft BASIC]]. Acorn were already extending their earlier [[Atom BASIC]] to include [[structured programming]] constructs. Particularly on the later Archimedes computers as the memory constraints reduced, BBC BASIC incorporated a more complete set of structured programming constructs commonly found in the [[ALGOL 60]] group of computer languages. | ||
Alongside Acorn's version of BBC BASIC on the Archimedes, third party companies produced [[compiled]] versions of the language. Development and support has continued after the demise of Acorn Computers Ltd for newer ARM based computers. BBC BASIC is now available on other platforms either for [[emulators]] such as on [[ | Alongside Acorn's version of BBC BASIC on the Archimedes, third party companies produced [[compiled]] versions of the language. Development and support has continued after the demise of Acorn Computers Ltd for newer ARM based computers. BBC BASIC is now available on other platforms either for [[emulators]] such as on [[Microsoft Windows]] or natively. | ||
==History== | ==History== | ||
===Precursor languages=== | ===Precursor languages=== | ||
At [[Dartmouth College]], two mathematics professors<ref>{{cite web |title=Event History |url=https://www.dartmouth.edu/basicfifty/events.html |publisher=Dartmouth College |access-date=7 January 2024}}</ref> wanted all students to be able to program on their new college computer. The existing high-level languages, like [[FORTRAN]] and [[COBOL]], were used by professionals and not really suitable for introductory programming by non-technical users. In 1964, they created [[Dartmouth BASIC]]<ref>{{cite web |title=Dartmouth College BASIC Instruction Manual |url=https://www.dartmouth.edu/basicfifty/basicmanual_1964.pdf |publisher=Dartmouth College |access-date=7 January 2024}}</ref> (short for ''' | At [[Dartmouth College]], two mathematics professors<ref>{{cite web |title=Event History |url=https://www.dartmouth.edu/basicfifty/events.html |publisher=Dartmouth College |access-date=7 January 2024}}</ref> wanted all students to be able to program on their new college computer. The existing high-level languages, like [[FORTRAN]] and [[COBOL]], were used by professionals and not really suitable for introductory programming by non-technical users. In 1964, they created [[Dartmouth BASIC]]<ref>{{cite web |title=Dartmouth College BASIC Instruction Manual |url=https://www.dartmouth.edu/basicfifty/basicmanual_1964.pdf |publisher=Dartmouth College |access-date=7 January 2024}}</ref> (short for ''Beginner's All-Purpose Symbolic Instruction Code'') to be a computer language anyone could use. Having a formula-based [[syntactic]] structure, it is a simplified FORTRAN.<ref name=personal/> | ||
A combination of factors led to BASIC becoming a major language in the late 1960s, and in the 1970s when the first [[microcomputer]]s were being built, it was already the ''de facto'' standard for small systems. The introduction of the [[Altair 8800]] cemented the position of BASIC as the first programming language introduced for the platform was [[Paul Allen]] and [[Bill Gates]]' [[Altair BASIC]]. As new micros were introduced, almost all of them ran some variation of BASIC as its primary interface.<ref name=personal>{{cite web |last1=McCracken |first1=Harry |title=Fifty years of BASIC, the programming language that made computers personal |url=https://time.com/69316/basic/ |access-date=7 January 2024 |date=29 April 2014}}</ref> | A combination of factors led to BASIC becoming a major language in the late 1960s, and in the 1970s when the first [[microcomputer]]s were being built, it was already the ''de facto'' standard for small systems. The introduction of the [[Altair 8800]] cemented the position of BASIC as the first programming language introduced for the platform was [[Paul Allen]] and [[Bill Gates]]' [[Altair BASIC]]. As new micros were introduced, almost all of them ran some variation of BASIC as its primary interface.<ref name=personal>{{cite web |last1=McCracken |first1=Harry |title=Fifty years of BASIC, the programming language that made computers personal |url=https://time.com/69316/basic/ |access-date=7 January 2024 |date=29 April 2014}}</ref> | ||
===BBC's involvement=== | ===BBC's involvement=== | ||
During the 1970s, the BBC Continuing Education Department was considering how advancements in computer related technology would impact British society. Their Microelectronics Report<ref name="Microelectronics_Report">{{cite web |title=Microelectronics Report |url=https://clp.bbcrewind.co.uk/media/BBC-Microelectronic-government-submission.pdf |publisher=BBC Continuing Education Department |access-date=14 January 2024}}</ref> in 1979 to the [[Manpower Services Commission]] describes formally their concerns about increasing polarisation and alienation in the workplace. | During the 1970s, the BBC Continuing Education Department was considering how advancements in computer related technology would impact British society. Their Microelectronics Report<ref name="Microelectronics_Report">{{cite web |title=Microelectronics Report |url=https://clp.bbcrewind.co.uk/media/BBC-Microelectronic-government-submission.pdf |publisher=BBC Continuing Education Department |access-date=14 January 2024}}</ref> in 1979 to the [[Manpower Services Commission]] describes formally their concerns about increasing polarisation and alienation in the workplace. | ||
The BBC required a [[microcomputer]] usable for demonstrations in their programming that could be purchased by the general public to enable the viewer to themselves experiment. They decided that such a microcomputer needed to be robust, have expansion capabilities and an implementation of BASIC compatible with [[BASIC A|Microsoft BASIC VN5]].<ref name="BBC_Microcomputer_Spec">{{cite web |title=BBC Microcomputer Specification |url= | The BBC required a [[microcomputer]] usable for demonstrations in their programming that could be purchased by the general public to enable the viewer to themselves experiment. They decided that such a microcomputer needed to be robust, have expansion capabilities and an implementation of BASIC compatible with [[BASIC A|Microsoft BASIC VN5]].<ref name="BBC_Microcomputer_Spec">{{cite web |title=BBC Microcomputer Specification |url=https://www.bbcbasic.co.uk/bbcbasic/beebspec.html |publisher=BBC |access-date=14 January 2024}}</ref> | ||
Jointly the government and the BBC established a public awareness and education campaign. This Computer Literacy Project (1980-1989)<ref name="Computer_Literacy_Project">{{cite web |title=Computer Literacy Project |url=https://clp.bbcrewind.co.uk/history |publisher=BBC |access-date=14 January 2024}}</ref> used the BBC's choice of the [[BBC Microcomputer]] produced by [[Acorn Computers Ltd]]. BBC BASIC was central to the user programming experience. | Jointly the government and the BBC established a public awareness and education campaign. This Computer Literacy Project (1980-1989)<ref name="Computer_Literacy_Project">{{cite web |title=Computer Literacy Project |url=https://clp.bbcrewind.co.uk/history |publisher=BBC |access-date=14 January 2024}}</ref> used the BBC's choice of the [[BBC Microcomputer]] produced by [[Acorn Computers Ltd]]. BBC BASIC was central to the user programming experience. | ||
===Acorn's involvement=== | ===Acorn's involvement=== | ||
Acorn first developed System BASIC and [[Atom BASIC]] for their early [[6502]] microprocessor computers<ref>{{cite web |author1=Ian Sinclair |title=Atomic Research |url=https://www.flaxcottage.com/ComputingToday/8104.pdf |publisher=Computing Today |access-date=21 January 2024 |pages=21–24 |date=April 1981}}</ref> that were sold to kit-build customers. With the development of the Proton as a [[ | Acorn first developed System BASIC and [[Atom BASIC]] for their early [[6502]] microprocessor computers<ref>{{cite web |author1=Ian Sinclair |title=Atomic Research |url=https://www.flaxcottage.com/ComputingToday/8104.pdf |publisher=Computing Today |access-date=21 January 2024 |pages=21–24 |date=April 1981}}</ref> that were sold to kit-build customers. With the development of the Proton as a [[front-end processor]], Acorn were designing for more powerful computing. | ||
In order to produce a computer to satisfy the BBC specification, the Proton became the BBC Microcomputer, usable as a stand alone computer. By retaining the capability to be connected to a [[Z80]] computer, Acorn was able to comply with the requirement of a computer supporting [[CP/M]].<ref>{{cite web |title=BBC Micro ignites memories of revolution |url= | In order to produce a computer to satisfy the BBC specification, the Proton became the BBC Microcomputer, usable as a stand alone computer. By retaining the capability to be connected to a [[Z80]] computer, Acorn was able to comply with the requirement of a computer supporting [[CP/M]].<ref>{{cite web |title=BBC Micro ignites memories of revolution |url=https://news.bbc.co.uk/2/hi/technology/7307636.stm |publisher=BBC News |access-date=21 January 2024 |date=21 March 2008}}</ref> | ||
[[Sophie Wilson]] developed the implementations of BASIC at Acorn.<ref name=" | [[Sophie Wilson]] developed the implementations of BASIC at Acorn.<ref name="Purdy-2023">{{Cite web |last=Purdy |first=Kevin |date=2023-11-29 |title=BBC BASIC remains a remarkable learning tool, and now it's available everywhere |url=https://arstechnica.com/gadgets/2023/11/bbc-basic-keeps-evolving-and-now-you-can-run-it-on-nearly-any-platform/ |access-date=2024-08-05 |website=Ars Technica |language=en-us}}</ref> The dialect on the BBC Microcomputer became compatible with Microsoft BASIC and so was acceptable to the BBC. It already had features from the ALGOL 60 group of computer languages that Wilson added to enable some structured programming methodology to be used. | ||
==Platforms and versions== | ==Platforms and versions== | ||
| Line 71: | Line 70: | ||
{{Main|BBC Micro}} | {{Main|BBC Micro}} | ||
[[File:Hard reset BBC Micro 32K Acorn DFS.gif|thumb|BASIC prompt on the BBC Micro after switch-on or hard reset]] | [[File:Hard reset BBC Micro 32K Acorn DFS.gif|thumb|BASIC prompt on the BBC Micro after switch-on or hard reset]] | ||
The full version list is available here:<ref>[ | The full version list is available here:<ref>[https://mdfs.net/Software/BBCBasic/Versions BBC BASIC version list]</ref> | ||
BASIC I, the original version, was shipped on early [[BBC Micro]]s. | BASIC I, the original version, was shipped on early [[BBC Micro]]s. | ||
| Line 87: | Line 86: | ||
Another version of BBC BASIC, called BAS128, was supplied on tape and disc with the BBC Master and Master Compact; it loaded into main RAM and used the 64 KB of Sideways RAM for user programs. This provided support for much larger programs at the cost of being a lot slower than the normal ROM-based version. | Another version of BBC BASIC, called BAS128, was supplied on tape and disc with the BBC Master and Master Compact; it loaded into main RAM and used the 64 KB of Sideways RAM for user programs. This provided support for much larger programs at the cost of being a lot slower than the normal ROM-based version. | ||
The interpreter can deal with both BASIC and 6502 assembly language, which can be included between the [ and ] characters. This contributed to the system's popularity with industrial and research engineers.<ref name="edn marsh 2005">{{cite news | url= | The interpreter can deal with both BASIC and 6502 assembly language, which can be included between the [ and ] characters. This contributed to the system's popularity with industrial and research engineers.<ref name="edn marsh 2005">{{cite news | url=https://www.edn.com/design/integrated-circuit-design/4325360/FROM-EDN-EUROPE-ARM-targets-automotive-and-industrial-dominance | title=ARM targets automotive and industrial dominance | work=EDN Europe | date=5 December 2005 | access-date=1 August 2012 | author=Marsh, David}}</ref> | ||
====Further details/determining BASIC version==== | ====Further details/determining BASIC version==== | ||
| Line 96: | Line 95: | ||
|1=Note that all Electrons, and later BBC microcomputers, have BASIC2: the earlier BBC microcomputers have BASIC1. If you are not sure which version of BASIC is in your machine, typing REPORT after BASIC has started up (after a BREAK or *BASIC), will print the copyright message. If the date is 1981, BASIC1 is fitted; if it is 1982, you have BASIC2. American machines, or those with a second processor, may have US BASIC or HIBASIC: the ROM routines will not be in the same place for these ROMS.}} | |1=Note that all Electrons, and later BBC microcomputers, have BASIC2: the earlier BBC microcomputers have BASIC1. If you are not sure which version of BASIC is in your machine, typing REPORT after BASIC has started up (after a BREAK or *BASIC), will print the copyright message. If the date is 1981, BASIC1 is fitted; if it is 1982, you have BASIC2. American machines, or those with a second processor, may have US BASIC or HIBASIC: the ROM routines will not be in the same place for these ROMS.}} | ||
See also [ | See also [https://beebwiki.mdfs.net/INKEY#Check_machine_type BeebWiki] entry for INKEY. | ||
On the BBC family, it is possible to run both the standard BASIC ''and'' an enhanced HIBASIC on the 6502 second processor. One may determine if the program is running on the second processor by examining the initial value of PAGE, it will be &800 if using the second processor. To distinguish between BASIC and HIBASIC, one should examine the initial value of HIMEM. This will be &8000 for BASIC running on the second processor, and &B800 for HIBASIC on the second processor. | On the BBC family, it is possible to run both the standard BASIC ''and'' an enhanced HIBASIC on the 6502 second processor. One may determine if the program is running on the second processor by examining the initial value of PAGE, it will be &800 if using the second processor. To distinguish between BASIC and HIBASIC, one should examine the initial value of HIMEM. This will be &8000 for BASIC running on the second processor, and &B800 for HIBASIC on the second processor. | ||
| Line 104: | Line 103: | ||
<syntaxhighlight lang="bbcbasic">IF INSTR(REPORT$,"VI") THEN PRINT "BASIC64" ELSE PRINT "BASIC"</syntaxhighlight> | <syntaxhighlight lang="bbcbasic">IF INSTR(REPORT$,"VI") THEN PRINT "BASIC64" ELSE PRINT "BASIC"</syntaxhighlight> | ||
There are better ways of doing this.{{according to whom|date=November 2023}} See the [ | There are better ways of doing this.{{according to whom|date=November 2023}} See the [https://beebwiki.mdfs.net/What_BASIC_is_running BeebWiki]. In almost all cases you shouldn't need to be testing for what BASIC or platform your program is running on, just make the call and read whatever returned data are returned and deal with it.{{Original research inline|date=November 2023}} | ||
===Acorn Archimedes (RISC OS)=== | ===Acorn Archimedes (RISC OS)=== | ||
{{Main|RISC OS}} | {{Main|RISC OS}} | ||
With the move to the 32-bit [[ARM architecture|ARM]] CPU and the removal of the 16 KB limit on the BASIC code size many new features were added.<ref> | With the move to the 32-bit [[ARM architecture family|ARM]] CPU and the removal of the 16 KB limit on the BASIC code size many new features were added.<ref> | ||
{{Cite newsgroup | {{Cite newsgroup | ||
| title=BASIC V 1.02 versus 1.04 changes (for Richard LLoyd!) | | title=BASIC V 1.02 versus 1.04 changes (for Richard LLoyd!) | ||
| Line 134: | Line 133: | ||
* Commands for the new sound system, mouse, graphics. | * Commands for the new sound system, mouse, graphics. | ||
The graphics commands were entirely [[backwards compatible]], the sound less so; for example, the <code>ENVELOPE</code> keyword from BASIC V onwards is a command that takes fourteen numeric parameters and effectively does nothing— as in older versions, it calls OS_Word 8, but that does nothing on RISC OS.<ref>{{Cite web | url= | The graphics commands were entirely [[backwards compatible]], the sound less so; for example, the <code>ENVELOPE</code> keyword from BASIC V onwards is a command that takes fourteen numeric parameters and effectively does nothing— as in older versions, it calls OS_Word 8, but that does nothing on RISC OS.<ref>{{Cite web | url=https://mdfs.net/Archive/BBCMicro/2006/11/19/185014.htm | title=Subject: Envelope command in Basic V }}</ref> The in-line 6502 assembler was replaced by an [[ARM architecture|ARM]] assembler. BASIC V was said, by Acorn, to be "certainly the fastest interpreted BASIC in the world" and "probably the most powerful BASIC found on any computer". | ||
BASIC VI is a version of BASIC V that supports [[IEEE 754]] 8-byte format real numbers, as opposed to the standard 5-byte format introduced in BASIC I. | BASIC VI is a version of BASIC V that supports [[IEEE 754]] 8-byte format real numbers, as opposed to the standard 5-byte format introduced in BASIC I. | ||
| Line 140: | Line 139: | ||
BBC BASIC V and VI were delivered as standard on the [[Acorn Archimedes]] and the [[RiscPC]]. A version of BBC BASIC V was also available to run on the [[Tube (BBC Micro)|ARM second processor]] for the BBC Micro. | BBC BASIC V and VI were delivered as standard on the [[Acorn Archimedes]] and the [[RiscPC]]. A version of BBC BASIC V was also available to run on the [[Tube (BBC Micro)|ARM second processor]] for the BBC Micro. | ||
A compiler for BBC BASIC V was produced by Paul Fellows, team leader of the Arthur OS development, called the Archimedes BASIC Compiler and published initially by DABS Press.{{ | A compiler for BBC BASIC V was produced by Paul Fellows, team leader of the Arthur OS development, called the Archimedes BASIC Compiler and published initially by DABS Press.<ref>{{Cite web |title=ABC - Archimedes BASIC Compiler - Software - Computing History |url=https://www.computinghistory.org.uk/det/47360/ABC-Archimedes-BASIC-Compiler/ |access-date=2025-11-09 |website=www.computinghistory.org.uk}}</ref> ABC was able to implement almost all of the language, with the obvious exception of the EVAL function, which inevitably required run-time programmatic interpretation. As evidence of its completeness, it was able to support inline assembler syntax. The compiler was written in BBC BASIC V. Many applications initially written to run under the interpreter benefitted from the performance boost that this gave, putting BBC BASIC V on a par with other languages for serious application development. | ||
===Other platforms=== | ===Other platforms=== | ||
BBC BASIC has also been ported to many other platforms.<ref>[ | BBC BASIC has also been ported to many other platforms.<ref>[https://mdfs.net/bbcbasic/ BBC BASIC - MDFS::Software.$.BBCBasic<!-- Bot generated title -->]</ref> | ||
A [[NS320xx|NS32016]] version of BBC BASIC was supplied with the Acorn 32016 coprocessor and Acorn ABC. | A [[NS320xx|NS32016]] version of BBC BASIC was supplied with the Acorn 32016 coprocessor and Acorn ABC. | ||
In addition to the version of BBC BASIC supplied with the [[BBC Micro]]'s Zilog Z80 second processor, a Z80-based version of BBC BASIC also exists for [[CP/M]]-based systems. | In addition to the version of BBC BASIC supplied with the [[BBC Micro]]'s Zilog Z80 second processor, a Z80-based version of BBC BASIC also exists for [[CP/M]]-based systems. A Zilog Z80 version of BBC BASIC was also used on the [[Tiki 100]] desktop computer, [[Cambridge Z88]] portable and the [[Amstrad NC100]] Notepad and [[Amstrad NC100|Amstrad NC200]] Notebook computers. This version has been implemented on the [[TI-83 Plus]] and [[TI-84 Plus]] series [[graphing calculator]]s. Due to efforts of J. G. Harston (also responsible for a [[PDP-11]] version<ref>[https://mdfs.net/bbcbasic/PDP11/ BBC BASIC for PDP-11]</ref> updated as of 2025; implementing BBC BASICV IV and a few additions from BBC BASIC V extensions<ref>{{Cite web |title=BBC BASIC for the PDP11 |url=https://mdfs.net/Software/PDP11/BBCBasic/Read2.me}}</ref>) a version of [https://mdfs.net/bbcbasic/Spectrum/ BBC BASIC] for the [[ZX Spectrum]] was released in January 2002, with many improvements made in subsequent releases. | ||
A Zilog Z80 version of BBC BASIC was also used on the [[Tiki 100]] desktop computer, [[Cambridge Z88]] portable and the [[Amstrad NC100]] Notepad and [[Amstrad NC100|Amstrad NC200]] Notebook computers. This version has been implemented on the [[TI-83 Plus]] and [[TI-84 Plus]] series [[graphing calculator]]s. Due to efforts of J. G. Harston (also responsible for a [[PDP-11]] version<ref>[ | |||
BBC BASIC was also implemented for [[MS-DOS]] as ''BBCBASIC (86)'', which aimed for maximum compatibility with the BBC Micro, and ''BBasic'' with its own enhancements based on BASIC II. | |||
A version of BBC BASIC integrated with the [[ | A version of BBC BASIC integrated with the [[Windows]] [[graphical user interface]], [http://www.rtrussell.co.uk/products/bbcwin/bbcwin.html BBC BASIC for Windows] created by [[Richard T. Russell|Richard Russell]], developer of the Z80 and [[x86]] versions, was released in 2001. Whilst supporting nearly completely the original BBC BASIC specification (BASIC IV), the Windows version supports much of BASIC V/VI syntax as well as some advanced features of its own. Features unique to BBC BASIC for Windows include interpreter support for record/structure types, and the ability to call Windows [[API]] routines or those in an external [[Dynamic-link library|DLL]]. Recent versions have included advanced features comparable with languages like [[C (programming language)|C]], and an external [[library (computing)|library]] has recently added support for objects. | ||
BBC BASIC for [[Simple DirectMedia Layer|SDL]] was also developed by Richard T. Russell, and is largely compatible with the previous BBC BASIC for Windows, sharing with that dialect many new and advanced features including data structures, PRIVATE variables, an EXIT statement, long strings, event interrupts, an address-of operator, byte variables, a line continuation character, indirect procedure and function calls and improved numeric accuracy. The first version was released in February 2019, and remains in active development {{As of| | BBC BASIC for [[Simple DirectMedia Layer|SDL]] was also developed by Richard T. Russell, and is largely compatible with the previous BBC BASIC for Windows, sharing with that dialect many new and advanced features including data structures, PRIVATE variables, an EXIT statement, long strings, event interrupts, an address-of operator, byte variables, a line continuation character, indirect procedure and function calls and improved numeric accuracy. The first version was released in February 2019, and remains in active development {{As of|2025|09|lc=y}}.<ref>{{Cite web |title=BBC BASIC for SDL 2.0|url=https://www.bbcbasic.co.uk/bbcsdl/index.html |access-date=2024-08-05 |website=bbcbasic.co.uk}}</ref><ref>{{Cite web |last=rtrussell |title=Commits · rtrussell/BBCSDL |url=https://github.com/rtrussell/BBCSDL |access-date=2025-10-10 |website=GitHub |language=en}}</ref> [https://www.bbcbasic.co.uk/bbcsdl/index.html BBC BASIC for SDL 2.0] supports Windows, MacOS, Linux, Raspberry Pi OS, Android, iOS and mobile devices supporting the SDL library,<ref name="Purdy-2023" /> as well as a version which allows the running of BBC BASIC programs as applets in a web-page via the Web Assembly framework. Programs can be run via the interpreter or compiled to a standalone application bundle which will run without BBC BASIC having to be installed (.exe file in Windows, .dmg file in MacOS, .zip file in Linux or Raspberry Pi OS and .apk file in Android). A high degree of compatibility with the BBC Microcomputer is also retained, including emulation of the SOUND and ENVELOPE statements, and the MODE 7 (teletext) screen mode. BBC BASIC for SDL 2.0 incorporates an assembler which depends on the CPU in the platform: x86 (32-bit or 64-bit) for Windows, MacOS or Linux; ARM (32-bit or 64-bit) for Raspberry Pi. In the case of Android the assembler is ARM or x86 as appropriate. Application Program Interface (API) functions can be accessed from BASIC and from assembler code, allowing an experienced programmer to produce sophisticated applications. | ||
A [[GPL]] clone of BBC BASIC named ''Brandy'', written in portable [[C (programming language)|C]], is also available.<ref>{{cite web | url= | A [[GNU General Public License|GPL]] clone of BBC BASIC named ''Brandy'', written in portable [[C (programming language)|C]], is also available.<ref>{{cite web | url=https://jaguar.orpheusweb.co.uk/branpage.html | title=Brandy | access-date=6 July 2011| archive-url=https://web.archive.org/web/20110717080829/http://jaguar.orpheusweb.co.uk/branpage.html| archive-date= 17 July 2011 | url-status= live}}</ref><ref>{{cite web | url=https://sourceforge.net/projects/brandy/ | title=Brandy Basic V Interpreter | access-date=6 July 2011}}</ref> A fork of this, ''Matrix Brandy'', remains under active development.<ref>{{cite web | url=https://brandy.matrixnetwork.co.uk/ | title=Matrix Brandy BASIC VI | access-date=21 August 2023}}</ref> | ||
An emulator of the BBC Micro for the | An emulator of the BBC Micro for the [[Amiga]] was produced by Ariadne Software for [[Commodore International|CBM]] (UK). While extremely fast, it did not emulate the 6502 at full speed, so assembly code would run slower than a real BBC while BASIC programs would run much faster. Due to the way the optimised BASIC and the 6502 emulation interacted, almost no commercial games would run but well-behaved code and educational software generally worked. Additionally, it used a slightly less precise [[floating-point]] numeric format. For a while it was bundled with a special academic package of the [[Amiga 500]], in the hope that schools would replace their ageing BBC Bs with Amiga 500s. | ||
A version of BBC BASIC V (Z80) has also been made for the TI-83/84+ [[Texas Instruments]] calculator families by Benjamin Ryves. | A version of BBC BASIC V (Z80) has also been made for the TI-83/84+ [[Texas Instruments]] calculator families by Benjamin Ryves. | ||
A [[Commodore 64]] version ''Shado'' was produced by a small software house Aztec Software in the early 1980s.<ref>{{Cite web | url= | A [[Commodore 64]] version ''Shado'' was produced by a small software house Aztec Software in the early 1980s.<ref>{{Cite web | url=https://mdfs.net/Software/BBCBasic/C64/ | title=Commodore 64 BBC BASIC - MDFS::Software.BBCBasic.C64 }}</ref> Patched versions of Acorn's 6502 based HI-BASIC have also been experimentally run on C64, with an interface to the C64 Kernel, replacing the Acorn MOS calls otherwise made. | ||
There have also been efforts to make 6502 based version of BBC BASIC available on the [[Apple II]]. [https://github.com/bobbimanners/Applecorn Applecorn] being one such effort. | There have also been efforts to make 6502 based version of BBC BASIC available on the [[Apple II]]. [https://github.com/bobbimanners/Applecorn Applecorn] being one such effort. | ||
BBC BASIC is the programming language used in the Agon Light, an [[open-source]]d 8-bit [[Z80]]-based [[single board computer]] and [[ | BBC BASIC is the programming language used in the Agon Light, an [[open-source]]d 8-bit [[Z80]]-based [[single-board computer]] and [[single-board microcontroller|microcontroller]] designed by Bernardo Kastrup and released in 2022.<ref>{{Cite web |title=Olimex Forks Bernardo Kastrup's Agon Light, Offers a Tweaked Z80 Single-Board Computer Design |url=https://www.hackster.io/news/olimex-forks-bernardo-kastrup-s-agon-light-offers-a-tweaked-z80-single-board-computer-design-356ee5f03afb |access-date=24 December 2022 |website=Hackster.io |language=en}}</ref> | ||
==Sample code== | ==Sample code== | ||
| Line 188: | Line 186: | ||
ENDPROC : REM of PROC_triangle() | ENDPROC : REM of PROC_triangle() | ||
}} | }} | ||
==References== | ==References== | ||
| Line 196: | Line 191: | ||
==External links== | ==External links== | ||
* | * [https://www.bbcbasic.org The home of BBC BASIC] | ||
* | * [https://www.bbcbasic.org/products.html The home of BBC BASIC: Products] | ||
* | * [https://mdfs.net/bbcbasic/ BBC BASIC per CPU/OS] | ||
* [ | * [https://www.benryves.com/products/bbcbasic/ TI-83+ and TI-84+ implementation of BBC BASIC] | ||
* [ | * [https://www.ncus.org.uk The Amstrad NC Users' Site] | ||
* [https://web.archive.org/web/20040927075114/http://www.pawbooks.co.uk/ Ebook programming guide with interfacing methods] | * [https://web.archive.org/web/20040927075114/http://www.pawbooks.co.uk/ Ebook programming guide with interfacing methods] | ||
* [http://www.riscos.com/support/developers/bbcbasic/ BBC BASIC Reference Manual] (for RISC OS) | * [http://www.riscos.com/support/developers/bbcbasic/ BBC BASIC Reference Manual] (for RISC OS) | ||
* [ | * [https://central.kaserver5.org/Kasoft/Typeset/BBC/Contents.html BBC microcomputer User Guide] (HTML) | ||
* [http://bbc.nvg.org/doc/BBCUserGuide-1.00.pdf BBC microcomputer User Guide] (PDF) | * [http://bbc.nvg.org/doc/BBCUserGuide-1.00.pdf BBC microcomputer User Guide] (PDF) | ||
* [https://stackoverflow.com/questions/43940940/python-code-vs-bbc-basic-for-windows Python code vs BBC Basic for Windows] | * [https://stackoverflow.com/questions/43940940/python-code-vs-bbc-basic-for-windows Python code vs BBC Basic for Windows] | ||
* [ | * [https://cowlark.com/2019-06-14-bbcbasic-opensource/ R.T. Russell's Z80 BBC Basic is now open source] at [https://github.com/davidgiven/cpmish GitHub] | ||
{{BASIC}} | {{BASIC}} | ||
Latest revision as of 19:56, 13 November 2025
Template:Short description Template:Use British English Template:Use dmy dates
Script error: No such module "Infobox".Template:Template otherScript error: No such module "Check for unknown parameters".
BBC BASIC is an interpreted version of the BASIC programming language. It was developed by Acorn Computers Ltd when they were selected by the BBC to supply the computer for their BBC Literacy Project in 1981.
It was originally supplied on an installed ROM for the BBC Microcomputer which used a 6502 microprocessor. When Acorn produced the Archimedes computer which used their ARM processor, further versions of BBC BASIC were produced. Acorn included a built in assembler, first for the 6502 and later for the ARM2 processor.
Initially the BBC specified compatibility with Microsoft BASIC. Acorn were already extending their earlier Atom BASIC to include structured programming constructs. Particularly on the later Archimedes computers as the memory constraints reduced, BBC BASIC incorporated a more complete set of structured programming constructs commonly found in the ALGOL 60 group of computer languages.
Alongside Acorn's version of BBC BASIC on the Archimedes, third party companies produced compiled versions of the language. Development and support has continued after the demise of Acorn Computers Ltd for newer ARM based computers. BBC BASIC is now available on other platforms either for emulators such as on Microsoft Windows or natively.
History
Precursor languages
At Dartmouth College, two mathematics professors[1] wanted all students to be able to program on their new college computer. The existing high-level languages, like FORTRAN and COBOL, were used by professionals and not really suitable for introductory programming by non-technical users. In 1964, they created Dartmouth BASIC[2] (short for Beginner's All-Purpose Symbolic Instruction Code) to be a computer language anyone could use. Having a formula-based syntactic structure, it is a simplified FORTRAN.[3]
A combination of factors led to BASIC becoming a major language in the late 1960s, and in the 1970s when the first microcomputers were being built, it was already the de facto standard for small systems. The introduction of the Altair 8800 cemented the position of BASIC as the first programming language introduced for the platform was Paul Allen and Bill Gates' Altair BASIC. As new micros were introduced, almost all of them ran some variation of BASIC as its primary interface.[3]
BBC's involvement
During the 1970s, the BBC Continuing Education Department was considering how advancements in computer related technology would impact British society. Their Microelectronics Report[4] in 1979 to the Manpower Services Commission describes formally their concerns about increasing polarisation and alienation in the workplace.
The BBC required a microcomputer usable for demonstrations in their programming that could be purchased by the general public to enable the viewer to themselves experiment. They decided that such a microcomputer needed to be robust, have expansion capabilities and an implementation of BASIC compatible with Microsoft BASIC VN5.[5]
Jointly the government and the BBC established a public awareness and education campaign. This Computer Literacy Project (1980-1989)[6] used the BBC's choice of the BBC Microcomputer produced by Acorn Computers Ltd. BBC BASIC was central to the user programming experience.
Acorn's involvement
Acorn first developed System BASIC and Atom BASIC for their early 6502 microprocessor computers[7] that were sold to kit-build customers. With the development of the Proton as a front-end processor, Acorn were designing for more powerful computing.
In order to produce a computer to satisfy the BBC specification, the Proton became the BBC Microcomputer, usable as a stand alone computer. By retaining the capability to be connected to a Z80 computer, Acorn was able to comply with the requirement of a computer supporting CP/M.[8]
Sophie Wilson developed the implementations of BASIC at Acorn.[9] The dialect on the BBC Microcomputer became compatible with Microsoft BASIC and so was acceptable to the BBC. It already had features from the ALGOL 60 group of computer languages that Wilson added to enable some structured programming methodology to be used.
Platforms and versions
BBC Micro
Script error: No such module "Labelled list hatnote".
The full version list is available here:[10]
BASIC I, the original version, was shipped on early BBC Micros.
BASIC II was used on the Acorn Electron and BBC Micros shipped after 1982, including the Model B. It added the OPENUP and OSCLI keywords, along with offset assembly and bug fixes.[11]
BASIC III was produced in both a UK version and a United States market version for Acorn's abortive attempt to enter the cross-Atlantic computer market. Apart from a few bug fixes, the only change from BASIC II was that the COLOUR command could also be spelled COLOR: regardless of which was input, the UK version always listed it as COLOUR, the US version as COLOR. The main place that BASIC III can be found is as the HI-BASIC version for the external second processor.
BASIC IV, also known as CMOS BASIC, available on the BBC Master machines, was changed to use the new instructions available in the 65SC12 processor, reducing the size of the code and therefore allowing the inclusion of LIST IF, EXT# as a statement, EDIT, TIME$, ON PROC, | in VDU statements and faster floating point. Bug fixes were again included.
BASIC IV (1986) was a further improvement to BASIC IV, and was included on the Master Compact machine. The version of BASIC on the Compact included re-coded mathematical routines, said to provide a 30% speed increase over the version included in the rest of the Master series.[12]
HI-BASIC was available in two versions, the first based on BASIC III, and the second based on BASIC IV. Both were built to run from a higher address (&B800) on the second processor, rather than the usual &8000 address on the BBC B. This allowed more program space to be available on either the external or internal 6502 second processors. A version was introduced to support a Zilog Z80 second processor.[13]
Another version of BBC BASIC, called BAS128, was supplied on tape and disc with the BBC Master and Master Compact; it loaded into main RAM and used the 64 KB of Sideways RAM for user programs. This provided support for much larger programs at the cost of being a lot slower than the normal ROM-based version.
The interpreter can deal with both BASIC and 6502 assembly language, which can be included between the [ and ] characters. This contributed to the system's popularity with industrial and research engineers.[14]
Further details/determining BASIC version
Script error: No such module "Unsubst". As the BBC MOS and RISC OS were usually supplied on ROM, it may be assumed that a specific release of the operating system contained a specific version of BASIC. As such, there is no simple way to determine which version of BASIC is actually running other than by enquiring the operating system identity and thus making an assumption.
Note that all Electrons, and later BBC microcomputers, have BASIC2: the earlier BBC microcomputers have BASIC1. If you are not sure which version of BASIC is in your machine, typing REPORT after BASIC has started up (after a BREAK or *BASIC), will print the copyright message. If the date is 1981, BASIC1 is fitted; if it is 1982, you have BASIC2. American machines, or those with a second processor, may have US BASIC or HIBASIC: the ROM routines will not be in the same place for these ROMS.
— BASIC ROM USER GUIDE
See also BeebWiki entry for INKEY.
On the BBC family, it is possible to run both the standard BASIC and an enhanced HIBASIC on the 6502 second processor. One may determine if the program is running on the second processor by examining the initial value of PAGE, it will be &800 if using the second processor. To distinguish between BASIC and HIBASIC, one should examine the initial value of HIMEM. This will be &8000 for BASIC running on the second processor, and &B800 for HIBASIC on the second processor.
A similar situation exists on RISC OS where there may be the normal BASIC or BASIC64 (which offers higher precision maths). Normal BASIC identifies itself as "BASIC V" and BASIC64 identifies itself as "BASIC VI", therefore the following (used before any error has occurred) will distinguish one from the other:
IF INSTR(REPORT$,"VI") THEN PRINT "BASIC64" ELSE PRINT "BASIC"
There are better ways of doing this.Template:According to whom See the BeebWiki. In almost all cases you shouldn't need to be testing for what BASIC or platform your program is running on, just make the call and read whatever returned data are returned and deal with it.Script error: No such module "Unsubst".
Acorn Archimedes (RISC OS)
Script error: No such module "Labelled list hatnote". With the move to the 32-bit ARM CPU and the removal of the 16 KB limit on the BASIC code size many new features were added.[15] BASIC V version 1.04 was 61 KB long. CurrentTemplate:When versions of RISC OS still contain a BBC BASIC V interpreter. The source code to the RISC OS 5 version of BBC BASIC V has been released under the Apache 2.0 license by RISC OS Open.
Amongst the new commands and features supported were:
WHILE-ENDWHILEIF-THEN-ELSE-ENDIFCASE-OF-WHEN-OTHERWISE-ENDCASE,RETURNparameters in procedures,- local arrays,
- procedure libraries (
LIBRARY,INSTALLandOVERLAY), LOCAL DATAandLOCAL ERRORhandlers,- a relative
RESTORE, - array operations,
- new operators,
STEP TRACE,- Commands for the new sound system, mouse, graphics.
The graphics commands were entirely backwards compatible, the sound less so; for example, the ENVELOPE keyword from BASIC V onwards is a command that takes fourteen numeric parameters and effectively does nothing— as in older versions, it calls OS_Word 8, but that does nothing on RISC OS.[16] The in-line 6502 assembler was replaced by an ARM assembler. BASIC V was said, by Acorn, to be "certainly the fastest interpreted BASIC in the world" and "probably the most powerful BASIC found on any computer".
BASIC VI is a version of BASIC V that supports IEEE 754 8-byte format real numbers, as opposed to the standard 5-byte format introduced in BASIC I.
BBC BASIC V and VI were delivered as standard on the Acorn Archimedes and the RiscPC. A version of BBC BASIC V was also available to run on the ARM second processor for the BBC Micro.
A compiler for BBC BASIC V was produced by Paul Fellows, team leader of the Arthur OS development, called the Archimedes BASIC Compiler and published initially by DABS Press.[17] ABC was able to implement almost all of the language, with the obvious exception of the EVAL function, which inevitably required run-time programmatic interpretation. As evidence of its completeness, it was able to support inline assembler syntax. The compiler was written in BBC BASIC V. Many applications initially written to run under the interpreter benefitted from the performance boost that this gave, putting BBC BASIC V on a par with other languages for serious application development.
Other platforms
BBC BASIC has also been ported to many other platforms.[18]
A NS32016 version of BBC BASIC was supplied with the Acorn 32016 coprocessor and Acorn ABC.
In addition to the version of BBC BASIC supplied with the BBC Micro's Zilog Z80 second processor, a Z80-based version of BBC BASIC also exists for CP/M-based systems. A Zilog Z80 version of BBC BASIC was also used on the Tiki 100 desktop computer, Cambridge Z88 portable and the Amstrad NC100 Notepad and Amstrad NC200 Notebook computers. This version has been implemented on the TI-83 Plus and TI-84 Plus series graphing calculators. Due to efforts of J. G. Harston (also responsible for a PDP-11 version[19] updated as of 2025; implementing BBC BASICV IV and a few additions from BBC BASIC V extensions[20]) a version of BBC BASIC for the ZX Spectrum was released in January 2002, with many improvements made in subsequent releases.
BBC BASIC was also implemented for MS-DOS as BBCBASIC (86), which aimed for maximum compatibility with the BBC Micro, and BBasic with its own enhancements based on BASIC II.
A version of BBC BASIC integrated with the Windows graphical user interface, BBC BASIC for Windows created by Richard Russell, developer of the Z80 and x86 versions, was released in 2001. Whilst supporting nearly completely the original BBC BASIC specification (BASIC IV), the Windows version supports much of BASIC V/VI syntax as well as some advanced features of its own. Features unique to BBC BASIC for Windows include interpreter support for record/structure types, and the ability to call Windows API routines or those in an external DLL. Recent versions have included advanced features comparable with languages like C, and an external library has recently added support for objects.
BBC BASIC for SDL was also developed by Richard T. Russell, and is largely compatible with the previous BBC BASIC for Windows, sharing with that dialect many new and advanced features including data structures, PRIVATE variables, an EXIT statement, long strings, event interrupts, an address-of operator, byte variables, a line continuation character, indirect procedure and function calls and improved numeric accuracy. The first version was released in February 2019, and remains in active development Template:As of.[21][22] BBC BASIC for SDL 2.0 supports Windows, MacOS, Linux, Raspberry Pi OS, Android, iOS and mobile devices supporting the SDL library,[9] as well as a version which allows the running of BBC BASIC programs as applets in a web-page via the Web Assembly framework. Programs can be run via the interpreter or compiled to a standalone application bundle which will run without BBC BASIC having to be installed (.exe file in Windows, .dmg file in MacOS, .zip file in Linux or Raspberry Pi OS and .apk file in Android). A high degree of compatibility with the BBC Microcomputer is also retained, including emulation of the SOUND and ENVELOPE statements, and the MODE 7 (teletext) screen mode. BBC BASIC for SDL 2.0 incorporates an assembler which depends on the CPU in the platform: x86 (32-bit or 64-bit) for Windows, MacOS or Linux; ARM (32-bit or 64-bit) for Raspberry Pi. In the case of Android the assembler is ARM or x86 as appropriate. Application Program Interface (API) functions can be accessed from BASIC and from assembler code, allowing an experienced programmer to produce sophisticated applications.
A GPL clone of BBC BASIC named Brandy, written in portable C, is also available.[23][24] A fork of this, Matrix Brandy, remains under active development.[25]
An emulator of the BBC Micro for the Amiga was produced by Ariadne Software for CBM (UK). While extremely fast, it did not emulate the 6502 at full speed, so assembly code would run slower than a real BBC while BASIC programs would run much faster. Due to the way the optimised BASIC and the 6502 emulation interacted, almost no commercial games would run but well-behaved code and educational software generally worked. Additionally, it used a slightly less precise floating-point numeric format. For a while it was bundled with a special academic package of the Amiga 500, in the hope that schools would replace their ageing BBC Bs with Amiga 500s.
A version of BBC BASIC V (Z80) has also been made for the TI-83/84+ Texas Instruments calculator families by Benjamin Ryves.
A Commodore 64 version Shado was produced by a small software house Aztec Software in the early 1980s.[26] Patched versions of Acorn's 6502 based HI-BASIC have also been experimentally run on C64, with an interface to the C64 Kernel, replacing the Acorn MOS calls otherwise made.
There have also been efforts to make 6502 based version of BBC BASIC available on the Apple II. Applecorn being one such effort.
BBC BASIC is the programming language used in the Agon Light, an open-sourced 8-bit Z80-based single-board computer and microcontroller designed by Bernardo Kastrup and released in 2022.[27]
Sample code
References
External links
- The home of BBC BASIC
- The home of BBC BASIC: Products
- BBC BASIC per CPU/OS
- TI-83+ and TI-84+ implementation of BBC BASIC
- The Amstrad NC Users' Site
- Ebook programming guide with interfacing methods
- BBC BASIC Reference Manual (for RISC OS)
- BBC microcomputer User Guide (HTML)
- BBC microcomputer User Guide (PDF)
- Python code vs BBC Basic for Windows
- R.T. Russell's Z80 BBC Basic is now open source at GitHub
Template:BASIC Template:BBC Computer Literacy Project Template:RISC OS
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ a b Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ a b Script error: No such module "citation/CS1".
- ↑ BBC BASIC version list
- ↑ Template:Cite magazine
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ BBC BASIC - MDFS::Software.$.BBCBasic
- ↑ BBC BASIC for PDP-11
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".