How I Wrote a Book for the ZX Spectrum

I recently released a book on cassette for the ZX Spectrum. It's fair to say that this is something of an experiment, but it's been a fun one.

The actual story itself has its roots in the brief period when Amazon experimented with partwork releases for the Kindle. It got me thinking about writing something episodic for it, but by the time I'd finished it was clear that Amazon's partwork releases had also been something of an experiment, so I shelved it and focused on my next regularly structured novel.

I thought it would be good to write a bit here about how I ended up releasing it on cassette for an obsolete home computer. It may come as a surprise to learn that neither mental breakdown nor drugs were involved.

At the time I wrote The Gang of Four Ride Again, I was brushing up on object-oriented programming design patterns for professional reasons. There's a famous (famous in software engineering circles anyway) book on the subject called Design Patterns: Elements of Reusable Object-oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. They are known colloquially as the Gang of Four, and it struck me as funny that there are a bunch of other Gang of Fours out there. It's become a lazy shorthand for any group of four people across many different fields. I also thought it would be fun to try to write a short story based on each design pattern in said book. The latter proved to be too ambitious, so I loosely took some of the concepts and applied them to a simulated world in which you, the reader are trapped, helplessly watching another Gang of Four blunder their way through a series of misfortunes.

It was fun to write. The characters are fairly broad and fit into a crime-fighting gang archetype. There's John Steel, de facto leader and slab of beef / family man. There's Stacked Tracey, who is dissatisfied with her role in all this and desperately trying to get her name changed. Then there is the Professor, the dapper gent who is supposed to be the brains of the operation. To this end he is aided by the fourth member of the gang, Zed. Zed is, for reasons unknown, a ZX Spectrum home computer. He can talk but other than that he's just so many rubber keys on a flat black block.

Late last year I decided to publish the book through Amazon, but I also wanted to do something else with it. After some consideration the existence of Zed was too much to deny and I decided it would be very entertaining to release the book on the Spectrum. On cassette.

There were a number of challenges along the way, the chief one being that I'd never written anything on a ZX Spectrum. Back in the day I had a Commodore 64. However I do programme computers for a living and one language is much like another, especially when it comes to BASIC. 

I quickly realised that mere BASIC wasn't going to cut it, but I also didn't want to have to write the thing in assembly language, so I looked to see whether anyone had written a BASIC compiler for the Spectrum. Now, this is where writing for a very old computer that still has enthusiasts worked in my favour. Not only was there a BASIC compiler, there were also many useful tools that made this a much more feasible project.

The first real technical challenge was the size of the book. At ~48,000 words, it's short for a novel but long for the mere 48K of RAM available on a Spectrum. That 48K had to hold the programme that displays the book's contents as well as the book itself. After much calculating and fiddling around it became apparent that it simply wouldn't fit, even with compression. Well, technically it could fit if the whole thing were compressed using something like LZ compression, but then there wouldn't be enough RAM left to decompress it into and it would also take forever.

I settled on token substitution based on a frequency analysis of the words in each chunk of the book. Frustratingly, this was not enough to have each episode of the book be a chunk, so in the end I settled on eight chunks in a trade-off with tape loading time.

All the code for compressing the chunks and mapping tokens was written in Python, mostly by Copilot, which did a decent job and let me focus on the Spectrum end of things. That was written in Boriel BASIC, a strongly typed alternative to Sinclair BASIC which can be compiled before running. It was a pretty good experience and let me write a UI that could decompress the book's chunks on a page-by-page basis quickly enough.

With the book itself functional, I turned my attention to any bells and whistles I could add. The most obvious was a loading screen. For this I used Image Spectrumizer, a brilliant piece of software that lets you take any image, preview how it would look reduced to a Spectrum's resolution and palette, and tweak various parameters until you have it looking how you want. I used the ASCII duck from the paperback's cover as the input and came up with something that looks suitably Spectrumized.

Music was something was something I wasn't sure about. The Spectrum is notorious for producing angry bleeps in the place of anything usually considered music, and getting anything more than some crude beeps was technically daunting. However it turns out I needn't have worried, because once again a stranger on the internet has come through for me, this time in the shape of Beepola. Beepola is an old-fashioned music tracker that outputs via a variety of different methods. It also very conveniently outputs as an addressable block of code so all actually needed to do was load it into memory and call it via a system call in my Boriel code. I knocked up a suitably repetitive tune and selected the most 8-bitty sounding output from the selection. The music only plays on the loading screen once loaded - I thought it would be a bit much while reading.

While I was doing all this, I was using the Spectaculator Spectrum emulator to run the code and check everything was working. It's great, and if you want to read the book on a Spectrum but don't one, I can't recommend this highly enough. The Gang of Four Ride Again is also available as a download for use on an emulator via eBay for a mere £3.

