Firmware
Hardware and software, we all know about. One means wires and silicon chips, the other means word-processors and shoot-em-ups.
The CPC was an instant success because it did both well. The hardware was competent and well-designed - plenty of colours for the time, respectable sound, ran quite fast and didn't break down - and, at launch, it had more software than many competing systems.
Contents
Meet Johnny
Both of those would draw Johnny's dad into Dixons to buy this pleasant-looking new computer from the man who made your stereo. The keen price - £299 all in for a computer, colour monitor, tape deck and 12 games - clinched the sale. Little Johnny henceforth embarked on a stiff Mastertronic habit that meant his entire weekly pocket money was spent on one game and a chewy cola bottle. And that's why the CPC succeeded.
Neither Johnny nor his dad had ever heard of the CPC's excellent firmware. Indeed, the name itself is a bit daft. What next? Slightly soggy ware? Squidgyware? But in its way, this final component of the CPC trinity was just as important in the success of the machine.
The Firm
Firmware means hard software, I suppose. In the CPC's case, it's the software that's embedded permanently into the computer, as opposed to the software you load from tape or disc. That's the operating system, plus BASIC, plus (on disc-based machines) AMSDOS. All three were written by a Dorking-based software house called Locomotive Software.
We've already covered BASIC. Quite rightly, Locomotive BASIC is recognised as a model of its type, a remarkably flexible language with fewer obscure nooks and crannies to confuse the beginner than (say) the revered BBC BASIC.
But for 19 years, the public has largely ignored the existence of the CPC operating system. The first reviews of the 464 praised its powerful BASIC, with commands like WINDOW (write in different areas of the screen easily), EVERY and AFTER (perform repetitive tasks at regular intervals), and a comprehensive set of PLOTs, DRAWs and MOVEs.
In a way, the reviewers missed the point. None of these are really BASIC's doing. All the work is done by the operating system.
Join the dots
Let's say you want to plot a point on the screen, halfway across and halfway up. The BASIC command is PLOT 320,200 - go on, have a go. Dead simple.
But it's not BASIC that's actually putting the dot there. BASIC thinks "hmmm, what have we got here? PLOT - I know that, it means draw a dot - at 320 across and 200 down". Followed by a quick order: "Oy! Operating system! Draw me a dot at 320 across and 200 up!"
The operating system does the rest. It figures out where 320 across and 200 up actually is. It remembers what colour you're using at the moment, and makes sure the dot appears in the right colour. It knows that it needs to act differently depending on whether we're in MODE 0, MODE 1 or MODE 2. And it does all of this in a matter of milliseconds.
That's why the CPC was launched with a couple of decent games, word-processors, databases and the like. The programmers didn't have to discover every intricacy of the CPC's hardware before they could start coding. Instead, they just got the firmware to do all the work. For example, that's why most serious software and many games retain the same, elegant font that greets you when you switch on the CPC - because it's built into the firmware.
Font of all knowledge
This next bit is going to seem rather obvious. It isn't.Amstrad scored a palpable hit by writing a book telling programmers how to use the firmware. It said, for example, that if you want to turn the colours back to blue-and-yellow, you type CALL &BC02. If you want to wait for a keypress, you type CALL &BB18. (Both of these work. Try them.)
You might think this is a given. After all, you couldn't really expect people to guess these obscure addresses. But several computer companies did, among them Sinclair.
The book was called the Firmware Guide, and you can tell how essential it was by the fact that when it went out of print – late ’80s, I think – practically every other issue of Amstrad Action would carry a letter begging for information on where to get a copy. It's also known by its Amstrad catalogue number, SOFT 968, though there was an earlier version (SOFT 158) which just detailed the features of the 464. The firmware was substantially expanded with the advent of the 664, and a couple of minor improvements were made for the 6128.
Measure for measure
The operating system took up 16k of memory - one ROM chip. BASIC took up another 16k chip. AMSDOS takes up 8k (the spare memory in its chip is taken up either by CP/M, Logo or by ParaDOS). So we have 40k of firmware in total: as big as most games, and a lot bigger than the 16k of Protext.
Discounting BASIC, this is 24k of ready-written code that the machine code programmer can use. Why's this such a big deal?
Back in 1984, the "my computer is better than your computer" debate had moved on slightly from the initial "mine's got more RAM" to the more rational "mine's got more usable RAM". Basically, this was because Spectrum owners were trying to get one up on the Commodore 64 users. The Commodore had, yes, 64k, while even the top-of-the-range Spectrum only had 48k. But Spectrum owners soon twigged that almost all their memory - 40k - was available for use by the programmer, whereas the Commodore 64 only let you play with 27k, reserving the rest for its own nefarious purposes.
The CPC gives you 42k free, which is a slight edge over the Spectrum. But that's only half the story. The CPC programmer could call on 16k of firmware routines (24k if they had a disc-endowed model), so didn't have to waste their 42k writing noddy routines to draw lines and overlay multicoloured text. The firmware meant you could do a lot more in the same amount of RAM.
Of course, this is all fine, but try and explain that in a playground fight in 1984 and you'd get beaten up by both the Spectrum users and the C64 owners.
Another great idea
The really cool thing about the CPC's firmware is that you can change it yourself.
Theoretically, you'd think, this shouldn't be possible. Both the operating system and BASIC are stored on ROM chips. You can't change ROM chips, that's what 'Read-Only Memory' means. Ergo you can't change the firmware.
Actually, you can. Because you get at the firmware through RAM.
At &BB18 in RAM (for non-programmers, that's a memory address in hexadecimal), there's a very short piece of code that says 'jump to the firmware routine in ROM that waits for a keypress'. At &BC02, there's an equally short piece of code that says 'jump to the firmware routine in ROM that changes the colours back to blue and yellow'. And so on.
The point is that you always access the firmware this way. You don't go directly to the routine in ROM, which is just as well, as Locomotive moved the ROM around a bit for the 664, again for the 6128, and once more for the Pluses. You go via these 'jumps' in RAM - the complete set of them is called the 'jumpblock' - which stayed in the same place on every single CPC.
And because they're in RAM, you can change them. I'll explain with one of my favourite tricks.
Sometimes you want to load a file from a corrupted disc, and you know that it's pretty much intact, but there are a couple of dodgy bits. Sitting around pressing 'I' for 'Ignore' every time the computer reports a Read Error is very, very boring - you might have to do this 20 times in a row.
So all you do is change the routine at &BB18. Observant readers will remember this usually jumps to the ROM routine that waits for a keypress: and it sends back the letter you pressed, for the Read Error bit of code to act upon. ("Did he press R for retry? Have another go. Did he press C for cancel? Give up." And so on.)
If you change it to your own code, saying "He pressed I, no honest he did" without waiting for you to actually do so, then effectively you've told the computer to press I every time. Which saves a lot of hassle.
(Disclaimer: I can't remember whether it's &BB18 or &BB1E. They're similar but very slightly different.)
There are even more clever applications for this technique. I've seen people use it to do a 30x30 screen (instead of 40x25), for example. There's even a really hacky way in which you can use it to change aspects of almost any program that uses the firmware - this is how S-DOS 2 grafts automatic 360k format detection onto AMSDOS - by checking on what's on the stack, and altering it accordingly. But that's a story for another day.
Real programmers don't use firmware
The firmware isn't a universal panacea. By and large, it's not suitable for fast-moving action, which means arcade games or demos, though can be implemented into simple Text Orientated games from Assembly. But it's a robust, bug-free piece of programming that was a key factor in the CPC's progress.
This article was written by Richard Fairhurst for WACCI issue 141, which was never published.