Developer diaries

New to Spectrum Arcade: Sir Clive's Box of Bits

Our new 48K and 128K platformer is a tribute to Sir Clive Sinclair: 12 rooms, 24 bits to find for the box. Here's how we made it.

There's a new cabinet in the Spectrum Arcade, and this one is personal. Sir Clive's Box of Bits is a flip-screen platformer for the ZX Spectrum 48K and 128K, made as a tribute to Sir Clive Sinclair, the inventor whose company gave us the machine. It's out now. You can play it in your browser in Specz, our emulator, or load the tape on a real Spectrum.

Sir Clive needs to fill a box. Somewhere in the 12 rooms of his building are the 24 bits that belong in it: the eight things that came in the box with a 48K, eight add-ons people plugged into it, and eight issues of CRASH magazine. Below, we explain where the idea came from, the choices we made, how we built and tested it, and how to fill the box yourself. To start, press Play on the cabinet, or open it straight in Specz at spectrumarcade.com/arcade/play.html#box.

The idea

The brief came from the owner of this site: a game about the man behind the Spectrum, where you collect everything that went with it. Sir Clive Sinclair was born on 30 July 1940 and died on 16 September 2021, aged 81. The title screen says "In memory of Sir Clive Sinclair, 1940-2021", and Sir Clive strolls along the bottom of it while you read.

A collecting game asked for a platformer, and a platformer about the Spectrum asked for the kind the Spectrum made famous. If you've played Manic Miner or Jet Set Willy, you'll know the shape at once: rooms that fill the screen, a hero who jumps in fixed arcs, platforms you can jump up through, nasties that patrol the same path for ever, and objects that twinkle until you grab them. Box of Bits borrows that way of playing. Its rooms, its hero, its enemies, its graphics, its font and its music are all our own.

The things to find are real. When you unpacked a new Spectrum you found an introduction booklet and a thicker BASIC programming manual, and new machines came with Horizons, a starter tape from Psion with lessons on one side and short programs on the other. Add the computer, the power supply and the leads for the TV and the tape recorder, plus the box itself, and you have the first eight bits. The add-ons are the printers, interfaces, Microdrives and joysticks that grew up around the machine. The magazines are CRASH, which Newsfield launched from Ludlow in February 1984 and which covered nothing but the Spectrum.

Designing it

Before writing any code we asked a short set of questions. The answers shaped everything else.

  • Genre. A flip-screen platformer, in the Manic Miner and Jet Set Willy mould.
  • The hero. Sir Clive by name, drawn as a tribute: bald, glasses, beard. There are no Sinclair logos or trademark artwork anywhere in the game.
  • The magazines. Named CRASH in the text, drawn as an original little magazine rather than a copy of any real cover. Each issue is "all about" a famous Spectrum game, from Manic Miner to Head Over Heels.
  • Machines and controls. Both machines, with the same controls as our other recent games: O and P to walk, Space or Q to jump, keys you can redefine, the cursor keys and a Kempston joystick.
  • Difficulty. Classic, with about a dozen rooms and three lives.
  • Extras. A loading screen, a high score kept between games, hazards and enemies, and a checklist of what you've found.

The checklist was the extra we liked most. Press ENTER at any time and the game freezes behind a list of all 24 bits, each with a green tick or an empty box, plus how many you've found and how many lives you have left. With 24 things spread over 12 rooms, being able to see what's missing saves a lot of wandering.

The other big choice was how the building fits together. It's 4 rooms wide and 3 floors high. Doorways at floor level lead left and right. A gap in a ceiling over a high platform lets you jump up into the room above, where you land on its floor. A hole in a floor drops you into the room below. Every way up has a way back down, so you're never stuck on one floor.

Floor Rooms, left to right
Top Boffin's Attic, Calculator Corner, The Printing Room, Press Office
Middle Soldering Bench, ULA Foundry, Rubber Key Mine, Microdrive Loop
Ground The Workshop (where you start), Tape Deck Towers, C5 Test Track, Launch Party

Building it

Box of Bits is written in Z80 assembly language, built with the sjasmplus assembler, and needs no Sinclair ROM routines. That means Specz can start it straight away without a ROM, which is how every game in the arcade launches. The code and data take about 12.7 KB, so it fits comfortably in a 48K, and the whole tape with its loading screen is under 20 KB.

We did something new this time. Before writing a line of Z80, we wrote the movement rules as a small JavaScript program: how far Sir Clive walks in a frame, how high a jump goes, how fast he falls, what holds him up and what stops him. A checker then used those rules to try every position, jump and fall in all 12 rooms, more than 229,000 of them. It confirmed that every room, doorway and bit can be reached from the start, and that there's nowhere Sir Clive can get stuck for good. The Z80 code follows the same rules step for step, and our tests compare the two every frame.

