BBC BASIC

Last updated

BBC BASIC
Sample Code
REM Acorn Archimedes version

ON ERROR : ON ERROR OFF : PRINT REPORT$; " at line ";ERL : END
MODE MODE : REM clears the screen
PROC_triangle(700,700,500,200,500,900,"F")
END

DEF PROC_triangle(x1%,y1%,x2%,y2%,x3%,y3%,fill$)
LOCAL triangle_fill_plot_code%
triangle_fill_plot_code% = &55
MOVE x1%,y1%
DRAW x2%,y2%
IF fill$="F" THEN
PLOT triangle_fill_plot_code%,x3%,y3%
ELSE
DRAW x3%,y3% : DRAW x1%,y1%
ENDIF
ENDPROC : REM of PROC_triangle()

Contents

Developer Acorn Computers Ltd
First appeared1981;43 years ago (1981)
Platform BBC Microcomputer (6502)
Acorn Archimedes (ARM)
Acorn RISC PC (ARM / StrongARM)
OS Acorn 6502 MOS
Acorn RISC OS
Influenced
3rd Party ports to MS Windows
Continuing ARM support by 3rd Parties

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 MS Windows or natively.

History

Precursor languages

Prior to 1957 programming was done using Machine code or Assembly code. These were specific to a processor and not portable.

Then high-level programming languages were developed to allow programs to be more easily transferred between computers:

Many more computer languages were developed during the 1960-1980 period. Few are now in regular use. Those more generally known were ALGOL W [6] at Stanford University, Pascal [7] [8] plus POP-2 [9] at the University of Edinburgh.

K&R C [10] was designed as the language to write the UNIX operating system. This was formalised as ANSI C [11] [12] from which C++ and JAVA were later derived.

