ROM
Version 1.6.20901

Summary:

1. ROM Map
2. Small patches
3. Level Editing - Tile Layout
4. Level Editing - Sprite Layout
5. Special Stage Editing
6. Slot Machine Bonus Stage Editing
7. Palette Editing

1. ROM Map

This ROM map lists the general sections of the Sonic & Knuckles ROM. I also added the Sonic 3 sections which are used by Sonic 3 & Knuckles. If you hack into Sonic & Knuckles only, ignore them (they are after 200000). However, if you want to hack Sonic 3 alone, you’ll have to read the future Sonic 3 hacking guide.

000000-000200 - Header of the SK ROM
0003C0-000418 - Lock-On infos
005F82-005F9E - List of Songs for 1P mode
005F9E-005FAE - List of Songs for 2P mode
006D2C-006D6C - Water Heights
0080E7-0081AF - Level Names in Level Select
00DB1C-00DB3C - Sonic 3 & Knuckles Data Select Strings
03E5E8-03E5F0 - Cheat Code
04CC36-04DEA1 - Sonic 1 & Knuckles Strings
05B730-05BC80 - Credits (for Sonic & Knuckles alone, no effect with Sonic 3 & Knuckles)
05BCD4-05C2D6 - Credits (for Sonic 3 & Knuckles, no effect with Sonic & Knuckles alone)
09D5C0-0A5331 - Sonic & Knuckles Levels
0A8720-0A893C - Sonic & Knuckles / Sonic 3 & Knuckles Color Palettes Pointers
0A893C-0A9DFC - Sonic & Knuckles / Sonic 3 & Knuckles Color Palettes
0AA57C-0AAA7C - Level Select Background
1E3C10-1E3CD0 - Levels Entry Points (Sonic/Tails)
1E3CD0-1E3D98 - Levels Entry Points (Knuckles)
1E3D98-1E4080 - Pointers for Sprites, Rings, Bonus Stage and Special Stages
1E4080-1E4484 - Slot Machine Bonus Stage
1E44DA-1FCF2A - Sprites / Rings for Sonic & Knuckles / Sonic 3 & Knuckles Levels
1FCF2A-1FD5CA - Sonic & Knuckles special stages (compressed)

209828-209878 - Palettes for competition main menu (3 palettes)
2098C0-2098CE - Menu items tiles selection pointers
2098CE-2099FC - Menu item tiles (2 bytes header -> multiply by 6 to have the number of bytes)
20A130-20A160 - Tiles Selection for time (numbers and ‘ and ‘‘) -> from 0 to 9, then ‘, then ‘‘
20A55E-20A65E - Palettes in competitions menus
20A6E4-20A6E4 - Tiles Selection for selection boxes
20C7DF-20???? - Sonic 3 Level Previews in Data Select
25E2D8-25E2F8 - Special Stages Pointers
26A0E0-26D000 - Sonic 3 Special Stages (end at 26C120, the rest is an empty space)
274760-281360 - Floor solidity data
281420-28BF54 - Sonic 3 Levels
2A2940-2C3200 - 128x128 tiles animated parts
2C3200-2C5623 - Title Screen
2C8000-2E0000 - Sonic 3 Musics
3A566A-400000 - Sonic 3 Art (compressed)


2. Small Pacthes

Before starting big hacking, let’s start by some addresses to patch in order to obtain interresting results.

01A742, or « How to become invincible ». Simply replace the two bytes by 1774. When an enemy will hit you, you will lose rings but the rings counter will keep its value ! However, if you don’t have rings, you will die.

You want to have a new challenge ? Go to 01A5A8 , and write 0000  ! You will not be able to take rings ! Of course, you can set these two bytes to whatever you want. It will tell how many rings the player can get. Usefull, if you are tired of having weird numbers.

And now, if you want to change the order of the frames in the Sonic animation at startup (Sonic 3 & Knuckles only), then go to 004400. Simply change the order of the bytes.

3. Level Editing - Tile Layout

Levels are made of small tiles, which are 128x128 pixels. Editing a level consist in changing these tiles into other tiles. The data indicating the tile layout for a level is referenced by a pointer.

A. Tile Layout Pointers>

Sonic & Knuckles uses pointers to tell where to look in the ROM in order to find the level tile layout data. Pointers are 4-bytes addresses. They indicate the actual address of a level. Note that if a pointer is greather than 00200000, it indicates a Sonic 3 address in Sonic 3 & Knuckles, so you must ignore it if you hack into Sonic & Knuckles alone.

Tile layout pointers are located at : 09D5C0-09D680

