Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
- This article has been moved or is in the process of being moved to the Sinclair FAQ Wiki, under the "Sinclair BASIC history" article. You may find more complete information there.
Sinclair BASIC is a popular version of the BASIC (Beginner's All purpose Symbolic Instruction Code) programming language. Originally written for the ZX80, it is now available for a wide range of computers in native versions or via emulation. This is the history of its evolution.
In July 1975 Micro-Soft, as it was then called, shipped BASIC (Beginner's All purpose Symbolic Instruction Code) version 2.0 for the MITS Altair 8800 hobbyist computer. This was the first commercial version of the Beginner's All-purpose Symbolic Instruction Code programming language, originally developed by J.G. Kemeny and T.E. Kurtz in 1964 at Dartmouth College in the United States.
By then Kemeny and Kurtz had addressed the main criticisms of BASIC; that it lacked structure and encouraged bad programming habits, but the 4K and 8K versions for the Altair, written by Paul Allen and Bill Gates, were based on the original Dartmouth BASIC.
Microsoft BASIC became so popular that it made Gates and Allen their first fortune and was subsequently supplied with the majority of 8-bit computers. So not surprisingly, when the ANSI Standard for Minimal BASIC (X3.60-1978) was launched, it was based mainly on the Microsoft version.
In May 1979, Clive Sinclair's engineers began work on the machine that would become the ZX80. Sinclair was inspired to create the machine after seeing how much his son enjoyed using a TRS-80 but guessing that many people would be put off buying one because of the high price—just under £500.
Unlike Sinclair's previous foray in to the computer hobbyist market, the MK14, this machine would ship with BASIC, based on the ANSI standard. But the aim was to keep costs down and that precluded paying a licence fee to Microsoft. To this end, Sinclair had already met with John Grant of Nine Tiles in April to discuss the software requirements of the ZX80.
Given the tiny R&D budget, Nine Tiles stood to make hardly any money out of the deal, but the feeling was that the project was exciting and worthwhile, and one the company would benefit from being associated with.
To achieve the launch price of £79.95 in kit-form, RAM was limited to 1K and the integer BASIC had to be crammed into a 4K ROM. Grant wrote the bulk of the ROM between June and July. But the resulting program was 5K in length so Grant spent that August trimming the code.
Grant laid the path for things to come, introducing many unique features of Sinclair BASIC, such as the way it refuses to allow most syntax errors to be entered into the program, instead pointing out where the error is in the line before it is entered, making it much easier to learn and use than any other version of BASIC.
The kit was launched at a computer fair in the first week of February 1980, and while it was not a massive success by comparison with the ZX Spectrum, it turned Sinclair's fortunes around, eventually earning him a knighthood, and it sold well enough to persuade him to make a new computer—the ZX81.
Work on the hardware had begun in September 1979, even before the launch of the ZX80, but it was the development of the uncommitted logic array, or ULA, which allowed the machine to go into production. The ULA, produced by Ferranti for Sinclair, reduced the chip count and brought the retail cost of the machine, in kit-form, down to £49.95.
Again, Nine Tiles was called on to provide the New BASIC, but this time there was 8K to play with. Vickers, who had joined Nine Tiles in January 1980, added the floating-point arithmetic, including trigonometric and other functions.
"As far as Clive was concerned, it wasn't a question of what the machine ought to be able to do, but more what could be crammed into the machine given the component budget he'd set his mind on," said Vickers in an interview on July 23, 1985. "The only firm brief for the '81 was that the '80's math package must be improved."
The ROM was almost complete by the end of autumn 1980, but support still had to be added for the ZX Printer. Somewhere between this time and the launch, a bug crept in which caused the square root of 0.25 to be 1.3591409. Nine Tiles quickly fixed the bug, but Sinclair was somewhat tardy in making this version available to people who had already bought the machine.
Despite this problem, the ZX81 was well received and became a massive success, spawning a series of clones, both illegal and licensed by Timex, which was manufacturing the UK models for Sinclair at its Dundee plant. Inspired by the public reaction to the ZX81, and annoyed at not winning the contract to design a computer for the British Broadcasting Corporation, Sinclair decided the market needed a budget colour computer.
The ZX80 and ZX81 hardware had been the primarily the work of one man; Jim Westwood, but he had been moved to the flat-screen television department, so the hardware design job on the machine which became the ZX Spectrum, was given to Richard Altwasser, while at Nine Tiles, Vickers was again asked to provide the BASIC.
What started out as an expansion of the ZX81 BASIC soon turned into a large 16K program. Sinclair wanted as few changes to the ZX81 code as possible but at Nine Tiles the feeling was that software designed for a machine with 1K was inappropriate for a machine with 16K and that problems would occur later on. They were right.
"Certainly with the Spectrum we wanted to rewrite the code, but there wasn't the time and there definitely weren't the resources," said Grant in an interview on September 8, 1985. "At every point [in the development of the ZX range] Clive wanted the maximum new facilities for the minimum money."
After the best part of a year's work the BASIC was almost finished. While it was greatly enhanced, it was also depressingly slow, but more problems were to follow. The main problem was providing support for the planned peripherals because no working prototypes were available to Vickers until near the end of 1981. But then, in February 1982 Nine Tiles began to have financial disagreements with Sinclair over royalties which it became apparent would not be forthcoming.
To make matters worse, Vickers and Altwasser both handed in their resignations in order to form their own company, Cantab, which went on to produce the Jupiter Ace, essentially a ZX80 with the Forth language built-in in place of BASIC. The result of the delays these problems caused was that when Sinclair launched the machine, it did so with an incomplete ROM. Nine Tiles continued working on the ROM for three months after the launch in April 1982, but by then too many units had been sold and the program was never finished.
The original plan was to issue only a limited number of Spectrums with the incomplete ROM and provide an upgrade, much in the way the bug in the ZX81 ROM had been handled, except that by the time Sinclair got its act together, around 75,000 units had been sold and the plan became unworkable. This is the reason why the Microdrive commands don't work in the standard ROM, and hence led to the development by Ian Logan of the shadow ROM in the Interface 1 in order to handle peripherals which should have been supported directly by BASIC.
Those who are interested in what the finished ROM might have looked like should visit Geoff Wearmouth's website at http://www.wearmouth.demon.co.uk/, where you can download the latest version of his Sea Change ROM, complete with source code. Wearmouth's version of Sinclair BASIC cunningly includes RS232 and network support in the main ROM, although sadly it is incompatible with the majority of commercial Spectrum software.
Various 'enhancements' were made to the BASIC over the years, including the extra syntax of the shadow ROM introduced with the Sinclair Interface I, and in the United States in 1983 when an attempt was made to overhaul the BASIC by Timex when it launched its TS2068. But again, the version of the ROM launched with the machine was incomplete, and the TS2068 was unable to run the majority of Spectrum software because of hard-coded calls to locations in the ROM which were different in the Spectrum.
In 1985, in a joint venture with its Spanish distributor Investronica, Sinclair launched the Spectrum 128, codenamed Derby, with a new editor bolted on to the original BASIC. This was slightly more compatible than the Timex effort but the editor was bug ridden, and some software refused to work, even in 48 mode, because the empty space at the end of the original ROM, used as a table by some programs, was now overwritten with extra code.
It did introduce some useful new commands and a built-in text editor, although inexplicably these were replaced with a menu system with less functionality in the English version of the machine launched the following year. However, criticism of the 128 Editor must be put in context. The programmers were relying on the Logan & O'Hara disassembly of the original ROM published by Melbourne House, since if Sinclair ever had a copy of the original source by now it had been lost, and were working on a DEC VAX-11/780 machine running CP/M on an expansion card.
Fortunately, tracing the development of the 128 Editor is made easier by the fact that the initials of programmers are stored at the beginning of the Spanish ROM and (MB, KM, and AT) at the end of the English ROM (Martin Brennan, Steve Berry, Andrew Cummins, Rupert Goodwins and Kevin Males).
According to Rupert Goodwins, editor of the +2 manual and the person responsible for the Spectrum logo on the menu system, the Sinclair programmers didn't realise that the unused bytes in the original ROM were being used as a table by games programmers. "The TV test screen and other ancillary code was in there for production testing," he said. "As Spectrums came off the production line, they got checked and set up for keyboard, tape, ports, colour, and sound." He recalls there being an Interface 2-style cartridge system at one point but that most of the test code ended up in the ROM. "We had the space and it's obviously cheaper and more efficient that way."
There were also some strange features planned for the 128 which were removed before production as they couldn't be made to work properly. "There were certainly plans to do more with the keypad—what a bizarre idea that was," he said. "It was originally supposed to have been a mouse as well—can you imagine!"
Kevin Males worked on both versions of the 128 Editor ROM. "I wrote the music string interpreter for the 128, plus various other bits and pieces that never made it into the ROM," he said. "I also did a lot of work on Microdrives, but its a long time since I wrote any Z80 code though!" He may also be the author of the text editor in the original Spanish Editor. "I recall working on various text editors for the 128 that didn't make it into the ROM," he said.
In addition, he worked on automated test and diagnostic software for both Spectrum & QL Microdrives. He was also involved in the notorious Loki project. "Towards the end I started looking at software to control a proposed digital synth for the new games machine but the company was sold before that could be realised."
Martin Brennan, who worked on no-end of projects at Sinclair, wrote the editor with contributions from Steve Berry, and Andrew Cummins probably wrote the tricky number handling code.
Amazingly, Sinclair never owned the rights to the ROM. Amstrad had to acquire them separately from Nine Tiles in 1986 when it bought out Sinclair. When Spectrum clones began appearing back in late 1984, Sinclair Research boss Nigel Searle found he was powerless to do anything about it because the only really unique part of the Spectrum was the ROM and in the disagreements following the Spectrum's launch, Sinclair had failed to acquire the rights, for which it had originally offered Grant £5,000. By now the Spectrum had sold more than 2.5 million units.
In fact Amstrad only obtained the rights to the Spectrum and the QL, which they sold on. Nine Tiles Networks retains the rights to the ZX80 and ZX81 ROMs, and Sinclair retains the rights to the Interface 1 ROM. In fact, the developers of the SAM Coupé, a powerful Z80 based machine with a Sinclair compatible BASIC, approached Nine Tiles with a view to licensing the floating-point routines from the ZX81 ROM. However, at the time the asking price was too high.
Towards the end of 1986, when Amstrad wanted to create a Spectrum with a built in disk drive, it simply took the DOS from its PCW machine and patched the 128 editor to provide simple disk access. In fairness, the DOS, written by Cliff Lawson, was a very good one, although its full power remained untapped by +3 Basic. Unfortunately none of the bugs were fixed in the first version of the +3 and new ones were introduced, but perhaps this is understandable as there was little documentation at the Sinclair Computers division and development had moved from a VAX running CP/M to a room full of PCWs running CP/M which was less than ideal.
Amstrad stopped selling the last Spectrum model, the +2B, in the early 1990s. For a time it looked as if the SAM Coupé might offer an upgrade path to Sinclair BASIC users, but after two false starts the machine disappeared into obscurity.
However, with the advent of emulation (made possible because Amstrad has kindly given permission for the distribution of its copyrighted material for use with emulators although it retains that copyright) there has been a renaissance in Sinclair BASIC programming.
This has been aided greatly by Paul Dunn's development of a Sinclair BASIC integrated development environment: BASin. As well as providing a superb editor, it includes the entire contents of the original Spectrum BASIC manual, the Spectrum + manual and the relevant parts of the Spectrum 128 manual as online help. Although BASin is developed only for the Microsoft Windows platform, it is open source so in theory it could be ported to other machines. However, it is compatible with Wine, the Windows application layer for Unix-like operating systems, and so in practice it can be used with most machines.
For more information about Sinclair and the actual hardware the five-part article 'Sinclair and the "Sunrise" Technology' by Ian Adamson and Richard Kennedy, available on Planet Sinclair at makes excellent reading.
This article is a further revision of an article first published on the World of Spectrum website that subsequently appeared in AlchNews & Z88 User issue 38. It is contributed to this wiki with the full permission of the original author.
Sinclair BASIC Interpreters
- Integer BASIC by John Grant — 4K integer version for ZX80
- Floating point added by Steve Vickers — 8K version for ZX81
- Colour and more peripherals added by Steve Vickers and John Grant — unfinished 16K version for ZX Spectrum
- Sea Change ROM by Steve Vickers and Ian Logan — finished version for ZX Spectrum, modified by Geoff Wearmouth
- ROMU6 by Cesar and Juan Hernandez — MSX version
- Spectrum 48 by Whitby Computers — Commodore 64 version
- Sinbas by Pavel Napravnik — MS-DOS version
- Basic by Philip Kendall — Unix version
- BASin by Paul Dunn — Windows version
- SpecBAS by Paul Dunn — Windows, Linux, Pandora and Raspberry Pi versions