BASIC for the ZX Spectrum

First appeared in Micro Mart issues 828 & 829 (Dec 2004)

PART ONE

However it was that Sir Clive Sinclair intended the ZX Spectrum to be used at the onset, the reality is that it became best known amongst the masses for gaming. There were other uses that you could put your Spectrum to, of course. Word Processors such as Tasword 2 might not have featured the WYSIWYG interfaces taken for granted today, but they didn't compare too unfavourably with the 'professional' applications of the time. And there were plenty of spreadsheet and database programs around for the Spectrum too.

But the one aspect of owning a Spectrum that can no longer be associated with everyday computer ownership today is programming. With its built-in BASIC, the ease with which the Spectrum could be programmed created something of a revolution in 'bedroom programming' - not just the oft-noted phenomena of a few youngsters creating games to sell to Ocean for the price of a sports car and a Sonny Crockett jacket (if you believe the advert...), but a much wider number of users who, every now and again, just liked to dip their toe in and dabble.

Talking recently about the Spectrum on a BBC documentary, Sinclair - who, legend has it, was inspired to create the ZX80 after seeing the enjoyment his son got from programming a TRS-80 - remarked, "we realised obviously there would be a games aspect, but the first appeal was to people who wanted to get their hands on one and do some programming themselves. Which they loved doing. I mean, children took to that dramatically. And it's a bit sad today that that really isn't available to them."

It was really the first two years or so of the Spectrum's life that can perhaps most accurately be referred to as the 'BASIC era'. Many of Sinclair's early own-brand software titles were written in BASIC; magazines of the period leaned heavily on type-ins; and an endless array of BASIC teachyourselfs jostled for your attention at the bookshop. Although the main focus of Spectrum usage did shift very rapidly to games playing, programming as an essential part of the Spectrum Experience was never entirely lost - Your Sinclair , for example, continued to include its regular 'Program Pitstop' collection of novelty type-ins right up to its 'Big Final Issue' in 1993.

Spectrum BASIC was in fact the third incarnation of
Sinclair BASIC, following versions created for the Sinclair ZX80 and ZX81 computers. All three were developed by a company called Nine Tiles Software - not actually Sinclair at all; John Grant wrote the ZX80's Integer BASIC in a meagre 4K of memory, and Cambridge mathematician Steven Vickers wrote the BASICs for the ZX81 and then the Spectrum (in 8K and 16K respectively).

What made Sinclair BASIC special? Technically speaking, it wasn't the best on offer - its ability to loop was restricted to FOR...NEXT and GOTO, and its handling of sub-routines was even more, well, basic. Where it shone, however, was in its handling of user errors: immediate feedback via in-built syntax routines - which not only rejected incorrectly formatted statements, but also highlighted where the errors were in your code - made Spectrum BASIC very easy to learn through trial and error. And colour and sound were accessed through a small number of conceptually very straightforward commands - INK, PAPER, BRIGHT, etc (compare this, for example, to the complicated system of PEEKs POKEs and CHR$ stuff on the C64 - sorry Shaun) - making graphics and music extremely accessible. Throw in a very readable BASIC programming manual by Vickers and Robin Bradbeer (the typically well-thumbed condition of copies on eBay is testament to the use that this book got put to) and the end result was a system very much orientated towards persuading the beginner there was a great that deal they - they - were able to achieve with it.

To this day programming remains for many a defining aspect of what having a Spectrum was all about, chiefly because Sinclair BASIC was so successful in this persuasion. This, after all, was what BASIC was supposed to be about. It's an important part of the Spectrum's legacy.


PART TWO

You don't have to be a computer programmer today to look back on Sinclair BASIC and appreciate the things it taught you. Getting to grips with BASIC meant getting your head around the business of breaking up problems into their smallest parts and tackling these one-by-one: the applications of that skill are endless.

Sinclair BASIC was not the only version of BASIC for the Spectrum. Presenting itself to the beginner as an open door to the world of programming, it served as the ideal bridge not only to other languages, but also to more sophisticated versions of BASIC which might have appeared more daunting had they been encountered first of all.

Of the many, perhaps the best-known example of this is Beta BASIC by Dr Andrew Wright. Released originally in 1983, Beta BASIC went through quite a number of revisions, version 3 appearing in response to competitor Mega BASIC (published by Your Spectrum/Your Sinclair) and version 4 - the final version, released in 1987 - adding in features for the Spectrum 128. It was loved by the magazines.

Beta BASIC was an extension of - not a replacement to - the original Sinclair BASIC, making it compatible with all BASIC programs written previously for the machine. In total it added something like 100 new commands to the language, including new looping structures and commands, advanced procedure handling, indented listing presentation and much more. The 128 version added further delights such as interrupt-driven sound with its new BEEP! command that enabled music to be played whilst other things were happening in the program - something not possible in plain old Sinclair BASIC, where the action stopped when a tune was played.

Moving forward to the present day, where the nostalgia principle rules, advanced versions of Spectrum BASIC such as Beta BASIC are remembered fondly by only a small number of enthusiasts and attention has largely turned back towards the original. Although in recent years the swelling of the Spectrum community has seen a dramatic increase in the number and variety of Spectrum-related projects being undertaken, interest has not been deflected from Sinclair BASIC programming as a core pleasure. The annual comp.sys.sinclair Crap Games Competition, for example - a celebration of the awful compilation of BASIC games presented in the infamous Cascade Cassette 50 - has run since 1996 and attracts a high number of entries (70 submissions were made in the 2003 competition). It's called the Crap Games Competition, but many of the entries are actually quite good (they get disqualified, naturally); I suspect that the attraction for most is simply the excuse to write something in BASIC again.

Of course in the 21st century we're not quite as tolerant of the BASIC programming process as we used to be. Until quite recently, programs were developed on emulators, where saving your work is the task of a single click (no more saving to a dodgy C15) and built-in keyboard helpers save all that messing about trying to work out how to get the DATA command. But now even this is considered doing it the hard way with the development of BASin (BASIC Interpreter), a dedicated Sinclair BASIC authoring tool for Windows by Paul Dunn that allows you to enter, edit and test your program from the comfort of an extremely advanced suite of tools. The end result is still a Sinclair BASIC program that you can load into a real Spectrum, but the process is a great deal easier.

I can't end without mentioning Sinclair Extended BASIC (SE BASIC). A project of Sinclair BASIC guru Andrew Owen, this piece of work brings us right back to the evolution of Sinclair BASIC and presents itself as the next step in that process. Andrew has researched Spectrum BASIC extremely thoroughly, correcting every single bug and even finding space to squeeze in a few extra commands. This is not an extension to Sinclair BASIC in the sense that Beta BASIC was, but an actual 16K replacement which could be blown onto an EPROM chip and substituted for the original ROM in a real Spectrum. Andrew is working on the latest version right now, so the development of Sinclair BASIC is not over yet.