Sonic the Hedgehog


Need I explain this game? A seminal classic platformer, and some (probably just me) might argue it's better than any other version, thanks to its elegance and controllability (later versions tended to go overboard on speed).

Anyway, it also has beautiful design, like Wonder Boy III it takes the system's capabilities and limitations and works with the former without showing the latter. The colours look perfect, not like graphics that have been reduced down to the system. The levels are huge, and you have great freedom of motion.

Well, not quite enough for me. For this game, I knew there were areas that you just can't see when playing. So a hack was needed.

The hack

In eSMS I watched the RAM values changing as I jumped, isolating the ones that seemed to be determining the "camera" position at $d25a and $d25d. I applied a Meka RAM patch and determined they were the right locations. I disassembled the ROM and looked at the VBlank handler at $0038; it just said jp $0073, followed by a bit of text stored in the ROM by the developers, which gave me a total of 46 bytes in which to write something interesting. I came up with this:

.define scrollx $d25a
.define scrolly $d25d
push af
push hl
  in a,($dd) ; get P2 inputs
  ld hl,(scrollx)
  bit 0,a
  jr nz,+
  dec hl
+:bit 1,a
  jr nz,+
  inc hl
+:ld (scrollx),hl
  in a,($dc) ; get P1+2 inputs
  ld hl,(scrolly)
  bit 7,a
  jr nz,+
  inc hl
+:bit 6,a
  jr nz,+
  dec hl
+:ld (scrolly),hl
pop hl
pop af
jp $0073

(43 bytes)

This lets the second joypad control the "camera", so the game remains playable. I used WLA DX's excellent .background functionality to allow me to patch the ROM automatically using assembler rather than machine code, and tried it out; and it worked!

However, this wasn't enough because the game has a lot of other routines accessing and changing these variables, most notably to stop Sonic going offscreen (not that it works all the time, when you get up speed) but also for things like restricting the camera to the defined level area (a good thing, usually) and for autoscrolling the level in Bridge Zone Act 2 (a bad thing). Therefore, I carefully removed all of the unwanted writes to these variables, giving me freedom to move the camera as I wanted. Interestingly, some of the levels restrict the camera position to an area smaller than the defined level area; Green Hill Zone Act 1 in particular uses this to allow the ending sequence to be joined on to the end of it but be inaccessible.

A fair few more hacks were needed; I stopped palette animations by writing two zero bytes at $0592, but this stopped all palette loads so I had to enable and disable it appropriately. I stopped the timer and gave myself 50 rings with RAM patches. However, even with all this I still had to play through some of the levels to get the effects I needed, so it was a couple of days' work. So be grateful!

Brief game guide

The evil Eggman Dr. Robotnik has stolen the Chaos Emeralds and taken over your island, imprisoning the animals and turning them into robots! You have to find all the emeralds hidden around the island and defeat him.


  • L/R = run
  • D = duck/spin/look down
  • U = look up
  • 1/2 = jump

Jump and spin at enemies robots to kill them release the little animal inside.

Green Hill Zone

Green Hill Zone Act 1 (plus ending sequence) (61KB, GetAttachDims)
Green Hill Zone Act 2 (41KB, GetAttachDims)
Green Hill Zone Act 3 (24KB, GetAttachDims)

Bridge Zone

Bridge Zone Act 1 (49KB, GetAttachDims)
Bridge Zone Act 2 (43KB, GetAttachDims)
Bridge Zone Act 3 (10KB, GetAttachDims)

Jungle Zone

Jungle Zone Act 1 (101KB, GetAttachDims)
Jungle Zone Act 2 (59KB, GetAttachDims)
Jungle Zone Act 3 (39KB, GetAttachDims)

Labyrinth Zone

Labyrinth Zone Act 1 (113KB, GetAttachDims)
Labyrinth Zone Act 2 (152KB, GetAttachDims)
Labyrinth Zone Act 3 (28KB, GetAttachDims)

Scrap Brain Zone

Scrap Brain Zone Act 1 (50KB, GetAttachDims)
Scrap Brain Zone Act 2 - part 1 (63KB, GetAttachDims) Scrap Brain Zone Act 2 - upper door (48KB, GetAttachDims)
Scrap Brain Zone Act 2 - lower door (68KB, GetAttachDims)
Scrap Brain Zone Act 3 (67KB, GetAttachDims)

Sky Base Zone

Sky Base Zone Act 1 (69KB, GetAttachDims)
Sky Base Zone Act 2 - external (22KB, GetAttachDims) Sky Base Zone Act 2 - internal (8KB, GetAttachDims)
Sky Base Zone Act 3 (27KB, GetAttachDims)

Special Stages

Special Stage 1 (20KB, GetAttachDims) Special Stage 2 (24KB, GetAttachDims) Special Stage 3 (15KB, GetAttachDims) Special Stage 4 (19KB, GetAttachDims)
Special Stage 5 (20KB, GetAttachDims) Special Stage 6 (25KB, GetAttachDims) Special Stage 7 (15KB, GetAttachDims) Special Stage 8 (20KB, GetAttachDims)

You cannot get to the Special Stages in Scrap Brain Zone or Sky Base Zone, so there are only 8 available.