At Dartmouth College two mathematics professors [13] wanted all students to be able to program on their new College computer. The existing high-level languages were used by professionals. In 1964 they created Dartmouth BASIC [14] (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.

Together, Paul Allen and Bill Gates developed BASIC for the Altair 8800. Development continued to become IBM's BASIC A and Microsoft BASIC. [15]

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 [16] in 1979 to the Manpower Services Commission describes formally their concerns about increasing polarisation and alienation in the workplace that 43 years earlier Charles Chaplin had shown to comic effect in Modern Times.

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. [17]

Jointly the government and the BBC established a public awareness and education campaign. This Computer Literacy Project (1980-1989) [18] 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 [19] 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. [20]

Sophie Wilson developed the implementations of BASIC at Acorn. 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

BASIC prompt on the BBC Micro after switch-on or hard reset Hard reset BBC Micro 32K Acorn DFS.gif
BASIC prompt on the BBC Micro after switch-on or hard reset

The full version list is available here: [21]

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. [22]

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. [23]

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. [24]

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. [25]

Further details/determining BASIC version

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:

IFINSTR(REPORT$,"VI")THENPRINT"BASIC64"ELSEPRINT"BASIC"

There are better ways of doing this.[ 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.[ original research? ]

Acorn Archimedes (RISC OS)

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. [26] BASIC V version 1.04 was 61 KB long. Current[ 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:

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. [27] 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.[ citation needed ] 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 in-line assembler syntax. The compiler was written in BBC BASIC V. The compiler (running under the interpreter in the early development stages) was able to compile itself, and versions that were distributed were self-compiled object code.[ original research? ] 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. [28]

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 [29] ) a version of BBC BASIC for the ZX Spectrum was released in January 2002, with many improvements made in subsequent releases.

For PC-based systems, BBC BASIC was also implemented for DOS as BBCBASIC (86), which aimed for maximum compatibility with the BBC Micro, and BBasic, which concentrated on the BASIC language, with its own enhancements based on BASIC II.

A version of BBC BASIC integrated with the Microsoft Windows graphical user interface, BBC BASIC for Windows created by Richard Russell, developer of the Z80 and x86 versions, was released in 2001. This version is still under active development, seeing much industry use currently. 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, supporting Windows, Linux and a number of mobile devices supporting the SDL library, as well as a version which allows the running of BBC BASIC programs as applets in a web-page via the Web Assembly fram[ timeframe? ]ework.

A GPL clone of BBC BASIC named Brandy, written in portable C, is also available. [30] [31] A fork of this, Matrix Brandy, remains under active development. [32]

An emulator of the BBC Micro for the Commodore 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. [33] 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 series of computers. 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. [34]

Notes

    See also

    Related Research Articles

    <span class="mw-page-title-main">UCSD Pascal</span> Programming language released in 1977

    UCSD Pascal is a Pascal programming language system that runs on the UCSD p-System, a portable, highly machine-independent operating system. UCSD Pascal was first released in 1977. It was developed at the University of California, San Diego (UCSD).

    <span class="mw-page-title-main">Acorn Computers</span> British computer manufacturer

    Acorn Computers Ltd. was a British computer company established in Cambridge, England, in 1978. The company produced a number of computers which were especially popular in the UK, including the Acorn Electron and the Acorn Archimedes. Acorn's BBC Micro computer dominated the UK educational computer market during the 1980s.

    <span class="mw-page-title-main">Acorn Archimedes</span> Personal computer

    Acorn Archimedes is a family of personal computers designed by Acorn Computers of Cambridge, England. The systems are based on Acorn's own ARM architecture processors and the proprietary operating systems Arthur and RISC OS. The first models were introduced in 1987, and systems in the Archimedes family were sold until the mid-1990s.

    Microsoft BASIC is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler(s) adapted for many different microcomputers. It first appeared in 1975 as Altair BASIC, which was the first version of BASIC published by Microsoft as well as the first high-level programming language available for the Altair 8800 microcomputer.

    <span class="mw-page-title-main">RISC OS</span> Computer operating system by Acorn Computers Ltd

    RISC OS is a computer operating system originally designed by Acorn Computers Ltd in Cambridge, England. First released in 1987, it was designed to run on the ARM chipset, which Acorn had designed concurrently for use in its new line of Archimedes personal computers. RISC OS takes its name from the reduced instruction set computer (RISC) architecture it supports.

    ARX was an unreleased Mach-like operating system written in Modula-2+ developed by Acorn Computers Ltd in the Acorn Research Centre (ARC) United Kingdom (UK) and later by Olivetti - which purchased Acorn - for Acorn's new Archimedes personal computers based on the ARM architecture reduced instruction set computer (RISC) central processing unit (CPUs).

    Acornsoft was the software arm of Acorn Computers, and a major publisher of software for the BBC Micro and Acorn Electron. As well as games, it also produced a large number of educational titles, extra computer languages and business and utility packages – these included word processor VIEW and the spreadsheet ViewSheet supplied on ROM and cartridge for the BBC Micro/Acorn Electron and included as standard in the BBC Master and Acorn Business Computer.

    <span class="mw-page-title-main">Econet</span> Computer networking system

    Econet was Acorn Computers's low-cost local area network system, intended for use by schools and small businesses. It was widely used in those areas, and was supported by a large number of different computer and server systems produced both by Acorn and by other companies.

    Mallard BASIC is a BASIC interpreter for CP/M produced by Locomotive Software and supplied with the Amstrad PCW range of small business computers, the ZX Spectrum +3 version of CP/M Plus, and the Acorn BBC Micro's Zilog Z80 second processor.

    Xara is an international software company founded in 1981, with an HQ in Berlin and development office in Hemel Hempstead, UK. It has developed software for a variety of computer platforms, in chronological order: the Acorn Atom, BBC Micro, Z88, Atari ST, Acorn Archimedes, Microsoft Windows, Linux, and more recently web browser-based services.

    <span class="mw-page-title-main">BBC Master</span> Microcomputer

    The BBC Master is a home computer released by Acorn Computers in early 1986. It was designed and built for the British Broadcasting Corporation (BBC) and was the successor to the BBC Micro Model B. The Master 128 remained in production until 1993.

    The Acorn Business Computer (ABC) was a series of microcomputers announced at the end of 1983 by the British company Acorn Computers. The series of eight computers was aimed at the business, research and further education markets. Demonstrated at the Personal Computer World Show in September 1984, having been under development for "about a year" and having been undergoing field trials from May 1984, the range "understandably attracted a great deal of attention" and was favourably received by some commentators. The official launch of the range was scheduled for January 1985.

    <span class="mw-page-title-main">Acorn MOS</span> Computer operating system

    The Machine Operating System (MOS) or OS is a discontinued computer operating system (OS) used in Acorn Computers' BBC computer range. It included support for four-channel sound, graphics, file system abstraction, and digital and analogue input/output (I/O) including a daisy-chained expansion bus. The system was single-tasking, monolithic and non-reentrant.

    Pascal MicroEngine is a series of microcomputer products manufactured by Western Digital from 1979 through the mid-1980s, designed specifically to run the UCSD p-System efficiently. Compared to other microcomputers, which use a machine language p-code interpreter, the Pascal MicroEngine has its interpreter implemented in microcode; p-code is its machine language. The most common programming language used on the p-System is Pascal.

    <span class="mw-page-title-main">BBC Micro expansion unit</span>

    A BBC Micro expansion unit, for the BBC Micro is one of a number of peripherals in a box with the same profile and styling as the main computer.

    <i>Liverpool Software Gazette</i>

    Liverpool Software Gazette was a short-lived computer magazine published by Microdigital Ltd, a company who were based in Liverpool, England and run by Bruce Everiss.

    <span class="mw-page-title-main">BBC Micro</span> Series of British microcomputers by Acorn

    The British Broadcasting Corporation Microcomputer System, or BBC Micro, is a series of microcomputer designed and built by Acorn Computers Limited in the 1980s for the Computer Literacy Project of the BBC. Designed with an emphasis on education, it was notable for its ruggedness, expandability, and the quality of its operating system. The machine was the focus of a number of educational BBC TV programmes on computer literacy, starting with The Computer Programme in 1982, followed by Making the Most of the Micro, Computers in Control in 1983, and finally Micro Live in 1985.

    <span class="mw-page-title-main">Acornsoft LISP</span> Lisp dialect for the BBC Micro

    Acornsoft LISP is a dialect and commercial implementation of the Lisp programming language, released in the early 1980s for the 8-bit Acorn Atom, BBC Micro and Acorn Electron computers.

    RISC OS, the computer operating system developed by Acorn Computers for their ARM-based Acorn Archimedes range, was originally released in 1987 as Arthur 0.20, and soon followed by Arthur 0.30, and Arthur 1.20. The next version, Arthur 2, became RISC OS 2 and was completed and made available in April 1989. RISC OS 3 was released with the very earliest version of the A5000 in 1991 and contained a series of new features. By 1996 RISC OS had been shipped on over 500,000 systems.

    References

    1. "Fortran (a history)". IBM. Retrieved 7 January 2024.
    2. "John McCarthy". MIT Museum. Retrieved 7 January 2024.
    3. "Introduction to LISP". GeeksforGeeks. Retrieved 7 January 2024.
    4. "Birth of COBOL". University of Pennsylvania. Retrieved 7 January 2024.
    5. "Revised Report on the Algorithmic Language ALGOL 60". Association for Computing Machinery (ACM). Retrieved 7 January 2024.
    6. "Algol W Language Description" (PDF). Retrieved 7 January 2024.
    7. "Pascal (programming language)" . Retrieved 7 January 2024.
    8. Michael Shave (1975). Data Structures. McGraw-Hill. pp. 132–136. ISBN   0-07-084059-8.
    9. R. M. Burstall; J. S. Collins; R. J. Popplestone. "The POP-2 Papers" (PDF). Oliver & Boyd Ltd. Retrieved 7 January 2024.
    10. Kernighan, Brian W.; Ritchie, Dennis M. (1978). The C programming language (1st ed.). Englewood Cliffs, NJ: Prentice-Hall. ISBN   0-13-110163-3.
    11. Brian W. Kernighan; Dennis M.Ritchie (1988). The C Programming Language (2nd ed.). Prentice Hall. ISBN   0-13-110362-8.
    12. Ritchie, Dennis M. "The Development of the C Language". Association for Computing Machinery, Inc. Retrieved 7 January 2024.
    13. "Event History". Dartmouth College. Retrieved 7 January 2024.
    14. "Dartmouth College BASIC Instruction Manual" (PDF). Dartmouth College. Retrieved 7 January 2024.
    15. McCracken, Harry (29 April 2014). "Fifty years of BASIC, the programming language that made computers personal" . Retrieved 7 January 2024.
    16. "Microelectronics Report" (PDF). BBC Continuing Education Department. Retrieved 14 January 2024.
    17. "BBC Microcomputer Specification". BBC. Retrieved 14 January 2024.
    18. "Computer Literacy Project". BBC. Retrieved 14 January 2024.
    19. Ian Sinclair (April 1981). "Atomic Research" (PDF). Computing Today. pp. P21-24. Retrieved 21 January 2024.
    20. "BBC Micro ignites memories of revolution". BBC News. 21 March 2008. Retrieved 21 January 2024.
    21. BBC BASIC version list
    22. "The Old and the New". The Home Computer Advanced Course. No. 52. Orbis Publishing Limited. 1984. pp. 1037–1039. ISSN   0265-2919 . Retrieved 11 May 2024.
    23. "Taking the lid off the Master Compact". Acorn User. October 1986. pp. 15, 17–18. Retrieved 5 September 2020.
    24. Smith, Bruce (November 1984). A & B Computing. London: Argus specialist Publications. p. 6.
    25. Marsh, David (5 December 2005). "ARM targets automotive and industrial dominance". EDN Europe. Retrieved 1 August 2012.
    26. Roger Wilson (3 July 1989). "BASIC V 1.02 versus 1.04 changes (for Richard LLoyd!)". Newsgroup:  eunet.micro.acorn. Usenet:   807@acorn.co.uk . Retrieved 14 June 2011.
    27. "Subject: Envelope command in Basic V".
    28. BBC BASIC - MDFS::Software.$.BBCBasic
    29. BBC BASIC for PDP-11
    30. "Brandy". Archived from the original on 17 July 2011. Retrieved 6 July 2011.
    31. "Brandy Basic V Interpreter" . Retrieved 6 July 2011.
    32. "Matrix Brandy BASIC VI" . Retrieved 21 August 2023.
    33. "Commodore 64 BBC BASIC - MDFS::Software.BBCBasic.C64".
    34. "Olimex Forks Bernardo Kastrup's Agon Light, Offers a Tweaked Z80 Single-Board Computer Design". Hackster.io. Retrieved 24 December 2022.