Basic Instinct: How We Used To Code
Friday 27th April, 2012
I’ve recently caught myself, like some horrific solo re-write of the Monty Python Four Yorkshiremen sketch, waxing lyrical to my two iPod-wielding young’uns about the good old days; when men were men, computers were effectively clockwork, and computer games… well, come to think about it, they still cost about 69p. But you didn’t download them from an app store. Oh no. They came bound into computer magazines and had to be typed in by hand. And oh yes, they were in an arcane language called Basic.
1980: that last year of primary school when I was shown my first computer, a Sinclair ZX80. Sixth-formers from the local comp were there to test our reaction times using a necessarily simple program they’d written. Themselves. Wow. Heady stuff. Only four kiddiewinks were allowed in at a time, and even then we were only allowed to touch one key on the bizarrely colourful, flat keyboard. But it was a computer! Just like on Tomorrow’s World!
Fast-forward a year: home computing hit the big time. At senior school, various tribes formed round newly-acquired weapons of choice: parentally-purchased ZX81s and Vic-20s, with a smattering of TRS-80 (dads in technical jobs) and the occasional Commodore Pet (dads managing the dads in technical jobs).
Oh, and that one guy whose dad was an electronics engineer who owned a 64K SuperBrain that came with a built-in green screen and something called a database. Actually it was my Nanna who bought me that 1KB ZX81, and my sister the small B&W rotary dial TV to run it on. You can imagine the bargaining that ensued…
Pretty much every home computer in the early 1980s came with a Basic interpreter as standard. The exception? The Jupiter Ace running Forth in 4KB. Weird, but fun.
However you stored your programs - cassette, Microdrive or pages ripped out of Your Computer - even the most disinterested luddite almost certainly started their games with a variation of
RUN, the programming equivalent of mono-linguists strangling ‘dos cervezas, por favor’.
Even when the program was a machine-coded version of Space Invaders shoehorned into 1KB, you invoked it by typing this arcane Basic on an actual keyboard.
It didn’t take a mammoth chunk of Basic code to fill that paltry 1KB of memory - ah, how we pined for the wide open spaces of a 16KB Ram Pack - but only having a single kilobyte meant that any viable program you found could pretty much be copied blindly, assuming the faultless coding of the author (ahem).
And thanks to the ZX81’s and later Speccy’s per-keyword command entry, debugging was just a simple matter of your mate reading the code v-e-r-y s-l-o-w-l-y as you moved your finger across the screen checking what you’d written. Understanding was there none. And if that failed, and if you were lucky, you saved your masterpiece-in-progress to tape, to fix next time he was allowed over to play. Heaven help the numpty who jogged the power cable.
PEEK and POKE, PLOT and PRINT
This was the hobbyist era. Computer Fairs, mostly in central London, were chock-full of trestle-tabled one-man bands selling hardware expansions, peripherals, printers and a plethora games that were entirely, or at least mostly, written in Basic.
Tribal identities require criteria with which to set groups apart: games availability was the certainly the main one, as were screen colour resolution and external hardware. But once you got past the Kempston joysticks and 1540 Floppy Drives, the real differentiator was which Basic dialect you used.
Yes, there were standards. But Andrew Tannenbaum had it right: “The nice thing about standards is that you have so many to choose from.”
Some dialects (notably Sinclair Basic) omitted elementary things such as the
ELSE operator. Most included direct memory manipulation methods (
POKE), or screen display (
CIRCLE). Some more advanced variations had rudimentary procedure calls with parameters (
PROC on the BBC), structured looping (
REPEAT) and some, no, really, had error handling (
Was there no end to the lunacy? Clearly, no. Some versions of BBC Basic had procedure libraries (
INSTALL) and - wait for it - even allowed for inline 6502 assembler mnemonics.
And if you weren’t happy with the Basic that shipped with your machine, then third-party suppliers were there to help. Even the Spectrum had YS MegaBasic that let you type commands in full, and offered fonts and sprites. If you really wanted that touch of the exotic, ports of BBC Basic still exist for it and other machines from the same era.
But there was an alternative to the Babel of Basic.
At school there was a real live ASR-33 teletype upon which you could enter your programs, store them on paper tape and then run them on the mainframe - at Imperial College after the BT cheap rate kicked in, via telephone line and acoustic coupler. This was an IMMENSE PRIVILEGE.
To prove your worth, you had to submit a pencil-written program to the Prefect in charge, who checked it, at which point you could you put them onto tape. Rumours were rife that some of the six-formers actually played Star Trek over the phone line. There was a reason for this.
And in order to learn to write your own code, you needed to read (in dread caps) THE BOOKS. There were just the two books: Basic Computer Games by David Ahl, probably the source (ahem) of the Star Trek game, and Illustrating Basic by Donald Alcock. Both were great books of their time, ie. pre-desktop publishing.
Programming for all
I bought my copy of the Ahl book from a bookshop in Ottowa, a memorable event mainly because computer books, and more importantly books on Basic, hadn’t made it across the pond at that point. It was a collected set of listings from his Creative Computing columns, hand illustrated with Wall E-precursor cutesie robots, and it had the look of something assembled from actual printouts.
The Alcock book went one stage further: a spiral-bound tome, entirely hand-written with hand-drawn illustrations, arranged in double-page spreads.
Both books made a point of acknowledging that to produce a single book on Basic, first meant trying to find common language constructs in order to make their coding ‘portable’. In his introduction, Alcock admits to having 11 Basic manuals to hand when writing his book, and this was certainly not exhaustive.
Indeed, this seems a tiny number, given that there are more than 300 documented variants of the language still kicking around, with a version of Basic for literally every letter of the alphabet. Documenting a ‘portable’ Basic was quite a challenge.
Alcock himself released a proprietary re-write of his book, Illustrating BBC Basic, which was aimed at the burgeoning UK schools market, for a machine whose Basic dialect included those exotic
PROCs with passed parameters and OS-specific system calls. If they learned nothing else, developers who growing up in this era learned to fear forking.
It’s a common belief that it was the death of the 1980s hobbyist scene, due to cheaper games consoles initially and online gaming latterly, that caused the clear and marked decline in prospective IT undergraduates and employees. But, I suspect, for me, and other forty-something geeks, it wasn’t just the games.
Admittedly Basic is not a great language: yes, it led to the evils of VB, and yes Dijkstra’s view of it as a threat to good coding perhaps can be taken as read. But whilst ‘Move the Turtle’ may be great for my seven-year-old iPod wielder, and the Lego-like Scratch environment looks great for ten-year-olds, I worry that the joys and frustrations I remember at 11 - manipulating letters on screen, and structure in my head - are not going to be catered for by drag and drop, spoon-fed Logo and Scratch.
You see there were other cheap thrills to be had with a C64, BBC B, Dragon 32 or ZX Spectrum, that weren’t available on those whizzy games console that don’t ship with Basic, a language that 11-year-old school kids could actually write code in: that excitement of seeing how the game in the latest computer mag worked, coming up with a new version, and saying “I did that”.
That’s what sparked my interest. Maybe there is no skool like the old skool. Or perhaps I should just embrace my old-fart-hood.
(First published on The Register)