Eventually I was done, and it was time to make a tape and test it on an actual Spectrum. I picked a working one up from eBay (they aren't particularly expensive) and used zxtap2wav to create a .wav file from my compiled code. I burned this to CD and recorded it cassette using an Aiwa AD-F640, which is very much overkill for recording a tape for a Spectrum.

At that point I was almost ready for duplication, but I had also been working on a short piece of musical fluff to fill up some empty space on the B-side of the cassette. This was called Fred Does the Dishes and features samples of the legendary Fred Harris from the BBC2 series Micro Live. I made it using Ableton Lite and it probably shows, but it's fun.

Finally, a friend who runs a record label recommended Band CDs to me for cassette duplication. I designed the inlay card and stickers for the cassette shell based on my paperback cover and ordered 20. I'm very pleased with the way they turned out, and maybe you would be too? They are available to buy on eBay, priced at a reasonable £10 including UK delivery.

 

BUT WAIT! THERE'S ALSO A PAPERBACK

If you prefer the more traditional feel of an actual book, then good news! The Gang of Four Ride Again is also available as a paperback on Amazon, where it costs £9.99 in the UK. It is also available internationally where prices are set by Amazon based on conversion rates:

https://www.amazon.co.uk/Gang-Four-Ride-Again-adventure/dp/B0GQGR9J97/ref=tmm_pap_swatch_0

https://www.amazon.com/Gang-Four-Ride-Again-adventure/dp/B0GQGR9J97/ref=tmm_pap_swatch_0

It is also available as a DRM free  eBook (ePub or PDF) on Amazon for £2.99:

https://www.amazon.co.uk/Gang-Four-Ride-Again-adventure-ebook/dp/B0GQCTLDL5/ref=tmm_kin_swatch_0

https://www.amazon.com/Gang-Four-Ride-Again-adventure-ebook/dp/B0GQCTLDL5/ref=tmm_kin_swatch_0

I hope you enjoy The Gang of Four Ride Again in whichever format you select.


 


Rejecting Rejection

Rejection letters are one of the great staples of the literary narrative, being both a coming-of-age ritual that must be passed, and a continuing endurance, like being forced to retake your driving test.

The famously successful authors offer their tales of rejection as both encouragement to those behind them in the sausage machine, and as a badge of authenticity to show to anyone who doubts that they have paid their dues.

Some flippantly wallpaper their toilets with them, showing not exactly disdain, but placing them more as a ritual to ward off any bad vibes emanating from the ancient dismissals. And they do have power. Every new submission is a wish, and every rejection letter is its denial. They can be devastating. They shouldn't be, of course. That's why people line their loos with the things, putting them in their place with respect to their psyche.

I received one yesterday. It was unexpected, as I'd submitted back in February and assumed that it, like many submissions, wouldn't receive a response. I won't say who it was from. That's unimportant, and furthermore it was a typically courteous and professional reply. It's not you, it broadly said, it's us. I mention it because I didn't take the rejection personally. I could never submit anything if I did. There's so much involved in making a submission in the first place, from finding a prospective agent who is interested in my genre and also accepting submissions, to making sure I follow their guidelines, to actually sending the thing. I can only imagine how much harder it was before email, but then again that might have been a big enough filter to give agents more time to consider everything that crossed their desks. Either way, if I thought too hard about the submission's chances, I probably wouldn't bother at all.

So what do I do with my rejection letters? When I first started this long and so far fruitless road, I used to print them out, inspired by those who have gone to greater things before me. Would I also wallpaper my toilet? Frankly it's arrogant to even contemplate. I stopped printing them or otherwise saving them a long time ago. Now I just make a note of when it was received and move on. But if I was of a mind to do something with them, here are some ideas:

  • Make a book out of them. I would continually update it with its own rejection letters in an act of recursion almost as pointless as that picture of a picture of a picture (and so forth) that appears in the RA Summer Exhibition every year.
  • Turn them into jigsaw puzzles that I sell on Etsy. I anticipate this being more profitable than my books, so I should get cracking with the idea.
  • Make paper aeroplanes out of them and crown the one which flies the furthest the winner. I would then have it framed and sent to the rejecting agent with a book token as a prize.
  • Feed them all to AI and ask it to write a submission letter that will avoid getting any similar rejection letters.
  • Buy a REJECTED stamp so I can reject the rejection letters and post them back to the agents.
  • Turn them into a papier-mâché kidney which I will surgically Cronenberg into myself so I can experience my body rejecting the rejection. This would probably be followed by death, which is in many ways preferable to making any further submissions.
  • Write new stories on the blank side of each rejection letter. Oh god, this is far too positive. I'm so sorry, it won't happen again.


I Have Released a Book on Cassette for the ZX Spectrum

This is not, as I have found myself explaining to incredulous friends recently, a book about the 1980s home computer. Nor is it an audio book. It is a short (appropriately enough, 48K words) adventure told over five episodes. To read the book, it must be loaded into a 48K Spectrum from cassette, just like any other software for the rubber-keyed computing miracle.

The book is called The Gang of Four Ride Again. The Gang of Four are back, and this time they have to defend not just the city but themselves from an existential crisis. In this unique choose-your-own-adventure, you have no choices. You will have to read on helpless as the gang get themselves from one disaster to another. No, really, you won't be able to do anything to help them, so don't get any lofty ideas. Just relax and hope that everyone comes out of this mess the same shape they went in.

The Gang of Four Ride Again can be purchased on cassette for the 48K ZX Spectrum from eBay for £9.99 inc. UK shipping. International shipping is not available at this time.

What's included:

  • A professionally duplicated cassette with printed inlay card and stickers.
  • A bonus audio track, Fred Does the Dishes.
  • A TAP file of the book for use with an emulator, such as Spectaculator.*
  • An ePub of the book because I don't really expect anyone to read the whole thing on the Spectrum.*

(* these will be supplied via a download code)

Here's the eBay link for the cassette: https://www.ebay.com/itm/117058848196

The TAP file and ePub are also available to buy separately if you don't have a Spectrum but would like to see it running in emulation. This costs £2.99, and is also available on eBay: https://www.ebay.com/itm/127706673174

Since this is a simple download, it is available internationally.

Once payment is taken, you will be given a download code via eBay's messaging service. This is a manual process so please allow me up to a day or so to respond.

BUT WAIT! THERE'S ALSO A PAPERBACK

If you prefer the more traditional feel of an actual book, then good news! The Gang of Four Ride Again is also available as a paperback on Amazon, where it costs £9.99 in the UK. It is also available internationally where prices are set by Amazon based on conversion rates:

https://www.amazon.co.uk/Gang-Four-Ride-Again-adventure/dp/B0GQGR9J97/ref=tmm_pap_swatch_0

https://www.amazon.com/Gang-Four-Ride-Again-adventure/dp/B0GQGR9J97/ref=tmm_pap_swatch_0

It is also available as a DRM free  eBook (ePub or PDF) on Amazon for £2.99:

https://www.amazon.co.uk/Gang-Four-Ride-Again-adventure-ebook/dp/B0GQCTLDL5/ref=tmm_kin_swatch_0

https://www.amazon.com/Gang-Four-Ride-Again-adventure-ebook/dp/B0GQCTLDL5/ref=tmm_kin_swatch_0

I hope you enjoy The Gang of Four Ride Again in whichever format you select.


Boiling My Ballards Off

I have often complained about how hot my flat gets in the summer. I do it so frequently that I can't recall whether I've grumbled about it here before, but I have recently had a revelation. You see, my reaction to the blazing fury of the sun has so far been a series of attempts to block it. There have been blackout curtains, blinds and finally Velcroed reflective insulation. The heat is so intense that it destroys the adhesive backing on the Velcro every year. I have also bought a portable air conditioning unit which has definitely improved matters, but at a price. It's not cheap to run, and I now spend summer at home in a blacked-out box. It may as well be winter outside.

Was my trip to Antarctica a couple of years ago an attempt to escape my environment? I don't think so, as it was a dream I'd had since long before I moved into this cursed flat. So no, this wasn't some Ballardian drive implanted by my altered state of existence.

That said, I've been a reader of JG Ballard since I was a teenager, and if his characters striking out into a bewildering new world have taught me anything, it's that I'm doing it all wrong. Fighting the heat is futile. My home is hot, and so heat is my home. Instead of blocking out the sun I should be letting it in. I should take down the insulation and curtains. I should unplug the AC. I could go further and keep the windows closed. Really steep myself in the abundance of energy pouring into my flat, my gift from 93 million miles away.

How could I be so arrogant as to think I could defeat something as old and as vast as the sun? People used to worship it and perhaps they were right to do so. I should be encouraging it. I would replace the Astroturf on my balcony with the reflective insulation removed from the windows to direct more light, more heat, into my flat. With the money saved by not using the AC, I could turn the central heating on.

These are all tantalising possibilities, but if I'm really going the full Ballard, I need to go on a quest. A mission into the unknown that reflects my dramatically changed state of mind. Whatever it is, wherever it is, I should take the tube to get there. One of the really deep lines that brushes past Hell, like the Central or Victoria lines. I should wear my woolliest Antarctic gear while doing it too.

Do you know why the London Underground is so hot? It's because it's mostly tunnelled through clay, and clay retains heat exceedingly well. So well in fact that its temperature is steadily rising year-on-year from the heat generated by the underground network. There, then, is my answer. My quest.

I will travel to the deepest parts of the underground and stake out the stations until I can gain access to some disused room or service tunnel. I will take a pickaxe and a shovel, and hack away at the floor until I have exposed the elemental reservoir of heat that is thick, sticky London clay. And I will keep digging down, getting ever hotter, ever closer to my destination, which is the point at which being too hot transcends mere discomfort and becomes a new way of being alive.

A visionary, in sync with the warming world, I will be existing in a bold future while everyone else struggles with their inevitable defeat. Mired in the past instead of the clay beneath their feet.

I mean, I could do all that, but in some ways it would be easier to sprawl on my sofa while holding a cold can of beer to my forehead.


Things I would believe if I had the world's largest echo chamber

In many ways this blog is the opposite of an echo chamber. An anechoic chamber, with my thoughts forming a series of angular baffles that de...