Beta BASIC
Encyclopedia
Beta BASIC was a BASIC interpreter
for the Sinclair Research ZX Spectrum
microcomputer
, written by Dr Andy Wright and sold by his one-man software house BetaSoft. BetaSoft also produced a regular newsletter/magazine, BetaNews, which was one of the main fora of the time for advanced Spectrum BASIC programmers.
Originally it started as a BASIC toolkit but over time it grew into an interpreter in its own right.
program, completely replacing Sinclair BASIC
. As with most micros of the 1980s, the Spectrum's BASIC interpreter was also its operating system, providing the command line interface (CLI), the on-screen program editor
and everything else. It was the sole means of operating and controlling the computer.
Another nicety was that the editor, when listing, could optionally automatically prettyprint
code. It was possible to do this manually in Sinclair BASIC, but automatic indentation has the advantage of highlighting certain types of coding error - primarily those to do with failing to correctly close constructs. Other editing improvements included automatic highlighting of the current-line indicator - a small tweak but disproportionately helpful - and the ability to move the cursor up and down as well as left and right, a huge boon when editing long lines. Combined with the 64-column display (see "New functionality" section below), these improvements made Beta BASIC a much more productive environment even for coding standard Sinclair BASIC and making no use of BetaSoft's language additions.
Beta BASIC was also a BASIC interpreter in its own right, completely replacing and bypassing the Spectrum ROM
, which it used as a library. It occasionally made calls into the ROM to access useful functions which it was not worth re-implementing in Beta BASIC itself, either because the ROM routines were good enough or for reasons of space - Beta BASIC had to run in the meagre 48 KB
of memory available on a Spectrum and still leave room for the user's code.
with named procedures and functions, complete with local variables, allowing for programming using recursion
. Although it supported line numbers, they were not necessary and it offered a mode of operation which completely suppressed the display of line numbers. It provided array operations and commands for accessing files on tape and disk.
In terms of facilities, it exceeded many other available 8-bit BASICs of the 1980s and in some ways approached the capabilities of Microsoft
's QuickBASIC
4.5 compiler or QBASIC
interpreter, which were programs for far more sophisticated 16-bit computers a decade later.
On the 128K Spectrum machines, Beta BASIC provided extended facilities allowing programmers to access the machine's extra memory, which took the form of a RAM disk
. As well as allowing the programmer to save and load programs, blocks of memory or screen images into the RAM disc and catalogue the contents of the RAM disk, Beta BASIC also provided commands for the creation and use of arrays held in the RAM disk, allowing programs running in the 30 KB or so of free memory on the Spectrum to manipulate arrays of approaching 80 KB - a very significant extra amount of space by 1980s standards and more than almost any other 8-bit BASIC, which were generally limited to 64 KB of program and data combined.
display directly, eliminating the restrictions of the ROM's 32-column text display. Beta BASIC offered scalable screen fonts, with a special soft font which was only 4 pixels wide but still highly legible. This meant that Beta BASIC could display 64 columns of text across the screen, quite competitive with newer 8-bit machines' 80-column screens. If the user was prepared to tolerate characters being displayed without gaps between them, an 85 column display was possible. This was not very readable but did allow easy porting of BASIC applications designed for an 80-column screen. Text size could be controlled programmatically so that part of a program's display might use 64-column text, part 32-column text and enlarged or reduced intermediate sizes.
Special versions were produced for users of Interface 1 and the ZX Microdrive
, and subsequently for those with the DISCiPLE
and PlusD disk interfaces as well. A version for the Amstrad
Spectrum +3 was also under consideration for a while, but Dr. Wright discarded the project.
CPU. Of this, 16 KB was taken by the Sinclair BASIC ROM, leaving 48 KB for RAM. The screen took some of this, as did the areas used for holding the interpreter's own internal data structures. Beta BASIC took around 11-12 KB of the remainder, in some cases leaving only 20 KB or so for user programs.
The replacement of Sinclair's editor meant that it was not possible to use the 128K Spectrum ROM's full-screen BASIC editor. No compiler
was available for Beta BASIC code and existing Sinclair BASIC compilers such as HiSoft
BASIC could not handle the extended keywords and facilities of Beta BASIC. It was possible to develop under Beta BASIC and later compile with HiSoft BASIC, but only by restricting oneself to the limited subset of Sinclair BASIC supported by both implementations - a very frustrating experience for a Beta BASIC coder.
Because Spectrum BASIC only supported floating-point variables and arithmetic (there was no support for integer
work), neither did Beta BASIC. This was unfortunate, as this provided significant speed gains and memory savings in rival BASICs. Another remaining Sinclair BASIC limitation was that only single-letter variable names could be used for strings, arrays and other types.
The only other 8-bit BASIC with inbuilt support for structured programming was BBC BASIC
. Beta BASIC named procedures did not need to be called with the PROC keyword like in BBC BASIC and thus became new language keywords, allowing the language to be extended in itself. However, BBC BASIC was considerably quicker - the fastest BASIC interpreter of the time. Beta BASIC was not especially fast, though it included faster replacements for particularly slow ROM routines, such as the circle and arc drawing code. Another BBC BASIC feature it lacked was support for the inclusion of inline assembly language in BASIC programs.
, Alan Miles and Bruce Gordon of MGT approached BetaSoft and contracted Dr Wright to provide the BASIC for the new machine. He provided a complete BASIC interpreter which drew extensively upon Beta BASIC but was differently structured, as this was a language in its own right and had no Sinclair ROM to call upon or work around. SAM BASIC was largely compatible with Beta BASIC and operated in a very similar manner, except for areas where the SAM hardware was significantly different, such as the SAM's screen and extended memory. BetaSoft later released an extension to SAM BASIC, named MasterBASIC http://www.worldofsam.org/node/202.
Interpreter (computing)
In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...
for the Sinclair Research ZX Spectrum
ZX Spectrum
The ZX Spectrum is an 8-bit personal home computer released in the United Kingdom in 1982 by Sinclair Research Ltd...
microcomputer
Microcomputer
A microcomputer is a computer with a microprocessor as its central processing unit. They are physically small compared to mainframe and minicomputers...
, written by Dr Andy Wright and sold by his one-man software house BetaSoft. BetaSoft also produced a regular newsletter/magazine, BetaNews, which was one of the main fora of the time for advanced Spectrum BASIC programmers.
Originally it started as a BASIC toolkit but over time it grew into an interpreter in its own right.
Operation
It ran as a terminate and stay residentTerminate and Stay Resident
Terminate and Stay Resident is a computer system call in DOS computer operating systems that returns control to the system as if the program has quit, but keeps the program in memory...
program, completely replacing Sinclair BASIC
Sinclair BASIC
Sinclair BASIC is a dialect of the BASIC programming language used in the 8-bit home computers from Sinclair Research and Timex Sinclair...
. As with most micros of the 1980s, the Spectrum's BASIC interpreter was also its operating system, providing the command line interface (CLI), the on-screen program editor
Text editor
A text editor is a type of program used for editing plain text files.Text editors are often provided with operating systems or software development packages, and can be used to change configuration files and programming language source code....
and everything else. It was the sole means of operating and controlling the computer.
Facilities
Beta BASIC provided a new and improved CLI and editor. It supported Sinclair's idiosyncratic single-key entry system for BASIC keywords but also allowed keywords to be spelled out letter-for-letter, which was quicker if the user had fitted a full-size full-travel keyboard to their machine, a very popular modification for serious users. This also removed the necessity for memorising the sometimes arcane key combinations necessary to enter less-commonly-used BASIC keywords. However, the single-key entry system was also extended by mapping the Spectrum's 'graphics' characters to Beta BASIC's new keywords. To switch from keyword entry to typed entry, it was merely necessary to type a single space, causing the cursor mode to change from K (keyword) to L (lowercase) or C (capital). (The KEYWORDS statement could also be used to alter this behaviour, for example by disabling the K mode.) This was a much simpler, more elegant & less intrusive change than Sinclair's own full-screen editor for the Spectrum 128.Another nicety was that the editor, when listing, could optionally automatically prettyprint
Prettyprint
Prettyprint is the application of any of various stylistic formatting conventions to text, source code, markup, and other similar kinds of content. These formatting conventions usually consist of changes in positioning, spacing, color, contrast, size and similar modifications intended to make the...
code. It was possible to do this manually in Sinclair BASIC, but automatic indentation has the advantage of highlighting certain types of coding error - primarily those to do with failing to correctly close constructs. Other editing improvements included automatic highlighting of the current-line indicator - a small tweak but disproportionately helpful - and the ability to move the cursor up and down as well as left and right, a huge boon when editing long lines. Combined with the 64-column display (see "New functionality" section below), these improvements made Beta BASIC a much more productive environment even for coding standard Sinclair BASIC and making no use of BetaSoft's language additions.
Beta BASIC was also a BASIC interpreter in its own right, completely replacing and bypassing the Spectrum ROM
Read-only memory
Read-only memory is a class of storage medium used in computers and other electronic devices. Data stored in ROM cannot be modified, or can be modified only slowly or with difficulty, so it is mainly used to distribute firmware .In its strictest sense, ROM refers only...
, which it used as a library. It occasionally made calls into the ROM to access useful functions which it was not worth re-implementing in Beta BASIC itself, either because the ROM routines were good enough or for reasons of space - Beta BASIC had to run in the meagre 48 KB
Kilobyte
The kilobyte is a multiple of the unit byte for digital information. Although the prefix kilo- means 1000, the term kilobyte and symbol KB have historically been used to refer to either 1024 bytes or 1000 bytes, dependent upon context, in the fields of computer science and information...
of memory available on a Spectrum and still leave room for the user's code.
Language changes
For its time, Beta BASIC was astonishingly sophisticated. It provided full structured programmingStructured programming
Structured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could...
with named procedures and functions, complete with local variables, allowing for programming using recursion
Recursion
Recursion is the process of repeating items in a self-similar way. For instance, when the surfaces of two mirrors are exactly parallel with each other the nested images that occur are a form of infinite recursion. The term has a variety of meanings specific to a variety of disciplines ranging from...
. Although it supported line numbers, they were not necessary and it offered a mode of operation which completely suppressed the display of line numbers. It provided array operations and commands for accessing files on tape and disk.
In terms of facilities, it exceeded many other available 8-bit BASICs of the 1980s and in some ways approached the capabilities of Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...
's QuickBASIC
QuickBASIC
Microsoft QuickBASIC is an Integrated Development Environment and compiler for the BASIC programming language that was developed by Microsoft. QuickBASIC runs mainly on DOS, though there was a short-lived version for Mac OS...
4.5 compiler or QBASIC
QBasic
QBasic is an IDE and interpreter for a variant of the BASIC programming language which is based on QuickBASIC. Code entered into the IDE is compiled to an intermediate form, and this intermediate form is immediately interpreted on demand within the IDE. It can run under nearly all versions of DOS...
interpreter, which were programs for far more sophisticated 16-bit computers a decade later.
On the 128K Spectrum machines, Beta BASIC provided extended facilities allowing programmers to access the machine's extra memory, which took the form of a RAM disk
RAM disk
A RAM disk or RAM drive is a block of RAM that a computer's software is treating as if the memory were a disk drive...
. As well as allowing the programmer to save and load programs, blocks of memory or screen images into the RAM disc and catalogue the contents of the RAM disk, Beta BASIC also provided commands for the creation and use of arrays held in the RAM disk, allowing programs running in the 30 KB or so of free memory on the Spectrum to manipulate arrays of approaching 80 KB - a very significant extra amount of space by 1980s standards and more than almost any other 8-bit BASIC, which were generally limited to 64 KB of program and data combined.
New functionality
Beta BASIC also drove the Spectrum's 256x192 pixelPixel
In digital imaging, a pixel, or pel, is a single point in a raster image, or the smallest addressable screen element in a display device; it is the smallest unit of picture that can be represented or controlled....
display directly, eliminating the restrictions of the ROM's 32-column text display. Beta BASIC offered scalable screen fonts, with a special soft font which was only 4 pixels wide but still highly legible. This meant that Beta BASIC could display 64 columns of text across the screen, quite competitive with newer 8-bit machines' 80-column screens. If the user was prepared to tolerate characters being displayed without gaps between them, an 85 column display was possible. This was not very readable but did allow easy porting of BASIC applications designed for an 80-column screen. Text size could be controlled programmatically so that part of a program's display might use 64-column text, part 32-column text and enlarged or reduced intermediate sizes.
Special versions were produced for users of Interface 1 and the ZX Microdrive
ZX Microdrive
The ZX Microdrive is a magnetic tape data storage system launched in July 1983 by Sinclair Research for their ZX Spectrum home computer. The Microdrive technology was later also used in the Sinclair QL and ICL One Per Desk personal computers.-Development:...
, and subsequently for those with the DISCiPLE
DISCiPLE
The DISCiPLE was a floppy disk interface for the Sinclair ZX Spectrum home computer. Designed by Miles Gordon Technology, it was marketed by Rockfort Products and launched in 1986....
and PlusD disk interfaces as well. A version for the Amstrad
Amstrad
Amstrad is a British electronics company, now wholly owned by BSkyB. As of 2006, Amstrad's main business is manufacturing Sky Digital interactive boxes....
Spectrum +3 was also under consideration for a while, but Dr. Wright discarded the project.
Limitations
Nonetheless, Beta BASIC suffered from some limitations. As with other 8-bit microprocessors, the Spectrum could only address 64 KB of contiguous memory due to the addressing restrictions of the Spectrum's Zilog Z80Zilog Z80
The Zilog Z80 is an 8-bit microprocessor designed by Zilog and sold from July 1976 onwards. It was widely used both in desktop and embedded computer designs as well as for military purposes...
CPU. Of this, 16 KB was taken by the Sinclair BASIC ROM, leaving 48 KB for RAM. The screen took some of this, as did the areas used for holding the interpreter's own internal data structures. Beta BASIC took around 11-12 KB of the remainder, in some cases leaving only 20 KB or so for user programs.
The replacement of Sinclair's editor meant that it was not possible to use the 128K Spectrum ROM's full-screen BASIC editor. No compiler
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...
was available for Beta BASIC code and existing Sinclair BASIC compilers such as HiSoft
HiSoft
HiSoft Systems was a software company based in the UK, creators of a range of programming tools for microcomputers in 1980s and 1990s. Their first products were Pascal and Assembler implementations for the NASCOM 1 and 2 kit-based computers, followed by Pascal and C for ZX Spectrum computers, as...
BASIC could not handle the extended keywords and facilities of Beta BASIC. It was possible to develop under Beta BASIC and later compile with HiSoft BASIC, but only by restricting oneself to the limited subset of Sinclair BASIC supported by both implementations - a very frustrating experience for a Beta BASIC coder.
Because Spectrum BASIC only supported floating-point variables and arithmetic (there was no support for integer
Integer (computer science)
In computer science, an integer is a datum of integral data type, a data type which represents some finite subset of the mathematical integers. Integral data types may be of different sizes and may or may not be allowed to contain negative values....
work), neither did Beta BASIC. This was unfortunate, as this provided significant speed gains and memory savings in rival BASICs. Another remaining Sinclair BASIC limitation was that only single-letter variable names could be used for strings, arrays and other types.
The only other 8-bit BASIC with inbuilt support for structured programming was BBC BASIC
BBC BASIC
BBC BASIC is a programming language, developed in 1981 as a native programming language for the MOS Technology 6502 based Acorn BBC Micro home/personal computer, mainly by Sophie Wilson. It is a version of the BASIC programming language adapted for a U.K...
. Beta BASIC named procedures did not need to be called with the PROC keyword like in BBC BASIC and thus became new language keywords, allowing the language to be extended in itself. However, BBC BASIC was considerably quicker - the fastest BASIC interpreter of the time. Beta BASIC was not especially fast, though it included faster replacements for particularly slow ROM routines, such as the circle and arc drawing code. Another BBC BASIC feature it lacked was support for the inclusion of inline assembly language in BASIC programs.
Subsequent development
During the development of their sophisticated new successor to the Spectrum, the SAM CoupéSAM Coupé
The SAM Coupé is an 8-bit British home computer that was first released in late 1989. It is commonly considered a clone of the Sinclair ZX Spectrum computer, since it features a compatible screen mode and emulated compatibility, and it was marketed as a logical upgrade from the Spectrum...
, Alan Miles and Bruce Gordon of MGT approached BetaSoft and contracted Dr Wright to provide the BASIC for the new machine. He provided a complete BASIC interpreter which drew extensively upon Beta BASIC but was differently structured, as this was a language in its own right and had no Sinclair ROM to call upon or work around. SAM BASIC was largely compatible with Beta BASIC and operated in a very similar manner, except for areas where the SAM hardware was significantly different, such as the SAM's screen and extended memory. BetaSoft later released an extension to SAM BASIC, named MasterBASIC http://www.worldofsam.org/node/202.