So, about last year…

Turns out that I’m better at writing code than writing about code. Though that’s not too surprising if I’m honest. Documentation is always a chore and my past low tech attempts at chronicling events can be found in various unfinished diaries.

So to start 2019 with slightly better intentions – and yes, I’m aware it’s already mid February – let’s begin with some details on my latest release for the venerable ZX Spectrum, Your crackers, m’lord!

Towards the end of October last year, R-Tape took his special ceremonial horn off the wall, put it to his lips and let out a clarion call for submissions to the second edition of the Woot! Christmas tape magazine . I had an idea for something to do but couldn’t get it together in time as I was struck down with a chronic bout of level designer’s block. With the December deadline rapidly approaching, I went back to the drawing board.

So what to do in a short amount of time? I still wanted to knock a simple game together. I tend to favour writing puzzle games as they can be easier to implement in a short amount of time – especially if the main mechanic isn’t too complicated. Then, it’s just a matter of going through and adding all the levels.

By chance, I stumbled across a Scratch remake of Kiragames’ ‘Unblock Me’ by griffpatch. The aim of the game is to slide the pieces of wood vertically or horizontally to let you move the red block across the screen to the hole on the right hand side. The red block can only slide horizontally and the others can only slide in the direction they are oriented. It had a small level set, was challenging and the cleanly designed graphics would work well on the Spectrum.

griffpatch’s Scratch remake

Over the first weekend in December, I fired up my trusty text editor alongside with the z88dk C compiler and started work on my conversion. By Sunday afternoon, I had this garish prototype:

Crackers on acid!

It had a frontend (recycled from Thoroughly Modern Willy), 4 levels and the code to display the board – but you couldn’t move any of the crackers around or finish a level. Over the subsequent days, common sense prevailed and I settled on a more sedate set of cracker graphics. I also added the code to select a cracker (using the Spectrum’s BRIGHT attribute as an easy way to implement the selection cursor), move the cracker around the board vertically or horizontally and to detect when the red cracker was at the gap in the board which meant the level was finished.

The finished product.

With the game code sorted I set about playing the levels on the original to obtain the level data for the 28 remaining levels. These were pretty straightforward until the last 2, which had been sourced from a harder level of play. After some head scratching, I had the full level set and the skills to play test all the levels. For each level, I took screenshots of the game’s web page on starting and finishing a level so I could check I’d entered the level data in correctly and knew where I needed the crackers to end up to complete the level.

At this point, the only reference to Christmas was the cracker graphics. When you pull a cracker at Christmas, aside from the coloured paper crown you usually end up with a gift of dubious quality – usually a tiny notepad, some impossible joined metal loop puzzle or a red plastic fish with ‘psychic’ powers – and a piece of paper with a poor quality Christmas joke printed on it. I decided to source 32 cracker jokes, one for each level to display on completing a level. Fortunately the internet had my back with various web sites compiling lists of the best worst Christmas cracker jokes.

The main constraint for using a joke was whether I could fit the question and answer parts of the joke on one line. This proved challenging with an 8 x 8 pixel font, so I used Einar Saukas’ fzx font system support in z88dk to use a variable width font which let me squeeze more characters on to the line.

Just one of the 32 pieces of comedy gold strewn between the levels.

The name ‘Your crackers, m’lord’ comes from a sketch by the Two Ronnies (a popular UK comedy double act from the 1970s and 80s whose Christmas show was a big telly event back then). The sketch is in a similar vane to the classic ‘Fork handles / Four candles’ where the property of certain English phrases sounding identical to each other but meaning vastly different things is used to comic effect. In this case, the butler whilst serving courses of a meal to an aristocratic couple is saying nice things to his Lordship’s wife “Your sweet m’lady.” but is insulting to his Lordship “Your nuts m’lord.”Your crackers m’lord”.

This sketch also gave me the bare bones of a story to hang the game off. The reason you’re having to go to all this trouble moving these other crackers around is to satisfy your aristocratic employer’s demand for a red cracker with his festive food stuffs. I’m sure this was one of the sub plots of a Christmas edition of Downton Abbey one year.

For a rush job I was happy with the overall result. I’d like to thank griffpatch for his original Scratch game which provided the inspiration and source material for my conversion and R-Tape for compiling another Woot! tape magazine.

3 thoughts on “So, about last year…”

  1. Hi Bob!

    Just to let you know I’ve had a stab at porting your thoroughly excellent mame4all port over to the new retrofw rs97 firmware and the rs07. Thanks for doing all the hard work in the first place, it’s greatly appreciated.

    Also, awesome to see you’re making speccy games – how are you finding using a c compiler for it? I had a crack at some z80 assembly last year and I have to say compared to the 6502 its a really hard chip to get running well.

    1. Hi Michael,

      Thanks for the kind words about my mame4all port for the RS-97. I hope you didn’t have to change too many magic numbers to get it working – I did try to tidy some of them up when I started the port. Hopefully you can get the IPU scaling working so you can replace the spaghetti code in blit.cpp. 🙂 I’m waiting for the dust to settle a bit before switching over to the newer firmware (I’ve already gone from original to Steward Fu’s to Useless).

      Using z88dk has worked surprisingly well for me. You can mix and match C and z80 assembly – so you can do smaller time critical stuff in hand rolled assembly with the benefits of doing more complicated game logic in C. Also writing in C means you can abstract the Spectrum specific graphic and input routines so you can plug in SDL video and input and debug your code on a PC with a modern IDE and debugger. I did this for Knockabout and a bug that I had spent hours trying to debug on the Spectrum was solved in a few minutes when I could step, breakpoint and put watches on variables.

      I don’t have experience with the 6502 – the machines that used them back in the 80s like the C64 and BBC were well out of my price league. With the z80 you always seem to be shuffling things around to cope with the small set of registers and having to think of weird and wonderful ways to do basic things like division and multiplication. It’s interesting that a chip from just a few years later like the 68000 has a lot more functionality. I did assembly on the Commodore Amiga a while back and was spoilt by the instruction set and number of available registers. 🙂

  2. Actually I was really grateful – a whole bunch of your comments saved me potentially hours! Cheers!

    I tried the z80 last year and it has those weird address modes, so it was really tricky adjusting to it after the 6502 – It’s a bit of a dry topic but i’d be keen to know what kind of data structures you use, because as I understand it, you can’t just step through them (like the 6502) as the addressing modes just don’t exist.

    Making spectrum games in basically portable c with strapped on sdl headers is also a pretty awesome idea.

    Good luck with whatever you go for next!

Leave a Reply

Your e-mail address will not be published. Required fields are marked *