Here are the correspondances :
    AIZ1A             AIZ1B/2            HCZ1              HCZ2
    MGZ1              MGZ2               CNZ1              CNZ2
    FBZ1              FBZ2               ICZ1              ICZ2
    LBZ1              LBZ2               MHZ1              MHZ2
    SPZ1              SPZ2               LRZ1              LRZ2
    SSZ1              SSZ2               DEZ1              DEZ2
    TDZ               TDZ                SSZ2              SSZ2
    ???               ???                ???               ???
    ???               ???                ???               ???
    ???               ???                ???               ???
    BNS1              BNS1               BNS2              BNS2
    LRZ3              LRZ4(HPZ)          TDZ2(DEZ2 BOSS)   LRZ4(HPZ)

B. Tile Layout Headers

Once you are at the location indicated by the pointer, you have a header. It is usually 136 bytes. Here is the format :

WW WW HH HH ?? ?? ?? ?? P1 P1 P2 P2 P3 P3 P4 P4
P5 P5 P6 P6 P7 P7 P8 P8 (and so on…)

WW WW and HH HH indicate the level width and height, in 128x128 tiles. So, the level contains HH HH lines of WW WW tiles.

The P’s point to the begining of each line of tiles. However, you have to substract 80 00 to this number. It indicates how many bytes away from the begining of the header is the begining of the line of tiles.

C. Tile Layout Editing

The format is easy. Once you are at the begining of the data, one byte represents one tile, from 0 to 255. The Genesis draws tiles from left to right, and from the top to the bottom. Using the infos in the header, you can deduct the location of a specific tile, and change it to whatever you want. Though, editing a the tile layout via an hex editor is a bit difficult. If you read this section, you probably want to make your own editor.

4. Level Editing - Sprite Layout

Sprites are the second part of the level editing. We have a nice level, yeah, but it’s quite empty there ! So, there are sprites. Sprites can interact with the player (badniks, springs, spikes…). As for the tile layout data, the sprite layout data for each level is referenced by a pointer.

A. Sprite Layout Pointers

The sprite layout pointers work the same way as the tile layout pointers. They are 4-bytes addresses, indicating the actual address of the sprite layout data. Again, if a pointer is greather than 00200000, it indicates a Sonic 3 address in Sonic 3 & Knuckles, so you must ignore it if you hack into Sonic & Knuckles alone.

Sprite layout pointers are located at : 1E3D98-1E3E58

Here are the correspondances :
    AIZ1A             AIZ1B/2            HCZ1              HCZ2
    MGZ1              MGZ2               CNZ1              CNZ2
    FBZ1              FBZ2               ICZ1              ICZ2
    LBZ1              LBZ2               MHZ1              MHZ2
    SPZ1              SPZ2               LRZ1              LRZ2
    SSZ1              SSZ2               DEZ1              DEZ2
    TDZ               TDZ                SSZ2              SSZ2
    ???               ???                ???               ???
    ???               ???                ???               ???
    ???               ???                ???               ???
    BNS1              BNS1               BNS2              BNS2
    LRZ3              LRZ4(HPZ)          TDZ2(DEZ2 BOSS)   ???

B. Sprite Layout Editing

Ok, now you are at the begining of the sprite data. Each sprite is defined by 6 bytes. Here is the format :

XX XX YY YY SN PR

XX XX and YY YY are the coordinates of the sprite in the level.
SN is the sprite number, from 00 to FF
PR is the sprite property, from 00 to FF. Sprite properties affects the sprite functionalities and/or representation.

The YY YY has a special feature however. Say you have a sprite. It’s vertical position has a range of 00 00 to 1F FF . What happens if you go past 1F FF  ? The sprite flips ! So, if your sprite vertical position was 01 A4, and you replace it by 03 A4, it will be horizontally flipped, and it will still be at the same location. As you noticed, we added 20 00 . Each time you add 20 00 , the sprite flips in a different way.

So, we have these ranges :
00 00 to 1F FF : Normal sprite
20 00 to 3F FF : Sprite is flipped horizontally, substract 20 00 in order to obtain the real vertical position
40 00 to 4F FF : Sprite is flipped vertically, substract 40 00 in order to obtain the real vertical position
60 00 to 7F FF : Sprite is flipped horizontally and vertically, substract 60 00 in order to obtain the real vertical position

