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, 7872×512)
Green Hill Zone Act 2 (41KB, 2792×1024)
Green Hill Zone Act 3 (24KB, 2696×792)

Bridge Zone

Bridge Zone Act 1 (49KB, 5504×512)
Bridge Zone Act 2 (43KB, 4096×768)
Bridge Zone Act 3 (10KB, 1760×296)

Jungle Zone

Jungle Zone Act 1 (101KB, 7176×480)
Jungle Zone Act 2 (59KB, 504×3704)
Jungle Zone Act 3 (39KB, 1408×1344)

Labyrinth Zone

Labyrinth Zone Act 1 (113KB, 2040×1536)
Labyrinth Zone Act 2 (152KB, 2040×2048)
Labyrinth Zone Act 3 (28KB, 1320×832)

Scrap Brain Zone

Scrap Brain Zone Act 1 (50KB, 4808×480)
Scrap Brain Zone Act 2 - part 1 (63KB, 4088×1024) Scrap Brain Zone Act 2 - upper door (48KB, 1016×1984)
Scrap Brain Zone Act 2 - lower door (68KB, 2040×1824)
Scrap Brain Zone Act 3 (67KB, 2040×1504)

Sky Base Zone

Sky Base Zone Act 1 (69KB, 4104×1024)
Sky Base Zone Act 2 - external (22KB, 1728×864) Sky Base Zone Act 2 - internal (8KB, 952×352)
Sky Base Zone Act 3 (27KB, 1656×608)

Special Stages

Special Stage 1 (20KB, 1360×736) Special Stage 2 (24KB, 1344×864) Special Stage 3 (15KB, 1856×384) Special Stage 4 (19KB, 384×2592)
Special Stage 5 (20KB, 1360×736) Special Stage 6 (25KB, 1344×864) Special Stage 7 (15KB, 1856×384) Special Stage 8 (20KB, 384×2592)

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