Sonic 2 Hacking Guide
Binary - Mappings

Mapping objects refers to the process of taking several 8x8 sprites and putting them together to make a bigger sprite and/or object. This can be confusing, but it works quite effectively to give objects certain 'hot-spots'. For example, an enemy that touches the tip of Sonic's spines doesn't really bother him. However, if an enemy touches him elsewhere, Sonic gets hit and will either lose rings, lose shield, or die.


06FBE0 - Sonic mappings
07446C - Tails mappings

Ok, this is the section that tells where to read in the binary for mapping data for each of the 214 fames that Sonic has. Each set of 2 bytes identifies each frame in the order that they are put into the game. So, the first 2 bytes will tell where the mappings for the null frame are located. It works by starting at 06FBE0, and adding from that position to locate the data. Now that you understand this, you must understand the format of the actual mappings used. But first, you need to learn the header of each frame.

#1 #2

1 - Number of sprite blocks for frame per 256
2 - Number of sprite blocks for frame per single

If the header has both bytes as "00", the object will be identified as a null frame. Remember that before the data starts for a frame, there is a 2 byte size header. Afterwards, the data begins. Now, you need to learn how to move, size, and other things with a sprite block.

#1 #2 #3 #4 #5 #6 #7 #8

1 - Y position of sprite block
2 - Size of sprite block

The size works like this.

00 - 1 column, 1 row
01 - 1 column, 2 rows
02 - 1 column, 3 rows
03 - 1 column, 4 rows
04 - 2 columns, 1 row
05 - 2 columns, 2 rows
etc, etc, etc

It goes up to 0F (4 columns, 4 rows - 64x64). After this, the pattern repeats. Now to continue the mapping data.

#1 #2 #3 #4 #5 #6 #7 #8

3 + 4 - 8x8 sprite selection
5 + 6 - ???
7 + 8 - X position of sprite block

Every sprite block has 8 bytes of data like this. Bytes 5 and 6 don't seem to have any apparent functions. Now you need to understand the 8x8 sprite loading selections. This allows you to give a frame sprites from another frame. By combining the mapping pointers and these, you can transform a frame into another one. Anyway, this is what you need to know.

0714E0 - Sonic sprite selections

These selections work just like the mapping selections work. However, the format for sprite selections so you can select different sprites to load up hasn't been figured out yet. If you want to know the order that the sprites are put into the game so you don't have to hunt for the one you want, just use the pictures below. Count them across and they continue from picture to picture. Then count spaces of 2 bytes over to find the data that is loaded and use that on the sprite data locator you want to change. You can click on the pictures to see them in full size.

Thats all the info for Sonic. Here are some other mapping locations.

071FF6-07393C - Smoke trails
073AF8-?????? - Tails
0748B2-?????? - Sega logo
074DC4 - Title screen background
074E86 - Title screen logo
07CD30-07D227 - Sonic and Tails logo from options/level select
07D230-?????? - Level splash screen

Level mappings art compressed using the Kosinski compression format. To understand this very difficult format, I suggest reading
Brett Kosinski's notes.

094E74 - EHZ/HTZ 16x16
- EHZ/HTZ 128x128
09CFD4 - MZ 16x16
- MZ 128x128
0A3364 - OOZ 16x16
- OOZ 128x128
0A8D04 - MCZ 16x16
- MCZ 128x128
0AFFC4 - CNZ 16x16
- CNZ 128x128
0B5234 - CPZ/DEZ 16x16
- CPZ/DEZ 128x128
0BB944 - ARZ 16x16
- ARZ 128x128
0C4074 - WFZ/SCZ 16x16
- WFZ/SCZ 128x128