Here is a list of known sprites. If you are hacking Sonic & Knuckles alone, ignore Sonic 3 objects. Also, remember that you can flip the sprites.
00 – None
01 – Monitor (properties allow define the content, from 1 to 9)
02 – Solid Switcher (properties are required, for example to make loops work)
03 – AIZ1A – Tree Animation
04 – AIZ – Breakaway ledge
05 – AIZ – Rocks (properties allow to have different sizes, and to change their « breakability »)
06 – AIZ – Vine (properties allow to set how far it can lead you)
07 – Spring (properties allow to change the spring type and orientation)
08 – Spikes (properties allow to change the length/orientation/shifting)
09 – AIZ1A - Part of tree, used before the mini boss (what’s the use ?)
0A – AIZ – End of a rope
0C – AIZ – Vine (properties allow to change the length of the vine)
0D – AIZ1B/2 – Part of wall, that can be opened by a switch
0E – Invinsible sprite that makes you rotating when you walk on it (sorry for the description)
26 – Other sprites similar to solid switcher
28 – Invisible object that can block you, make you lose rings or die (using properties)
29 – AIZ1B/2 - Platform appearing and disappearing under waterfalls (I think properties change their timming)
2A – AIZ – Breakable part of ground
2B – AIZ1B/2 - Rotating steps
2C – AIZ1B/2 - Wooden bridge (properties allow to change its appearance and have it breakable when you walk on it)
2D – AIZ1B/2 – Log, falling from a waterfall
2E – AIZ1B/2 - Spiked log
2F – AIZ1B/2 – Some small « decorations » (properties allow to set the type of « decoration »)
30 – AIZ1B/2 – Fire (properties allow to change the type of flames)
32 – AIZ1B/2 – Wooden bridge, that can be up or down
33 – Switch
34 – Starpost (properties allow to set f it is active or not)
35 – AIZ1A – Flowers, displayed on the foreground (properties allow to change flower type and scrolling speed)
3D – Springs again (properties allow to change the spring type and orientation)
51 – AIZ – Moving platform (properties can change the moves type/range/speed)
80 – Monitor, again, except that this one must be touched by the end sign in order to appear
82 – HPZ – Knuckles (when you fight with him)
83 - Switch
85 – Special Stage Ring
86 - Switch
8C – AIZ – Badnik : Burrobot (not sure about the name)
8D – AIZ – Badnik : Rhino Bot
8E – AIZ – Badnik : Monkey Dude
8F – AIZ – Badnik : (forgot the name)
90 – AIZ – Mini boss
92 – AIZ - Boss
B0 – HPZ – Master Emerald


5. Special Stage Editing

Special Stage editing will allow you to modifiy the wonderfull special stages of this game ! However, there comes a difficulty. Sonic & Knuckles stages are compressed. You can try using my compression and decompression program. But, if you are editing Sonic 3 & Knuckles, then you can modifiy the 8 first stages, because they are not compressed.

The format is very simple. A special stage is a 32x32 grid, containing objects from 00 to 05 . So, there are 1024 bytes of data for each stage, plus an 8 bytes header, which is in fact at the end of the stage.

Here are the objects you can use in a special stage :
00 – Empty
01 – Red Sphere
02 – Blue Sphere
03 – Bumper
04 – Ring
05 – Yellow Sphere (spring)

As for the header, it is easy :
AA 00 XX 00 YY 00 RR RR

AA is the entry angle : 00 is up, 40 is right, 80 is down, and C0 is right, if I remember correctly
XX and YY are the coordinates of the entry point, using the scale of the objects
RR RR is the required quantity of rings in order to have a perfect

Special Stages locations (Sonic 3 & Knuckles only, and stages 1 to 8 only):
26A0E0 – Special Stage 1
26A4E8 – Special Stage 2
26A8F0 – Special Stage 3
26ACF8 – Special Stage 4
26B100 – Special Stage 5
26B508 – Special Stage 6
26B910 – Special Stage 7
26BD18 – Special Stage 8 (secret)

The compressed special stages are located at : 1FD5CA

6. Slot Machine Bonus Stage Editing

The Slot Machine bonus stage is a very entertaining part of the game. Here is how to modify it !

The format is quite similar to the special stages format. It is a 32x32 grid with objects from 00 to 08 . So, it uses 1024 bytes. It starts with a 4 bytes header, which is at the begining of the stage.

Here are the objects you can use in a bonus stage :
00 – Empty
01 – Blue Wall
02 – Yellow Wall
03 – Red Wall
04 – Goal
05 – Bumper
06 – Reverse
07 – Wheel
08 – Ring

The header works as follow :
XX XX YY YY

XX XX and YY YY are the coordinates of the entry point, in pixels

The bonus stage is located at : 1E4080-1E4484

7. Palette Editing

Comming soon, sorry...

The Sonic & Knuckles Hacking Guide - ROM
Made by David "Chaos" Declerck
For The Sonic Stuff Research Group
Contact me :
Davdeclerck@aol.com