S I N C L A I R   B A S I C

[ Introduction | History | Interpreters | Extended BASIC | License | Manuals | Source | Downloads ]

Sinclair BASIC is copyright ©1980-81 Nine Tiles Networks Ltd.
Sinclair Extended BASIC is copyright ©1982-1987 Amstrad PLC.
Site content copyright ©2002, ©2004 Andrew Owen.


T H E   H I S T O R Y   O F   S I N C L A I R   B A S I C

By Andrew Owen

SINCLAIR BASIC needs no introduction to enthusiasts of the little rubber-keyed machine but its evolution is stranger than you might think.

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 encourage 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.

According to Cambridge mathematician Steven Vickers, who wrote the subsequent versions of Sinclair BASIC: "The ZX80 integer BASIC, written by John Grant, was in Z80 assembly code pure and simple, though it did use the usual stack based techniques for interpreting expressions."

The lack of support for floating-point numbers, overshadows Grant's achievement. He 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, wrote the BASIC more or less from scratch, only using some of the ZX80 code, making numerous improvements while managing to maintain backwards compatibility with the ZX80 hardware.

"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 ZX82, 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 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 publised by Melbourne House, since in all probablility Sinclair never had a copy of the original source, and were working on a network of VAXen running CP/M.

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).

I was able to contact most of the team by email a few years ago. They were all very polite and helpful, particularly in guessing what the other initials stood for. Many of them even got in touch with each other again after not having seen each other since their Sinclair days. Unfortunately I was too late to contact Ben Cheese, responsible for much of the 128 hardware, who had died shortly before I began my investigations. It is sad to think that his passing went virtually unrecorded.

I guessed that RG stood for Rupert Goodwins, author of the new parts of the +2 manual, and he was my first point of contact. Among other things, he was responsible for the Spectrum logo on the menu system. We talked via email at great length and he gave me an insight into the world of Sinclair circa 1985.

It transpires that the programmers didn't realise 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 was next on the list. "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 (who I was unable to contact), and Andrew Cummins probably wrote the tricky number handling code. They were both very helpful but couldn't remember a great deal about working on the project. Rupert Goodwins was one of the few who remained at Sinclair after it was bought out by Amstrad.

Amazingly, Sinclair never owned the rights to the ROM. Amstrad had to acquire them seperately 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.

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 ofthe +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 network 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 +2A, in the early 1990s. For a time it looked as if the SAM Coupe, a powerful Z80 based machine with a Sinclair compatible BASIC, might offer an upgrade path to Sinclair BASIC users, but after two false starts the machine disappeared into obscurity. Of course, the story doesn't end there, because even before the last Spectrum was sold people were writing emulators. With the advent of the Internet, increasing numbers of people began to rediscover the computer of their childhood.

As a result, programs are still being written in Sinclair BASIC and the language is still being developed. Admittedly, most of the new programs take the form of entries in the annual Crap Games Competition run by contributors to the usenet newsgroup comp.sys.sinclair, but some people are still writing proper games and applications for fellow enthusiasts because, above all, it's fun.

If you want to program in Sinclair BASIC the most common choice will be a Spectrum emulator. It is legal to use Spectrum emulators because Amstrad has kindly given permission for the distribution of its copyrighted material for use with emulators although it retains that copyright. But there are also native interpretters available for the Commodoree 64, MSX, IBM PC compatibles, and Unix.

There are also a vast number of unofficial versions of Sinclair BASIC, written by individuals to suit their own needs. Although most are available on-line, many do not comply with the provisos under which Amstrad grants distribution. Fortunately the emulation community came up with a solution to this in the form of .IPS files - patches that can be applied to a legitimately obtained ROM file.

Finally there is a new project to bring Sinclair BASIC up to date. Dubbed Sinclair Extended BASIC, or SE Basic, this project is an extension of the BASIC provided on the Spectrum. The project has been in development in one form or another since 1996, but it has recently reached a major milestone with the removal of all the bugs from the original ROM. Unfortunately it has introduced one or two new bugs, but it is still in the beta stage of development. Eventually the authors of the project hope it will provide a universal base for expansion of the ZX Spectrum hardware, and compatibility across the range.

Copyright ©2002 Andrew Owen.

The author asserts his moral right under to be identified as the sole author of this work.

This article is revised from the version published in AlchNews & Z88 User issue 38. That version was based on an earlier article published on this website.

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.

[Mail] [Index]