Forgotten Code – Spectrum Sprite Hacker

Way back when; in the Sinclair Spectrum heyday, I used to do lots of hacking. I much more enjoyed diving into the machine code of games and making them do things outside of their design rather than actually playing them. A particular one was Room 10, a 3D tennis type game which my friends and I loved but the writers gave a woefully short time to play a round. I hacked this to exted it to a more pleasing length of fun.

Another thing I loved to do was to collect game sprites and custom character sets. It was possible to look through the code and find the initialisation and work out where the graphics and character set were from there. This could take a long time. Early on in my hacking carrear, I worked out that a visual way of finding these assets would be much more fun and a lot easier. I set about programming a simple tool to allow me to do this.

The operation of this tool does depend on being able to load the code in lower memory (25500). The reason for this is that I used to use an AT&Y SPEC-MATE to snapshot programs to microdrive. This device saved several files, two of them being the main blocks of RAM. Unlike the Multiface which saves one large block. This allows loading of each half of the program code to be loaded and looked at separately. I used a similar technique to hack games using the Devpac monitor and later Laser Genius for the disassemblies.

  • Sprite Hacker .ASM Pasmo 0.5.3 source
  • Sprite Hacker .TAP Precompiled Binary

I’m not a professional programmer, nor have I ever been, so the code isn’t exactly the peek of elegance. It does work however and it was fun to re-visit it, stick a few comments in and compile and run on a Spectrum Emulator (Spin in this case).

Sprite Hack

Sprite Hack – Knightlore Lives Icon (Inverted)

As you can see in the screen shot above, the interface is pretty basic. The keys are as follows:

  • Q and A – Page up and down
  • O and P – Increase and Decrease width
  • S and W – Increase and Decrease height
  • K and L – Line up and down
  • M and N – Byte up and down
  • C – Set address
  • B – Drop to BASIC (or calling program)
  • E – Toggle edit mode
    Q – Cursor Up
    A – Cursor Down
    O – Cursor Left
    P – Cursor Right
    Space – Set/reset a pixel

The idea is that you find your graphic or exclamation mark in the case of a character set and you manipulate the display so that the first byte is at the top left of the grid. This gives you the RAM address. If you then change the size of the grid (W & S), you can find out how many bytes the graphic takes up in RAM. For character sets, the size is usually 768 bytes. It’s then a case of dropping to BASIC (b) and saving out the graphic with the parameters you have found.

It has been great fun revisiting a program I wrote 26 years ago. I am very glad I made a tape backup of the source. I have found another program which I will tidy up and post.

[UPDATE]

As I said, I had found another of my programs, a Tape Header Reader, again a tool I used a lot at the time. It is complete machine code and uses ROM routines to load the header and then evaluate and print on the screen what is found.

  • Spectrum Tape Header ReaderĀ .ASM Pasmo 0.5.3 source
  • Spectrum Tape Header Reader .TAP Precompiled Binary

To use this code once compiled, CLEAR 25499, load the binary and RANDOMIZE USR 25500. This will initiate one reading of a header. If you wish to do more, just write a simple BASIC program to wait until a key is pressed (the routine clears the screen) and call it once more.

Tape Header Reader

Tape Header Reader

Both these pieces of software I have placed in the Public Domain. Feel free to use or distribute them how you wish.

This entry was posted in Hacking and tagged , , , , , , , , , . Bookmark the permalink.