The jump is a fixed table, as in the classic platformers. Sir Clive rises 25 pixels, about three character cells, over 12 frames, then falls faster and faster up to 4 pixels a frame. Once he leaves the ground he can't change direction, so every jump is a decision. He walks 2 pixels a frame, and the game runs at the Spectrum's full 50 frames a second.

The rooms are drawn as text in a Python script, one character per cell: a dot for empty space, an equals sign for a platform, a hash for a wall, a caret for nails or solder. The script packs them down to about 1.4 KB for all 12 rooms. The graphics are drawn the same way, as rows of dots and hashes: the font, the room tiles, Sir Clive's four walking frames, the six enemies and the 17 item icons. The eight CRASH issues share one icon.

Spectrum colour works in 8 by 8 cells, two colours each, which is what causes attribute clash. We kept the backgrounds black and only colour a sprite's cells where the room is empty, so Sir Clive never turns a platform white as he walks past. Each sprite is drawn by flipping pixels, and is drawn in its new place before being wiped from the old one, so nothing blinks.

The sound follows our usual split. On a 48K the beeper plays the jump, pickup and lost-life effects, and an original title tune played one short chunk per frame so the title screen keeps moving. On a 128K the AY chip plays the same tune on the title, then an in-game song that changes key and beat with the floor you're on: quick and bright at the top, driving in the middle, rocking on the ground floor. Our article on beeper and AY music explains the difference.

Testing it

A computer player tested every build. It plans the quickest route to the nearest bit using the same movement rules, and in rooms with enemies it plans its way through frame by frame, because every enemy follows a fixed path at a fixed speed. It loaded the tape through the real 48K and 128K Spectrum loaders and found all 24 bits on both machines without losing a life, in about 76 seconds of play. You'll take rather longer.

Testing found real bugs. These are the ones worth telling.

  • The teleport. At the very top of a jump the table says to rise 0 pixels. A loop that should have run no times ran 256 times instead, and Sir Clive shot off the top of the room. A test with random key presses caught it at once.
  • The doomed respawn. Losing a life put Sir Clive back exactly as he entered the room, including his sideways drift. If he'd jumped in diagonally towards some nails, he did it again, and again, until the game was over. Now he comes back without the drift, and the checker tests that every way into every room can be survived.
  • Enemies by the door. That same check found five rooms where an enemy patrolled right where you arrive. We moved them all.
  • The busy frames. In rooms with three enemies, one frame in five took longer than a fiftieth of a second, which would have made the game stutter. We rewrote the sprite drawing, skipped sprites that hadn't changed, and only recoloured cells when a sprite moved to new ones. Now the only slow frames are the ones where you pick something up and its message is printed.

One more change came from looking at the screenshots rather than the numbers. The first enemy for Tape Deck Towers was a walking cassette, and it looked far too much like the Horizons tape you're meant to collect. It became a spinning tape reel instead.

How to play

Walk with O and P and jump with Space or Q. The cursor keys, a Kempston joystick and the on-screen pad on a phone all work too, and R on the title screen lets you choose your own keys. Line up each jump before you press, because the direction is fixed when you take off. If neither left nor right is held, you jump straight up.

Platforms hold you from above only, so you can jump up through them from underneath. Walls stop you from every side. Nails, bubbling solder and live wires cost a life, and so does touching an enemy: runaway C5s, beetles, flying calculators, walking rubber keys, spinning tape reels and electrical sparks. Lose a life and Sir Clive comes back where he came into the room. You have three.

What Points
A bit from the box (yellow) 100
An add-on (cyan) 200
A CRASH issue (magenta) 300
A room you reach for the first time 50
Finding all 24 5,000, plus 1,000 for each life left

Your best score is kept between games, and the Spectrum Arcade saves it in your browser. A few tips from our own games:

  • Watch a patrol first. Every enemy walks the same path at the same speed. Count its trip, then go when it turns away.
  • Climb with straight jumps. Most platforms are three cells above the last one, and a straight jump up lands on them.
  • Grab from below. Some bits sit just above a platform you can't reach. Try jumping up underneath them.
  • Use the checklist. ENTER shows what you've still got to find, and pauses the game while you think.

Where to play it

Sir Clive's Box of Bits is in the Spectrum Arcade now, on its own cabinet with a preview and a sound clip, and its game page has the controls and the scoring in one place. It runs in Specz on a 48K or a 128K; tap 48K on the emulator's toolbar to switch machines and hear the AY music. If you'd like to know more about the machine Sir Clive's company made, our history of the ZX Spectrum is a good place to start, and our piece on the day the ZX Spectrum launched tells the story of 23 April 1982. For the last game we added, read New to Spectrum Arcade: Reef Raid.

More from the journal

Developer diaries ·

New to Spectrum Arcade: Gold Top Grand Prix

Race Dot Dawson's milk float against three rival milkies round eight circuits of Pennyford at dawn, and spend your gold tops at the Dairy Depot. Here's how we made it.

New games and guides, straight to your inbox

Hear first when a new Spectrum game lands in the arcade. No spam, and you can unsubscribe whenever you like.