Actions

SCHG

Difference between revisions of "Nem s2"

From Sonic Retro

(Dynamic pattern reloading)
m (Text replacement - " Block mappings==" to " block mappings==")
(11 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 +
{{HistoricalArticle|equivalent=SCHG:Sonic the Hedgehog 2 (16-bit)}}
 
==Introduction==
 
==Introduction==
 
Here are my hacking notes on the Sonic 2 rom. If you use these notes I'd appreciate it if you would mention it with your hack or your utility, so that other people can find their way here. For hex editing I recommend you use a hex utility called Hex workshop, and for emulators I recommend you get both Gens and Genecyst. Genecyst may be old and kinda crap, but it has a whole heap of debug outputs that really help when it comes to seeing exactly what it's doing and when.<P><br>
 
Here are my hacking notes on the Sonic 2 rom. If you use these notes I'd appreciate it if you would mention it with your hack or your utility, so that other people can find their way here. For hex editing I recommend you use a hex utility called Hex workshop, and for emulators I recommend you get both Gens and Genecyst. Genecyst may be old and kinda crap, but it has a whole heap of debug outputs that really help when it comes to seeing exactly what it's doing and when.<P><br>
Line 1,656: Line 1,657:
  
 
==Offset indexes==
 
==Offset indexes==
<P>An offset index is a handy way of keeping a block of data grouped together, and also replacing a whole heap of pointers. The way it works is there is a list of two byte vaues, and depending on the block of data the game wants to load, it will take one of those values and add it to the starting address of the offset index. The most common usage is for every act of every level value, there is an offset that acts as the pointer to the block of data to use for it. Lets look at an example:</P><br>
+
<P>An offset index is a handy way of keeping a block of data grouped together, and also replacing a whole heap of pointers. The way it works is there is a list of two byte values, and depending on the block of data the game wants to load, it will take one of those values and add it to the starting address of the offset index. The most common usage is for every act of every level value, there is an offset that acts as the pointer to the block of data to use for it. Lets look at an example:</P><br>
 
<P>E6800: 004A 037A 5552 5552 5552 5552 5552 5552 0734 0BC0 10EE 10EE 1748 1AFC</P><br>
 
<P>E6800: 004A 037A 5552 5552 5552 5552 5552 5552 0734 0BC0 10EE 10EE 1748 1AFC</P><br>
 
<P>Now this is the beginning of the offset index for the sprite locations. Now, can you see which values are the offset for MTZ act 2? They're 0BC0. All you had to do to get that was to take the level value for MTZ, which is 04, and count across four bytes for every value it is above 00, then across another two because it's the second act. Now we take that value and using a hex calculator, add it to the address of the offset table, which is E6800. That will give us a value of E73C0, which is the address in the rom of the MTZ act 2 sprite locations.</P><br>
 
<P>Now this is the beginning of the offset index for the sprite locations. Now, can you see which values are the offset for MTZ act 2? They're 0BC0. All you had to do to get that was to take the level value for MTZ, which is 04, and count across four bytes for every value it is above 00, then across another two because it's the second act. Now we take that value and using a hex calculator, add it to the address of the offset table, which is E6800. That will give us a value of E73C0, which is the address in the rom of the MTZ act 2 sprite locations.</P><br>
Line 1,858: Line 1,859:
 
Sprites are quite simple to define. It takes six bytes to define one sprite. The first two bytes are the x location of the sprite, and the next two bytes are the y location of the sprite. The 5th byte is the number on the sprite array to lookup to get the location for the function to use for the programming of that sprite, and the 6th byte is an optional declaration to use with the function for that sprite. Go [[#Sprite_programming|here]] for more info on what exactly that means, and a list of all the sprites in the S2 rom.<br>
 
Sprites are quite simple to define. It takes six bytes to define one sprite. The first two bytes are the x location of the sprite, and the next two bytes are the y location of the sprite. The 5th byte is the number on the sprite array to lookup to get the location for the function to use for the programming of that sprite, and the 6th byte is an optional declaration to use with the function for that sprite. Go [[#Sprite_programming|here]] for more info on what exactly that means, and a list of all the sprites in the S2 rom.<br>
  
==Main level Block mappings==
+
==Main level block mappings==
 
The block mappings in the S2 final rom are compressed. If you want to edit them you need to extract them first, edit them, and then recompress them afterwards. For more information on exactly what the block mappings do, and how to edit them, refer to the sonic 2 savestate breakdown. Note that the 16x16 block mappings in the S2 beta rom are not compressed, so if any port from the beta to the final is to be successful, those mappings will need to be compressed first.<br>
 
The block mappings in the S2 final rom are compressed. If you want to edit them you need to extract them first, edit them, and then recompress them afterwards. For more information on exactly what the block mappings do, and how to edit them, refer to the sonic 2 savestate breakdown. Note that the 16x16 block mappings in the S2 beta rom are not compressed, so if any port from the beta to the final is to be successful, those mappings will need to be compressed first.<br>
  
Line 1,878: Line 1,879:
  
 
==Dynamic pattern reloading==
 
==Dynamic pattern reloading==
Dynamic pattern reloading is a method of loading patterns into the VRAM, but unlike the other methods, this one has no limitations, because it uses actual programmed code. Basically this is here for any effects to do with patterns changing in game that isn't posible using the normal load cue system, like the hills in the background of HTZ where the patterns to display are determined by the position of the screen Because the programming for it is in the form of compiled code, direct editing of it is not possible.<br>
+
Dynamic pattern reloading is a method of loading patterns into the VRAM, but unlike the other methods, this one has no limitations, because it uses actual programmed code. Basically this is here for any effects to do with patterns changing in game that isn't posible using the normal load cue system, like the hills in the background of HTZ where the patterns to display are determined by the position of the screen. Because the programming for it is in the form of compiled code, direct editing of it is not possible.<br>
  
 
==Animated pattern load cue's==
 
==Animated pattern load cue's==
Line 2,115: Line 2,116:
 
   <TR align=middle>
 
   <TR align=middle>
 
  <TD>Value</TD>
 
  <TD>Value</TD>
  <TD>pallette line</TD>
+
  <TD>palette line</TD>
 
  <TD>flipped horizntally</TD>
 
  <TD>flipped horizntally</TD>
 
  <TD>flipped vertically</TD></TR>
 
  <TD>flipped vertically</TD></TR>
Line 2,866: Line 2,867:
 
| ??????? [125E6]
 
| ??????? [125E6]
 
|}
 
|}
 +
 +
==References==
 +
<references />
  
 
{{SCHGuides}}
 
{{SCHGuides}}
[[Category:Sonic Community Hacking Guide]]
 

Revision as of 16:49, 24 March 2020

Historical document icon.svg This historical hacking document is preserved here for archival purposes.
It has not been revised since its original writing and may be outdated. For an SCHG-equivalent document, see SCHG:Sonic the Hedgehog 2 (16-bit).

Introduction

Here are my hacking notes on the Sonic 2 rom. If you use these notes I'd appreciate it if you would mention it with your hack or your utility, so that other people can find their way here. For hex editing I recommend you use a hex utility called Hex workshop, and for emulators I recommend you get both Gens and Genecyst. Genecyst may be old and kinda crap, but it has a whole heap of debug outputs that really help when it comes to seeing exactly what it's doing and when.


First of all it's very important that you understand the basics. All data stored on a computer is in the form of 1's and 0's. On a CD for example, a laser hits the surface, and if the laser bounces back and hits the lens it's a 1, and if it doesn’t it's a zero. Each 1 or 0 is called a bit, and a bit cannot have any other characters in it other that a 1 or a 0. Now the computer deals with bits in groups of 4. There are 16 possible combinations for a group of four 1's and 0's, so to make it simpler it deals with it as one value, rather than 4 (Eg. 0110 becomes 6). Now as there are 16 possible combinations for a group of 4 bits, this value to represent their values must have 16 values itself, so rather than a simple 0-9, this value is 0-F (0123456789ABCDEF). This value is called a hexadecimal value (hex value for short). Each hex value is dealt with in groups of 2, called a byte, each byte having 128 possible combinations. Now on a final output level the byte may be looked up on an ASCII table, which will convert that value into a recognisable character (Eg. a byte value of 73 becomes a lowercase s on an English ASCII table). You will practically never touch the ASCII version of the code in hacking though.


Now one important thing to realise is that as one character of hex has 16 values and a decimal (real) value only has 10, it may be necessary to convert the numbers between them from time to time. This is done with the use of a base converter (included in hex workshop). Let's say you wanted to give Sonic 50 rings. If you enter 50 as the value, you will in fact end up with 80, because that value you are entering is actually a hex value, but if you use the base converter to convert it first, you merely enter the value of 50 into the decimal box, and it will spit out a hex value of 32, which will in fact give you 50 rings in the game. Another useful utility that you will need is a hex calculator (also included in hex workshop). A hex calculator is the same as a normal calculator, but it deals with hex values rather than decimal values.


Another thing you need to know is that each level in Sonic 2 has a value assigned to it, but this value does not correspond with each level's final position in the game. Here is a list of the level values in Sonic 2:


00 Emerald Hill zone
04 Metropolis zone
05 Metropolis zone act 3
06 Wing fortress zone
07 Hill Top zone
08 Hidden Palace zone
0A Oil Ocean zone
0B Mystic Cave zone
0C Casino Night zone
0D Chemical Plant zone
0E Death Egg zone
0F Aquatic Ruin zone
10 Sky Chase zone


One other thing you need to know is the way that the Mega Drive stores all the art. All the art that is used in the game is stored in the form of 8x8 pixel blocks. These blocks do not actually store colours at all, they actually only have one hex value per pixel. That value specifies what point on the palette line the pixel will get its colour from. The palette has 4 lines, each with 16 colours on them. Now the colours on the palette can be changed at any point during play, and some palette colours may even automatically change colour each couple of frames to make it look like the colour is flashing.


Now these 8x8 blocks are not what make up the level directly. 4 8x8 blocks are grouped together to form a 16x16 block, and it is at this point that the palette line to use for that 16x16 block is specified. The 8x8 patterns can also have their x, y, or x and y values reversed when placing them in a 16x16 block. Also it's at the 16x16 level that the collision definitions are specified. Now finally we get to a 128x128 block, and these are the things that the actual level info loads. It is made up of 64 16x16 blocks, and each block inside them can use a different palette line. You cannot place anything except a sprite or a 128x128 block directly into a level.


Now that you know all the basics, here's my breakdown:


Address listing

For the most part, there are no breaks in this list. If one address follows on directly from another on this list, it does so in the rom, with the exception of data that comes before 40000. All the compiled code that is used in the game is stored in this section, and that's a pain in the ass to sort through, so there will be many breaks there. The column on the left lists it's file location, the column in the middle contains it's name and description, and the column on the right will contain any special notes about it, such as compression format used if applicable, and number of blocks an art tile uses. The right column will also contain a link with the text further info, if that particular block requires it. That link will jump to a detailed explanation of that thing. Anything linked like that will also be listed in the contents at the top of the page.

0-FF Vector table
100-200 Header
14DE-???? Programming to do wih decompression of art tiles to VRAM Compiled
2782-28C1 Palette pointers
28C2 Sega screen palette (00)
2942 Title screen palette (01)
2962 Unknown palette (02)
29E2 "Sonic and Miles" screen palette (03)
2A22 EHZ palette (04, 05, 07, 0D)
2A82 WZ palette (06)
2AE2 MTZ palette (08, 09)
2B42 WFZ palette (0A)
2BA2 HTZ palette (0B)
2C02 HPZ palette (0C)
2C62 HPZ underwater palette (15)
2CE2 OOZ palette (0E)
2D42 MCZ palette (0F)
2DA2 CNZ palette (10)
2E02 CPZ palette (11)
2E62 CPZ underwater palette (16)
2EE2 DEZ palette (12)
2F42 ARZ palette (13)
2FA2 ARZ underwater palette (17)
3022 SCZ palette (14)
3082 Unknown palette (19)
30A2 Unknown palette (1A)
30C2 OOZ boss palette (25)
30E2 Menu palette (26)
3162 Main special stage palette (18)
31C2 Special stage 1 palette (1B)
31E2 Special stage 2 palette (1C)
3202 Special stage 3 palette (1D)
3222 Special stage 4 palette (1E)
3242 Special stage 5 palette (1F)
3262 Special stage 6 palette (20)
3282 Special stage 7 palette (21)
32A2 Unknown palette (22)
32C2 Unknown palette (23)
32E2 Unknown palette (24)
3302 Unknown palette (27)
3EA0-3EB0 Music playlist for levels Further info
4948-498B Pointers to demo file to use for levels
49E8-4A70 Pointers to collision indexes Further info
6FC0 ??????? (sprite)
70F0 ??????? (sprite)
7356 ??????? (sprite)
7A68 Continue text (sprite)
7B82 Sprite of sonic lying down from continue screen (sprite)
80BE ??????? (sprite)
9454-947B Level select level order Further info
A1D6 Cut scene at end of game (sprite)
A3C8 ??????? (sprite)
A894 ??????? (sprite)
A988 ??????? (sprite)
A9F2 ??????? (sprite)
AAAE ??????? (sprite)
C054-C14F Level size array Further info
C150-C1CF Code for initial character and screen placement Compiled
C1D0-C257 Character start location array Further info
C4FC Offset index of rasterised layer deformation Further info
C51E Unknown (possibly title screen) Further info
C57E EHZ layer deformation info

Further info

C682 Unknown (splitscreen, EHZ?)

Further info

C7F2 HTZ layer deformation info

Further info

C7BA Unknown (level value 02)

Further info

C7F2 Unknown (identical to WFZ)

Further info

C82A WFZ layer deformation info

Further info

C8CA Unknown (identical to HTZ)

Further info

C964 HTZ layer deformation info

Further info

CA92 Unknown (background fixed)

Further info

CB10 Unknown (splitscreen, background locked, no deformation)

Further info

CBA0 HPZ layer deformation info

Further info

CC66 OOZ layer deformation info

Further info

CD2C MCZ layer deformation info

Further info

CE6C Unknown (splitscreen, background free moving, but no alteration)

Further info

D0C6 CNZ layer deformation info

Further info

D194 CNZ 2 player splitscreen

Further info

D27C CPZ layer deformation info

Further info

D382 DEZ layer deformation info

Further info

D4AE ARZ layer deformation info

Further info

D5DE SCZ layer deformation info

Further info

D666 01, 03, 09 layer deformation info

Further info

F66C ??????? (sprite)
FC98 Swinging platform from aquatic ruin zone (sprite)
10310 ??????? (sprite)
104AC Stationary floating platform from aquatic ruin zone (sprite)
108BC Collapsing platform from either oil ocean zone or mystic cave zone (sprite)
10A08 Collapsing platform from aquatic ruin zone (sprite)
111D4 ??????? (sprite)
112F0 ??????? (sprite)
115C4 Stomper from MCZ (sprite)
1169A One way barrier from chemical plant zone and DEZ (sprite)
1188C An animal and the 100 that are given off from busting a badnick (sprite)
11DC6 100 points (sprite)
11F44 A ring (sprite)
12078 Sprite of rings spraying out from being hit by an enemy (sprite)
125E6 ??????? (sprite)
12670 Monitor (sprite)
12854 Image of what was in monitor flying up like it does when you bust it (sprite)
12E18 Flashing stars from intro (sprite)
132F0 ??????? (sprite)
13600 ??????? (sprite)
13C48 Sprite for level title card (sprite)
13F74 ??????? (sprite)
14086 End of level result screen (sprite)
142F8-1433B Main game level order

Further info

143C0 End of special stage result screen (sprite)
15900 Vertical spikes (sprite)
15CC8 ??????? (sprite)
15D44 ??????? (sprite)
1600C Sprite programming pointers (one address per sprite value)

Further info

1637C ??????? (sprite)
18888 Red spring facing upwards (sprite)
191B8 ??????? (sprite)
19F50 Sonic (sprite)
1B8A4 Tails (sprite)
1D200 ??????? (sprite)
1D320 ??????? (sprite)
1D8F2 ??????? (sprite)
1D97E ??????? (sprite)
1DD20 ??????? (sprite)
1E0F0 ??????? (sprite)
1F0B0 Starpoll (sprite)
1F624 ??????? (sprite)
1F730 Star ball that sonic bounces off from CNZ (sprite)
1F8A8 ??????? (sprite)
1FCDC ??????? (sprite)
2009C Section of pipe that tips you off from chemical plant zone (sprite)
20210 ??????? (sprite)
2031C Master emerald (sprite)
203AC ??????? (sprite)
208DC ??????? (sprite)
20B9E ??????? (sprite)
20DEC ??????? (sprite)
20FD2 Big pylon thing that's in the foreground in CPZ (sprite)
21088 An explosion of an enemy, giving off an animal and 100 points (sprite)
2115C ??????? (sprite)
21392 ??????? (sprite)
214C4 Rotating cylinder in Metropolis zone (sprite)
21928 See saw thingy from hill top zone (sprite)
21DAC Diagonally moving lift thing from hill top zone (sprite)
22018 ??????? (sprite)
222AC Booster things from chemical plant zone (sprite)
22408 ??????? (sprite)
2259C Spin tube from chemical plant zone (sprite)
22FF8 ??????? (sprite)
23300 ??????? (sprite)
2351A ??????? (sprite)
238DC ??????? (sprite)
23AF4 Platform that shoots up in the air from oil ocean zone (sprite)
23E40 Spiky ball from OOZ (sprite)
24020 Oil in OOZ (sprite)
240F8 Strange spring from OOZ facing vertically (sprite)
24A16 Ball sitting on strange spring from OOZ (sprite)
24DD0 Block thingy in OOZ that launches you into the round ball things (sprite)
25244 Thingy from oil ocean zone that you enter when flying as a ball, and it turns and throws you another direction (sprite)
25694 Arrow shooter from aquatic ruin (sprite)
2588C Pillar that drops it's lower part from aquatic ruin zone (sprite)
25A5A Raising pillar from ARZ (sprite)
26104 Sprite that makes leaves fly off when you hit it from ARZ (sprite)
26370 Weird lever like spring from chemical plant zone and ARZ (sprite)
26634 Thing that pops up and releases steam sideways from metropolis zone (sprite)
26920 Twin stompers from MTZ (sprite)
26AE0 ??????? (sprite)
26F58 ??????? (sprite)
2715C One of the spin tubes from MTZ (sprite)
27594 Block that has a spike that comes out of each side sequentially from MTZ (sprite)
27794 Floor spike from MTZ (sprite)
27884 Nut from MTZ (sprite)
27AB0 ??????? (sprite)
27D6C ??????? (sprite)
28034 ??????? (sprite)
283AC ??????? (sprite)
285C0 ??????? (sprite)
28BC8 ??????? (sprite)
28DF8 Spike block thing from MCZ (sprite)
28FF8 ??????? (sprite)
291CC Stairs from CPZ that move down to open the way (sprite)
293A0 Platform that moves back and forth on top of chemicals in CPZ (sprite)
29590 ??????? (sprite)
297E4 Vine switch that you hang off in MCZ (sprite)
2997C Vine that you hang off and it moves down from MCZ (sprite)
2A000 ??????? (sprite)
2A290 Platform that is usually swinging from ARZ (sprite)
2A4FC 3 adjoined platforms from ARZ that rotate in a circle (sprite)
2A7B0 Fan blowing to the left from OOZ (sprite)
2AB84 Vertical spring from CNZ that you hold down jump on to pull back further (sprite)
2B140 ??????? (sprite)
2B528 Flashing blocks in CNZ that appear and disappear in a rectangular shape that you can walk across (sprite)
2B84C ??????? (sprite)
2B8EC Big block from casino night zone that moves back and forth (sprite)
2BA08 Elevator going up from CNZ (sprite)
2BB6C Poky that gives out points from CNZ (sprite)
2C448 ??????? (sprite)
2C6AC Block thingy in CNZ that changes colour when you hit it and gives you points, until it disappears) (sprite)
2C92C A sprite that you can hold on to, like the rails in WFZ (sprite)
2CA14 Octopus badnick from OOZ (sprite)
2CCC8 Seahorse badnick from OOZ (sprite)
2D068 Buzz bomber from EHZ (sprite)
2D394 Shark badnick from EHZ (sprite)
2D494 ??????? (sprite)
2D734 ??????? (sprite)
2EF18 ??????? (sprite)
2FC50 ??????? (sprite)
2FCF4 Button (sprite)
30480 ??????? (sprite)
30FA4 Earthquake (sprite)
318F0 ??????? (sprite)
32288 ??????? (sprite)
32940 ??????? (sprite)
32F90 ??????? (sprite)
338EC ??????? (sprite)
340A4 ??????? (sprite)
347EC ??????? (sprite)
34A5C ??????? (sprite)
34EB0 ??????? (sprite)
34FA0 ??????? (sprite)
353FE ??????? (sprite)
35554 ??????? (sprite)
35FBC ??????? (sprite)
36924 Blowfly enemy from ARZ (sprite)
36A76 ??????? (sprite)
36B88 ??????? (sprite)
36BD4 ??????? (sprite)
36DAC ??????? (sprite)
36F0E ??????? (sprite)
36FE6 ??????? (sprite)
370FE Red circle dude from hill top zone that has lava balls circling around him that he throws at you. (sprite)
37322 Lava snake (sprite)
373D0 ??????? (sprite)
376E8 ??????? (sprite)
377C8 Bomber badnick from SCZ (sprite)
37936 Turtle thing on the back of another larger turtle thing from SCZ (sprite)
37A06 ??????? (sprite)
37A82 ??????? (sprite)
37BFA Coconuts (the badnick) from EHZ (sprite)
37E16 Snake like badnick from MCZ that flies out from wall at you (sprite)
3800C Crab like badnick from MTZ (sprite)
3815C ??????? (sprite)
383B4 Praying Mantis dude from MTZ (sprite)
384A2 ??????? (sprite)
3873E Glowbug from MCZ (sprite)
3899C Exploding star from MTZ (sprite)
38AEA ??????? (sprite)
38B86 ??????? (sprite)
38DBA Spider badnick from CPZ (sprite)
38F66 ??????? (sprite)
39032 ??????? (sprite)
39066 ??????? (sprite)
390A2 ??????? (sprite)
3937A Jet badnick from SCZ (sprite)
3941C ??????? (sprite)
39452 ??????? (sprite)
3972C ??????? (sprite)
3A1DC ??????? (sprite)
3A3F8 ??????? (sprite)
3A790 ??????? (sprite)
3B2DE ??????? (sprite)
3B36A ??????? (sprite)
3B3FA ??????? (sprite)
3B5D0 Tilting platform from WFZ (sprite)
3B8A6 ??????? (sprite)
3B968 Wall turret from WFZ (sprite)
3BABA ??????? (sprite)
3BB4C ??????? (sprite)
3BB7C ??????? (sprite)
3BBBC ??????? (sprite)
3BC1C ??????? (sprite)
3BD7A Platform that pops in and out from WFZ (sprite)
3BEAA ??????? (sprite)
3BF04 ??????? (sprite)
3C0AC Sprite that sonic hangs onto on the back of Robotnic's getaway ship at the end of WFZ (sprite)
3C328 Rivet thing that you bust to get into the ship at the end of WFZ (sprite)
3C3D6 ??????? (sprite)
3C442 Laser boss guy at end of WFZ (sprite)
3CED0 ??????? (sprite)
3D23E Bad guy in CNZ (sprite)
3D4C8 Death Egg (sprite)
3EAC8 ??????? (sprite)
3F1E4 Egg prison (sprite)
3FCE0 Offset index of dynamic pattern and animated pattern load cue's Double offset

Further info

3FD24 Dynamic pattern reloading for 01, 02, 03, WFZ, 09, MCZ, SCZ (empty)

Further info

3FD26 Dynamic pattern reloading for HTZ

Further info

3FF08 Dynamic pattern reloading for CNZ

Further info

3FF10 Dynamic pattern reloading for CNZ (not linked in offset index, but loads CNZ stuff)

Further info

3FF24 Dynamic pattern reloading for ARZ

Further info

3FF2C Dynamic pattern reloading for EHZ, MTZ, MTZ3, HPZ, OOZ, CPZ, DEZ

Further info

3FF94 EHZ animated pattern load cue (4)

Further info

3FFF8 MTZ animated pattern load cue (3)

Further info

40038 HTZ animated pattern load cue (4)

Further info

4009C HPZ animated pattern load cue (2)

Further info

400C8 OOZ animated pattern load cue (4)

Further info

4010E CNZ animated pattern load cue (1)

Further info

40160 Unknown animated pattern load cue (1) (mirror of CNZ load cue, but not linked in offset index)

Further info

401B2 CPZ animated pattern load cue (0)

Further info

401C4 DEZ animated pattern load cue (0)

Further info

401D6-????? ARZ animated pattern load cue (3)

Further info

40350 Offset index for mappings and properties of misc spites using animated patterns

Further info

40372 EHZ, HTZ misc sprite mappings

Further info

403EE MTZ misc sprite mappings

Further info

404C2 HPZ misc sprite mappings

Further info

405B6 OOZ misc sprite mappings

Further info

4061A CNZ misc sprite mappings

Further info

406BE Unknown misc sprite mappings (that damn phantom group again)

Further info

40762 CPZ misc sprite mappings

Further info

4076E DEZ misc sprite mappings

Further info

4077A ARZ misc sprite mappings

Further info

407BE-407C0 01, 02, 03, WFZ, 09, MCZ, SCZ misc sprite mappings (empty)

Further info

4134C-41A6B Big and small numbers used on counters in game Uncompressed

Further info

41D0C-41D2D Offset index of object debug lists

Further info

41D2E EHZ/01/02/03/DEZ object debug lists

Further info

42AA8 MTZ/MTZ act 3 object debug lists

Further info

41EEC WFZ object debug lists

Further info

41FEE HTZ object debug lists

Further info

420E8 HPZ/OOZ object debug lists

Further info

421F2 MCZ object debug lists

Further info

422B4 CNZ object debug list

Further info

42376 CPZ object debug list

Further info

42438 ARZ object debug list

Further info

42522 SCZ object debug list

Further info

42594-4265F Main level load block pointers

Further info

42660-426E5 Offset index of pattern load cue's

Further info

426E6-42D4F Pattern load cues

Further info

42D50 Curve and resistance mapping

Further info

42E50 Collision array

Further info

44E50 EHZ and HTZ primary 16x16 collision index Compressed

Further info

44F40 EHZ and HTZ secondary 16x16 collision index Compressed

Further info

45040 MTZ primary 16x16 collision index Compressed

Further info

45100 OOZ primary 16x16 collision index Compressed

Further info

45200 MCZ primary 16x16 collision index Compressed

Further info

452A0 CNZ primary 16x16 collision index Compressed

Further info

45330 CNZ secondary 16x16 collision index Compressed

Further info

453C0 CPZ and DEZ primary 16x16 collision index Compressed

Further info

454E0 CPZ and DEZ secondary 16x16 collision index Compressed

Further info

45610 ARZ primary 16x16 collision index Compressed

Further info

45760 ARZ secondary 16x16 collision index Compressed

Further info

458C0 WFZ/SCZ primary 16x16 collision index Compressed

Further info

459A0 WFZ/SCZ secondary 16x16 collision index Compressed

Further info

45A80 Offset index of level layout's

Further info

45AC4 EHZ act 1 level layout Level compression

Further info

45C84 EHZ act 2 level layout Level compression

Further info

45E74 MTZ act 1 level layout Level compression

Further info

462A4 MTZ act 2 level layout Level compression

Further info

46684 MTZ act 3 level layout Level compression

Further info

46B04 WFZ level layout Level compression

Further info

46DD4 HTZ act 1 level layout Level compression

Further info

47044 HTZ act 2 level layout Level compression

Further info

47404 OOZ act 1 level layout Level compression

Further info

47784 OOZ act 2 level layout Level compression

Further info

47B24 MCZ act 1 level layout Level compression

Further info

47D24 MCZ act 2 level layout Level compression

Further info

47FF4 CNZ act 1 level layout Level compression

Further info

483C4 CNZ act 1 level layout Level compression

Further info

48774 CPZ act 1 level layout Level compression

Further info

48A84 CPZ act 2 level layout Level compression

Further info

48DE4 DEZ level layout Level compression

Further info

48E94 ARZ act 1 level layout Level compression

Further info

49264 ARZ act 2 level layout Level compression

Further info

49634 SCZ level layout Level compression

Further info

49714 Animated flowers in EHZ and HTZ Uncompressed

Further info

49914 Pulsing thing against chequered backing from EHZ Uncompressed

Further info

49A14 Dynamically reloaded cliffs in background from HTZ Art compression
192 blocks
4A33E Dynamically reloaded clouds in background from HTZ Uncompressed

Further info

4A73E Spinning metal cylinder patterns in MTZ Uncompressed

Further info

4B73E Lava patterns in MTZ and HTZ Uncompressed

Further info

4BD3E Animated section of MTZ background Uncompressed

Further info

4BF7E Pulsing ball in OOZ Uncompressed

Further info

4C0FE Square rotating around ball in OOZ Uncompressed

Further info

4C4FE Oil in OOZ Uncompressed

Further info

4D4FE Flipping foreground section in CNZ Uncompressed

Further info

4EEFE Bonus pictures for pokie in CNZ Uncompressed

Further info

4FAFE Animated background section in CPZ and DEZ Uncompressed

Further info

4FCFE Waterfall patterns from ARZ Uncompressed

Further info

50000 Patterns for Sonic Uncompressed

Further info

64180 Patterns for Tails Uncompressed

Further info

6FBE0 Unknown offset index

Further info

6FD8C Data that offset index is linking to (something to do with mappings for sonic)

Further info

714E0 Unknown offset index

Further info

7168C Data that offset index is linking to (something to do with mappings for sonic)

Further info

71D8E Bubble Art compression
32 blocks
71F14 Invincibility stars Art compression
00, 34 blocks
71FFC Splash in water Uncompressed

Further info

7287C Smoke from dashing Uncompressed

Further info

7393C Supersonic stars Art compression
00, 14 blocks
739E2 Unknown offset index

Further info

73AF8 Data that offset index is linking to (something to do with mappings for tails)

Further info

7446C Unknown offset index

Further info

74582 Data that offset index is linking to (something to do with mappings for tails)

Further info

74876 SEGA patterns Art compression
127 blocks
74F6C Main patterns from title screen Art compression
336 blocks
7667A Sonic and tails from title screen Art compression
674 blocks
78CBC A few menu patterns Art compression
10 blocks
78DAC Button Art compression
16 blocks
78E84 Vertical spring Art compression
00, 20 blocks
78FA0 Horizontal spring Art compression
12 blocks
7906A Diagonal spring Art compression
00, 32 blocks
7923E Score, Rings, Time patterns Art compression
24 blocks
79346 Sonic lives counter Art compression
12 blocks
7945C Ring Art compression
00, 14 blocks
79550 Monitors and contents Art compression
60 blocks
7995C Spikes Art compression
8 blocks
799AC Numbers Art compression
18 blocks
79A86 Starpoll Art compression
00, 16 blocks
79BDE Signpost Art compression
78 blocks
7A1A0 Signpost Uncompressed

Further info

7AB4A Strange spring from CPZ and ARZ Art compression
00, 28 blocks
7AC9A Long horizontal spike Art compression
00, 8 blocks
7AD16 Bubble man, and bubbles from bubble man Art compression
00, 37 blocks
7AEE2 Bubbles from character Art compression
00, 10 blocks
7AF82 Countdown text for drowning Uncompressed

Further info

7B400 Game/Time over text Art compression
34 blocks
7B592 Explosion Art compression
68 blocks
7B946 Miles life counter Art compression
00, 12 blocks
7BA32 Egg prison Art compression
49 blocks
7BDBE Image of tails in plane when sonic is on final frame at end of game Art compression
00, 36 blocks
7C0AA Sonic continue Art compression
12 blocks
7C20C Tails life counter Art compression
12 blocks
7C2F2 Tails continue Art compression
12 blocks
7C43E ASCII characters used in game Art compression
00, 88 blocks
7C9AE 1P/2P wins text from 2P mode Art compression
38 blocks
7CD30 Sonic/Miles animated background from options and level select menu Uncompressed

Further info

7D22C Title card patterns Art compression
94 blocks
7D58A Alphabet for font using large broken letters Art compression
92 blocks
7D990 A menu box with a shadow Art compression
21 blocks
7DA10 Pictures in level preview box in level select Art compression
170 blocks
7E86A Unknown. More text I haven't figured out Art compression
68 blocks
7EB58 Text for end of special stage, along with patterns for 3 emeralds. Art compression
72 blocks
7EEBE "Perfect" text Art compression
00, 14 blocks
7EF60 Bluebird Art compression
00, 16 blocks
7F0A2 Squirrel Art compression
00, 20 blocks
7F206 Mouse Art compression
00, 20 blocks
7F340 Chicken Art compression
16 blocks
7F4A2 Beaver Art compression
00, 20 blocks
7F5E2 Penguin Art compression
16 blocks
7F710 Pig Art compression
18 blocks
7F846 Seal Art compression
00, 14 blocks
7F962 Penguin Art compression
00, 18 blocks
7FADE Turtle Art compression
00, 20 blocks
7FC90 Bears Art compression
00, 20 blocks
7FDD2 Rabbit Art compression
00, 18 blocks
7FF2A Rivet thing that you bust to get inside ship at the end of WFZ Art compression
00, 4 blocks
7FF98 Breakaway panels in WFZ Art compression
15 blocks
8007C Spiked ball from OOZ Art compression
00, 32 blocks
80274 Unknown. HPZ style shaded blocks Art compression
6 blocks
8030A Striped blocks from CPZ Art compression
4 blocks
80376 Oil falling into oil in OOZ Art compression
16 blocks
804F2 Cascading oil from OOZ Art compression
13 blocks
805C0 Ball on spring from OOZ Art compression
20 blocks
806E0 Spinball from OOZ Art compression
53 blocks
809D0 Collapsing platform form OOZ Art compression
40 blocks
80C64 Diagonal and vertical weird spring from OOZ Art compression
30 blocks
80E26 Swinging platform from OOZ Art compression
28 blocks
81048 4 stripy blocks from OOZ Art compression
4 blocks
810B8 Raising platform in OOZ Art compression
24 blocks
81254 Fan in OOZ Art compression
30 blocks
81514 Green flame from thingy that shots platform up in OOZ Art compression
18 blocks
81600 Patterns for appearing and disappearing string of platforms in CNZ Art compression
00, 4 blocks
81668 Spiky ball from poky in CNZ Art compression
00, 04 blocks
816C8 Moving cube from either CNZ and CPZ Art compression
16 blocks
817B4 Elevator in CNZ Art compression
4 blocks
81826 Bars from pokies in CNZ Art compression
12 blocks
81894 Hexagonal bumper in CNZ Art compression
6 blocks
8191E Normal round bumper from CNZ Art compression
24 blocks
81AB0 Diagonal spring from CNZ that you pull back on Art compression
32 blocks
81C96 Vertical red spring Art compression
18 blocks
81DCC Weird blocks in CNZ that you hit 3 times to get rid of them Art compression
28 blocks
81EF2 Flippers from CNZ Art compression
52 blocks
82216 Large moving platform from CPZ Art compression
00, 10 blocks
82364 Top of water in HPZ and CPZ Art compression
00, 24 blocks
824D4 Booster things in CPZ Art compression
00, 4 blocks
8253C CPZ enemy made up of a string of balls Art compression
00, 04 blocks
825AE CPZ metal things Art compression
33 blocks
827B8 CPZ large moving platform blocks Art compression
4 blocks
827F8 Stripy blocks from CPZ Art compression
8 blocks
82864 Small yellow moving platform from CPZ Art compression
48 blocks
82A46 Moving block from CPZ Art compression
24 blocks
82C06 Spring that covers tube in CPZ Art compression
32 blocks
82E02 Top of water in ARZ Art compression
00, 16 blocks
82EE8 Leaves from ARZ Art compression
00, 07 blocks
82F74 Arrow shooter and arrow from ARZ Art compression
00, 17 blocks
830D2 One way barrier from ARZ Art compression
8 blocks
8316A Buzz bomber Art compression
00, 28 blocks
8336A Octopus badnick from OOZ Art compression
00, 58 blocks
8368A Flying badnick from OOZ Art compression
00, 56 blocks
839EA Fish badnick from EHZ Art compression
22 blocks
83BF6 Robotnic's main ship Art compression
96 blocks
84332 Robotnic enemy from CPZ Art compression
111 blocks
84890 Large explosion Art compression
00, 100 blocks
84F18 Mini explosion Art compression
00, 8 blocks
84F96 Unknown. Trail of smoke of some kind. Art compression
00, 16 blocks
8507C EHZ boss Art compression
128 blocks
85868 Chopper blades for EHZ boss Art compression
00, 20 blocks
8595C HTZ boss Art compression
00, 107 blocks
86128 ARZ boss Art compression
166 blocks
86B6E MCZ boss Art compression
204 blocks
87AAC CNZ boss Art compression
00, 133 blocks
882D6 OOZ boss Art compression
181 blocks
88DA6 MTZ boss Art compression
124 blocks
894E4 Unknown Uncompressed

Further info

89534 Blowfly from ARZ Art compression
00, 9 blocks
8970E Grounder from ARZ Art compression
00, 50 blocks
89B9A Fish from ARZ Art compression
24 blocks
89DEC Lava snake from HTZ Art compression
00, 19 blocks
89FAA Enemy with spike cone on top form HTZ Art compression
20 blocks
8A142 Circular badnick from SCZ Art compression
28 blocks
8A362 Turtle badnick from SCZ Art compression
00, 57 blocks
8A87A Coconuts from EHZ Art compression
38 blocks
8AB36 Snake like badnick from MCZ Art compression
10 blocks
8AC5E Firefly from MCZ Art compression
00, 20 blocks
8AD80 Praying mantis badnick from MTZ Art compression
00, 32 blocks
8B058 Crab badnick from MCZ Art compression
00, 36 blocks
8B300 Exploding star badnick from MTZ Art compression
00, 15 blocks
8B430 Weird crawling badnick from CPZ Art compression
00, 32 blocks
8B6B4 Spider badnick in CPZ Art compression
00, 45 blocks
8B9DC Scratch from WFZ Art compression
26 blocks
8BC16 Jet like badnick from SCZ Art compression
00, 25 blocks
8BE12 Robotic sonic Art compression
00, 217 blocks
8CC44 The tornado Art compression
79 blocks
8D1A0 Wall turret from WFZ Art compression
24 blocks
8D388 Hook on chain in WFZ Art compression
00, 20 blocks
8D540 Retracting platform from WFZ Art compression
54 blocks
8D7D8 Wheel for belt in WFZ Art compression
00, 16 blocks
8D96E Moving platform in WFZ Art compression
00, 12 blocks
8DA6E Giant unused vertical red laser in WFZ Art compression
12 blocks
8DAFC Clouds Art compression
00, 18 blocks
8DC42 Red horizontal laser in WFZ Art compression
10 blocks
8DCA2 Platform that shoots sonic across from WFZ Art compression
00, 05 blocks
8DD0C Rising platforms on belt from WFZ Art compression
00, 12 blocks
8DDF6 Unused badnick in WFZ Artcompression
12 blocks
8DEB8 Vertical spinning blades from WFZ Art compression
4 blocks
8DEE8 Horizontal spinning blades from WFZ Art compression
00, 29 blocks
8E010 Platforms that tilt in WFZ Art compression
12 blocks
8E0C4 Thrust from Robotnic's getaway ship in WFZ Art compression
00, 8 blocks
8E138 Laser boss from WFZ Art compression
00, 117 blocks
8E886 Robotnic's head Art compression
00, 24 blocks
8EA5A Robotnic Art compression
76 blocks
8EE52 Robotnic's lower half Art compression
28 blocks
8EF96 Window in back that Robotnic looks through in DEZ Art compression
00, 08 blocks
8F024 Death egg Art compression
327 blocks
901A4 Bouncer badnik from CPZ Art compression
42 blocks
90520 Rocket thruster for tornado Art compression
00, 26 blocks
906DE-90973 Mappings for movie sequence and images at end of game
90974 Movie sequence at end of game Art compression
00, 193 blocks
91F3C Final image of tornado with it and sonic facing screen Art compression
00, 127 blocks
927E0 Mini pictures of tornado in final ending sequence Art compression
00, 109 blocks
92F0A Mini pictures of sonic and final image of sonic Art compression
135 blocks
93848 Mini pictures of sonic and final image of sonic in supersonic mode Art compression
117 blocks
93F3C Final image of Tails Art compression
181 blocks
94B28 Sonic the hedgehog 2 image at end of credits Art compression
72 blocks
94E74 EHZ 16x16 block mappings Compressed

Further info

95C24 EHZ/HTZ main level patterns Compressed

Further info

985A4 HTZ 16x16 block mappings Compressed

Further info

98AB4 HTZ pattern suppliment to EHZ level patterns Compressed

Further info

99D34 EHZ/HTZ 128x128 block mappings Compressed

Further info

9CFD4 MTZ 16x16 block mappings Compressed

Further info

9DB64 MTZ main level patterns Compressed

Further info

A06C4 MTZ 128x128 block mappings Compressed

Further info

A3364 OOZ 16x16 block mappings Compressed

Further info

A4204 OOZ main level patterns Compressed

Further info

A6834 OOZ 128x128 block mappings Compressed

Further info

A8D04 MCZ 16x16 block mappings Compressed

Further info

A9D74 MCZ main level patterns Compressed

Further info

AD454 MCZ 128x128 block mappings Compressed

Further info

AFFC4 CNZ 16x16 block mappings Compressed

Further info

B0894 CNZ main level patterns Compressed

Further info

B2CF4 CNZ 128x128 block mappings Compressed

Further info

B5234 CPZ/DEZ 16x16 block mappings Compressed

Further info

B6174 CPZ/DEZ main level patterns Compressed

Further info

B90F4 CPZ/DEZ 128x128 block mappings Compressed

Further info

BB944 ARZ 16x16 block mappings Compressed

Further info

BCC24 ARZ main level patterns Compressed

Further info

C1434 ARZ 128x128 block mappings Compressed

Further info

C4074 WFZ/SCZ 16x16 block mappings Compressed

Further info

C5004 WFZ/SCZ main level patterns Compressed

Further info

C7EC4 WFZ pattern suppliment to SCZ tiles Compressed

Further info

C85E4 WFZ/SCZ 128x128 block mappings Compressed

Further info

CA906-????? ????????? (Special stage stuff)
DCD68 Background patterns for special stage Art compression
127 blocks
DD48A Sonic/Miles and number text from special stage Art compression
62 blocks
DD790 "Start" patterns in special stage Art compression
48 blocks
DD8CE Stars in special stage Art compression
00, 37 blocks
DD9C8 Unknown. Text in special stage. Art compression
13 blocks
DDA7E Ring patterns in special stage Art compression
104 blocks
DDFA4 Horizontal shadow patterns in special stage Art compression
38 blocks
DE05A Diagonal shadow patterns from special stage Art compression
58 blocks
DE120 Vertical shadow patterns in special stage Art compression
25 blocks
DE188 Explosion patterns in special stage Art compression
00, 48 blocks
DE4BC Bomb patterns in special stage Art compression
80 blocks
DE8AC Emerald patterns in special stage Art compression
46 blocks
DEAF4 Unknown. Text in special stage. Art compression
99 blocks
DEEAE Sonic and tails' animation frames from special stage Art compression
851 blocks
E247E "Tails" Patterns from special stage Art compression
5 blocks
E24FE ?????????? (affected sprites in special stage)
E34EE Unknown. looks like a really crap falling water thing. Art compression
00, 12 blocks
E35F2 ?????????? (compressed block of data to do with sprites for special stage) Compressed
E427C Data block acting as seperator
E4300 Offset index of ring location lists

Further info

E4344 EHZ act 1 ring locations

Further info

E456A EHZ act 2 ring locations

Further info

E47AC Unknown (empty)

Further info

E47AE Unknown (empty)

Further info

E47B0 Unknown (empty)

Further info

E47B2 Unknown (empty)

Further info

E47B4 Unknown (empty)

Further info

E47B6 Unknown (empty)

Further info

E47B8 MTZ act 1 ring locations

Further info

E4A2A MTZ act 2 ring locations

Further info

E4C48 MTZ act 3 ring locations

Further info

E4D72 MTZ act 4 ring locations (empty)

Further info

E4D74 HTZ act 1 ring locations

Further info

E4EAA HTZ act 2 ring locations

Further info

E50E8 HPZ act 1 ring locations

Further info

E525A HPZ act 2 ring locations (empty)

Further info

E525C Unknown (empty)

Further info

E525E Unknown (empty)

Further info

E5260 OOZ act 1 ring locations

Further info

E5422 OOZ act 2 ring locations

Further info

E5598 MCZ act 1 ring locations

Further info

E570E MCZ act 2 ring locations

Further info

E5944 CNZ act 1 ring locations

Further info

E5B7E CNZ act 2 ring locations

Further info

E5E2C CPZ act 1 ring locations

Further info

E5F9E CPZ act 2 ring locations

Further info

E6150 DEZ act 1 ring locations (empty)

Further info

E6152 DEZ act 2 ring locations (empty)

Further info

E6154 WFZ act 1 ring locations

Further info

E6292 WFZ act 2 ring locations

Further info

E6294 ARZ act 1 ring locations

Further info

E642E ARZ act 2 ring locations

Further info

E6684 SCZ act 1 ring locations

Further info

E66D6 SCZ act 2 ring locations (empty)

Further info

E66D8 Data block acting as seperator

Further info

E6800 Offset index of sprite lists

Further info

E684A EHZ act 1 sprite locations

Further info

E6B7A EHZ act 2 sprite locations

Further info

E6F34 MTZ act 1 sprite locations

Further info

E73C0 MTZ act 2 sprite locations

Further info

E78EE MTZ act 3 sprite locations

Further info

E7F48 WFZ act 1 sprite locations

Further info

E82FC WFZ act 2 sprite locations (empty)

Further info

E8302 HTZ act 1 sprite locations

Further info

E8668 HTZ act 2 sprite locations

Further info

E8C80 HPZ act 1 sprite locations

Further info

E8D94 HPZ act 2 sprite locations (empty)

Further info

E8D9A Unknown (empty)

Further info

E8DA0 OOZ act 1 sprite locations

Further info

E9214 OOZ act 2 sprite locations

Further info

E968E MCZ act 1 sprite locations

Further info

E99A0 MCZ act 2 sprite locations

Further info

E9D1E CNZ act 1 sprite locations

Further info

EA3D8 CNZ act 2 sprite locations

Further info

EA9D2 CPZ act 1 sprite locations

Further info

EAD6E CPZ act 2 sprite locations

Further info

EB230 DEZ act 1 sprite locations

Further info

EB254 DEZ act 2 sprite locations (empty)

Further info

EB25A ARZ act 1 sprite locations

Further info

EB6A4 ARZ act 2 sprite locations

Further info

EBBDE SCZ act 1 sprite locations

Further info

EBD4C SCZ act 2 sprite locations (empty)

Further info

EBD52 Unknown (empty)

Further info

EBD58 Unknown (empty)

Further info

EBD5E Unknown (empty)

Further info

EBD64 Unknown (empty)

Further info

EBD66 Data block acting as seperator
EC000 ????????? (Sound effects?)
ED100 ????????? (instruments?)
F0160 Fireball from EHZ Art compression
20 blocks
F02D6 Waterfall tiles Art compression
24 blocks
F03DC Another fireball Art compression
00,16 blocks
F052A Bridge in EHZ Art compression
00, 8 blocks
F0602 Diagonally moving lift in HTZ Art compression
48 blocks
F08F6 One way barrier from HTZ Art compression
4 blocks
F096E See-saw in HTZ Art compression
24 blocks
F0B06 Fireball from HTZ Art compression
24 blocks
F0C14 Rock from HTZ Art compression
20 blocks
F0D4A Badnick from HTZ with 4 balls of fire spinning around him Art compression
4 blocks
F0DB6 Large spinning wheel from MTZ Art compression
120 blocks
F120E Indent in large spinning wheel from MTZ Art compression
9 blocks
F12B6 Unknown. MTZ block. Art compression
00, 8 blocks
F1384 Steam from MTZ Art compression
00, 15 blocks
F148E Spike from MTZ Art compression
00, 8 blocks
F1550 Similarly shaded blocks from MTZ Art compression
54 blocks
F15C6 Lava bubble from MTZ Art compression
00, 9 blocks
F167C Unknown. A steam vent? Art compression
00, 4 blocks
F16EC Things from MTZ Art compression
8 blocks
F178E Small cog from MTZ Art compression
00, 12 blocks
F1870 Unknown. Four blocks that are all the same colour from MTZ. Art compression
00, 4 blocks
F187E Large wooden box from MCZ Art compression
32 blocks
F1ABA Collapsing platform from MCZ Art compression
00, 26 blocks
F1C64 Switch that you pull on from MCZ Art compression
16 blocks
F1D5C Vine that lowers in MCZ Art compression
10 blocks
F1E06 Unknown. A log viewed from the end Art compression
00, 4 blocks
F1E8C SEGA intro sound 16000Hz mono
8-bit unsigned
PCM raw audio

Further info

F8000-????? ????????? (Midis?)

Offset indexes

An offset index is a handy way of keeping a block of data grouped together, and also replacing a whole heap of pointers. The way it works is there is a list of two byte values, and depending on the block of data the game wants to load, it will take one of those values and add it to the starting address of the offset index. The most common usage is for every act of every level value, there is an offset that acts as the pointer to the block of data to use for it. Lets look at an example:


E6800: 004A 037A 5552 5552 5552 5552 5552 5552 0734 0BC0 10EE 10EE 1748 1AFC


Now this is the beginning of the offset index for the sprite locations. Now, can you see which values are the offset for MTZ act 2? They're 0BC0. All you had to do to get that was to take the level value for MTZ, which is 04, and count across four bytes for every value it is above 00, then across another two because it's the second act. Now we take that value and using a hex calculator, add it to the address of the offset table, which is E6800. That will give us a value of E73C0, which is the address in the rom of the MTZ act 2 sprite locations.


Also notice those 5552 values in there? Well those are for the unused level values in the game. You'll see some damn weird values put in for them in many places, and that's what causes the game to lockup in the final build of sonic 2 if you try and enter one of those levels.


There are other forms of an offset index such as the one where there's just one offset per level value, and another type that actually uses a double offset index. The first is easy enough, but a double offset index will specify two values per level, but that's not for act one and two, but rather two blocks of data to use for both acts.


Main level load block

This pointer table is what is used to load up the block mappings and main level patterns for every level in the game. Here's a breakdown of the pointer table in the S2 rom:

42594-42660: Indexed main level load block

(patterns/16x16/128x128)

42594-425A0: Emerald hill zone (00)
42594: EHZ/HTZ main level patterns (95C24) [04]
42598: EHZ/HTZ 16x16 block mappings (94E74) [05]
4259C: EHZ/HTZ 128x128 block mappings (99D34) [04]
425A0-425AC: Unknown (01)
425A0: EHZ/HTZ main level patterns (95C24) [06]
425A4: EHZ/HTZ 16x16 block mappings (94E74) [07]
425A8: EHZ/HTZ 128x128 block mappings (99D34) [05]
425AC-425B8: Unknown (02)
425AC: EHZ/HTZ main level patterns (95C24) [08]
425B0: EHZ/HTZ 16x16 block mappings (94E74) [09]
425B4: EHZ/HTZ 128x128 block mappings (99D34) [06]
425B8-425C4: Unknown (03)
425B8: EHZ/HTZ main level patterns (95C24) [0A]
425BC: EHZ/HTZ 16x16 block mappings (94E74) [0B]
425C0: EHZ/HTZ 128x128 block mappings (99D34) [07]
425C4-425D0: Metropolis zone (04)
425C4: MTZ main level patterns (9DB64) [0C]
425C8: MTZ 16x16 block mappings (9CFD4) [0D]
425CC: MTZ 128x128 block mappings (A06C4) [08]
425D0-425DC: Metropolis zone act 3 (05)
425E0: MTZ main level patterns (9DB64) [0C]
425E4: MTZ 16x16 block mappings (9CFD4) [0D]
425E8: MTZ 128x128 block mappings (A06C4) [08]
425DC-425E8: Wing fortress zone (06)
425DC: WFZ/SCZ main level patterns [10]
425E0: WFZ/SCZ 16x16 block mappings [11]
425E4: WFZ/SCZ 128x128 block mappings [0A]
425E8-425F4: Hill top zone (07)
425E8: EHZ/HTZ main level patterns (95C24) [12]
425EC: EHZ/HTZ 16x16 block mappings (94E74) [13]
425F0: EHZ/HTZ 128x128 block mappings (99D34) [0B]
425F4-42600: Hidden Palace zone (08)
425F4: OOZ 16x16 block mappings (A3364) [14]
425F8: OOZ 16x16 block mappings (A3364) [15]
425FC: OOZ 16x16 block mappings (A3364) [0C]
42600-4260C: Unknown (09)
42600: EHZ/HTZ main level patterns (95C24) [16]
42604:

EHZ/HTZ 16x16 block mappings (94E74) [17]
42608: EHZ/HTZ 128x128 block

mappings (99D34) [0D]
4260C-42618: Oil ocean zone (0A)
4260C: OOZ main level patterns (A4204) [18]
42610: OOZ

16x16 block mappings (A3364) [19]
42614: OOZ 128x128 block mappings

(A6834) [0E]
42618-42624: Mystic cave zone (0B)
42618: MCZ main level patterns (A9D74) [1A]
4261C: MCZ

16x16 block mappings (A8D04) [1B]
42620: MCZ 128x128 block mappings

(AD454) [0F]
42624-42630: Casino night zone (0C)
42624: CNZ main level patterns (B0894) [1C]
42628: CNZ

16x16 block mappings (AFFC4) [1D]
4262C: CNZ 128x128 block mappings

(B2CF4) [10]
42630-4263C: Chemical plant zone (0D)
42630: CPZ/DEZ main level patterns (B6174) [1E]
42634:

CPZ/DEZ 16x16 block mappings (B5234) [1F]
42638: CPZ/DEZ 128x128 block

mappings (B90F4) [11]
4263C-42648: Death egg zone (0E)
4263C: CPZ/DEZ main level patterns (B6174) [20]
42640:

CPZ/DEZ 16x16 block mappings (B5234) [21]
42644: CPZ/DEZ 128x128 block

mappings (B90F4) [12]
42648-42654: Aquatic ruin zone (0F)
42648: CPZ/DEZ main level patterns (BCC24) [22]
4264C:

CPZ/DEZ 16x16 block mappings (BB944) [23]
42650: CPZ/DEZ 128x128 block

mappings (C1434) [13]
42654-42660: Sky chase zone (10)
42654: WFZ/SCZ main level patterns (C5004) [24]
42658:

WFZ/SCZ 16x16 block mappings (C4074) [25]
4265C: WFZ/SCZ 128x128 block

mappings (C85E4) [14]

Now as you can see, these pointers specify the loading addresses in the rom for the 16x16 and 128x128 block mappings, as well as the main pattern block for that level. The main pattern block will always be loaded into the VRAM at address 0000. These loading addresses are all preceeded by a one byte value, so the address pointer only uses three bytes rather than the standard four. The value that proceeds the 128x128 block mappings specifies a value on the palette index to load for that level. For more information on the palette system, go here. The values preceeding the main level pattern and 16x16 block mapping pointers give the index numbers of the pattern load cue's to use for that level. For more information on that go here.

Pattern load cues

The pattern load cues are what loads all the pieces of art into the VRAM that are not in the main level load block. Here's a breakdown of the pattern load cues in the S2 rom:

00 426E6 Standard block 1 (score\time\rings/lives/ring/numbers) (3)
01 42700 Standard block 2 (starpoll/monitor/stars/bubbles) (3)
02 4271A pattern block for level with water (explosion/stars/bubbles) (2)
03 4272E game/time over (game\time over text) (0)
04 42736 EHZ (waterfall/bridge/fireball/buzz bomber/coconuts/fish) (6)
05 4275C EHZ (spikes/diagonal spring/horizontal\vertical spring) (3)
06 42776 Miles 1up patch (Miles lives counter) (0)
07 4277E Miles life counter (Miles lives counter) (0)
08 42786 Tails 1up patch (Tails lives counter) (0)
09 4278E Tails life counter (Tails lives counter) (0)
0A 42796 MTZ (Wheel/Unknown/Unknown/MSC from MTZ/steam/Unknown/MTZ spike/Badnick/starbomb) (8)
0B 427CE MTZ (Button/spikes/Mantis/vertical spring/horizontal spring/Unknown/Lava bubble/Cog/Unknown) (8)
0C 42806 WFZ (Tornado/clouds/vertical blades/horizontal blades/jet badnick/unknown/scratch/tilting platforms/tornado/clouds) (9)
0D 42844 WFZ (vertical blades/ horizontal blades/ unknown/ turret/ unknown/ unknown/ unknown/ unknown/ belt/ platforms/ retracting platform/ unknown/ trolley/ rivet/ unknown) (D)
0E 4289A HTZ (fireball/rock/conveyor/orbit badnick/unknown badnick/unknown badnick/spikes/diagonal spring/vertical spring/horizontal spring) (9)
0F 428D8 HTZ (lift/fireball/unknown) (2)
10 428EC OOZ (green flame/raising platform/spikeball/unknown/unknown/cascading oil/unknown/unknown) (8)
11 42924 OOZ (unknown/ unknown/ swinging platform/ unknown/ fan/ button/ spikes/ diagonal spring/ vertical spring/ horizontal spring/ seahorse/ octopus) (B)
12 4296E MCZ (box/collapsing platform/vine switch/lowering vine/firefly/unknown badnick) (5)
13 42994 MCZ (long horizontal spike/ spikes/ unknown/ other spring/ vertical spring/ horizontal spring) (5)
14 429BA CNZ (unknown badnick/ moving cube/ unknown/ unknown/ unknown/ unknown/ unknown/ unknown/ unknown/ destroyable blocks) (9)
15 429F8 CNZ (poky spring/vertical red spring/spikes/diagonal spring/vertical spring/horizontal spring) (5)
16 42A1E CPZ (CPZ stuff/CPZ stuff/booster/moving platform/small moving platform/spring cap/water surface/moving block/CPZ platform blocks) (8)
17 42A56 CPZ (unknown badnick/unknown badnick/spikes/unknown/other spring/vertical spring/horizontal spring) (6)
18 42A82 DEZ (stripy blocks from CPZ) (0)
19 42A8A DEZ (robotic sonic/unknown/Robotnic/Robotnic's head/Robotnic's lower half) (4)
1A 42AAA ARZ (one way barrier/water surface/leaves/arrow shooter) (3)
1B 42AC4 ARZ (shark/blowfly/grounder/bubbles/spikes/other spring/vertical spring/horizontal spring) (7)
1C 42AF6 SCZ (tornado) (0)
1D 42AFE SCZ (clouds/vertical blades/horizontal blades/jet badnick/turtle badnick/bomber) (5)
1E 42B24 Sonic end of level results screen (title card patterns/unknown/sonic continue/perfect text) (3)
1F 42B3E End of level signpost (signpost) (0)
20 42B46 CPZ boss (Robotnic's main ship/CPZ boss/mini explosion/unknown/large explosion) (4)
21 42B66 EHZ boss (Robotnic's main ship/EHZ boss/chopper blades/large explosion) (3)
22 42B80 HTZ boss (Robotnic's main ship/HTZ boss/large explosion/unknown) (3)
23 42B9A ARZ boss (Robotnic's main ship/ARZ boss/large explosion) (2)
24 42BAE MCZ boss (Robtnic's main ship/MCZ boss/large explosion) (2)
25 42BC2 CNZ boss (Robotnic's main ship/CNZ boss/large explosion) (2)
26 42BD6 MTZ boss (Robotnic's main ship/MTZ boss/mini explosion/large explosion) (3)
27 42BF0 OOZ boss (OOZ boss/large explosion) (1)
28 42BFE Unknown (large explosion) (0)
29 42C06 Death egg (Death egg) (0)
2A 42C0E EHZ animals (squirrel/blue bird) (1)
2B 42C1C MCZ animals (rat/chicken) (1)
2C 42C2A HTZ/MTZ/WFZ animals (beaver/penguin) (1)
2D 42C38 DEZ animals (pig/chicken) (1)
2E 42C46 Unknown (HPZ animals) (rat/seal) (1)
2F 42C54 OOZ animals (penguin/seal) (1)
30 42C62 SCZ animals (turtle/chicken) (1)
31 42C70 CNZ animals (bears/blue bird) (1)
32 42C7E CPZ animals (rabbit/penguin) (1)
33 42C8C ARZ animals (penguin/blue bird) (1)
34 42C9A Special stage (emerald/unknown/special stage text/horizontal shadow/diagonal shadow/vertical shadow/explosion patterns/special stage ring/"Start"/unknown/special stage background/stars/"Tails") (C)
35 42CDE Unknown (Unknown) (0)
36 42CF4 Boss at end of WFZ (Laser boss from WFZ/Robotnic/Robotnic's head/Robotnic's lower half/explosion) (4)
37 42D12 Tornado at end of WFZ (tornado/rocket thruster from tornado/clouds) (2)
38 42D26 Egg prison (egg prison) (0)
39 42D2E Normal explosion (explosion) (0)
3A 42D36 Tails end of level results screen (title card patterns/unknown/tails continue/perfect text) (3)


This pointer list has an offset index to locate the correct cue. Go here for an explanation of how this works. Now, each load cue has a two byte value before it that specifies how many addresses are in the cue, to avoid it reading too far, and going into the next cue. This value is dead simple, just enter the number of patterns on the cue in hex between the first two bytes, but you have to count 00 as 1, so if there was 16 loading addresses in the cue, you'd have 000F preceding it. After that, there are 6 bytes per load request. The first four bytes are a pointer to the art block to use, and the two bytes after that are the location in the VRAM to load them into.To change the pattern load cue's being loaded for a level, you need to change the values in the main level load block. For more information on that go here.

Collision definitions

Ok, I’m going to explain how collision works on objects that are not sprites in the sonic games. First of all forget the image that the block contains. The image has absolutely nothing to do with the collision. There's basically in invisible collision box on top of every 16x16 block that sets what's solid and what's not. This collision box has two parts to it. The main part of it is the collision array (an array is basically a table of values). The collision array stores the actual data that says that is a block is solid in certain places. It does that through 16 bytes per collision box. To understand how those 16 bytes set what's solid, imagine a 16x16 block. Now imagine that 16x16 block with the numbers 1-10 (hex) down the side starting from the bottom and going up to the top, and starting from the left and going up as it moves right along the top, so that you can give an exact location of each pixel. (eg, the top left pixel would be 10,00) Now, in this array the first two bytes define what's solid for the row of pixels on the left side of that 16x16 block. Basically the first of those two bytes says where to start making things solid, and the second byte says where to stop making them solid. So if you entered the value 0010, the first row would be solid from the very bottom of the block all the way up to the top. If you were to enter the value 020E, there would be two pixels on either side of the block that are not solid, and everything in the middle would be. The next two bytes after that are for the next row, etc. After 16 bytes the definitions for the next collision box begin.


Now, to specify which blocks use which collision boxes, there are collision indexes, which give an array location for each 16x16 block. If you look at the space used by the collision array, you can divide that by 16 (the number of bytes used by each entry into the array) to give a one byte value, which represents the maximum number of collision boxes that the array can hold in the S2 platform, which is FF. Now, for each level there is at least one 16x16 collision index, and that index consists of a whole heap of array locations, one for each 16x16 block. If for example you wanted the 9th 16x16 block to use the collision box with an array location of 3E, you would give the 9th byte of the collision index for that level a value of 3E.


It is through collision indexes that the loops work in the game. It's commonly believed that there are layers, and that the sprite represented by 4 rings changes between them. This is partly true. For any levels that use multiple layers like that, there is a secondary 16x16 collision index. That object switches the 16x16 collision index in use. The pointers to these 16x16 collision indexes are stored at 49E8-4A70. The first set of pointers in this group specify the location of the primary collision index to use for each level, and the second set specify the location of the secondary collision index to use for each level.


Now just setting something as solid, doesn't give it the effect of having a slope. There's an index in the rom, which has one byte in it for each collision array location. To understand how this value works, think of two lines running parallel to each other, both with the value 0-F along them. Now, the first value of the byte gives a point on the right line, and the second value gives a point on the left line. Now imagine drawing a line between these to points. If the points are different, the resulting gradient will be taken to create the effect of a slope and the resistance going up it on the box in the corresponding collision array location.


Level layout

The level data in the S2 rom is compressed. Editing compressed data is extremely impractical, so you can either extract it first using an extraction program such as ChaoSaX-Extract, and once it's in that form refer to my savestate hacking info for information on how to edit it. Once you've finished editing it you can then use the soon to be added compression routine in ChaoSax-Extract to recompress it, and then you can place it back into the rom. If it is a larger size than the original, you will need to fiddle around with the locations and the offset index to get it back in.

Ring placement

The data for ring placement has an offset index to locate the correct group. Go here for an explanation of how this works. Now, in the rom each ring does not have to be stored individually. Instead you can place one ring, and specify that a certain number of rings come after it. The definitions for one ring takes up 4 bytes in the rom. Let's look at an example:
1234 5678
Now, in this example the ring will be placed at an x location of 1234, and a y location of 678. With that value where the 5 was entered, if the value entered is below 8, an additional ring will be placed next to the one before it for every unit that the value entered is above 0. Entering a value above 8 will place an additional ring below the one before it for each unit that the value entered is above 8. When specifying a position as the start of a group of rings, if the group is horizontal, the rings will go across to the right of that point, and if the group is vertical the rings will go down from that point. The value FFFF closes the group of ring locations, and it is essential that this is at the end of the ring locations list, or else the game will keep on reading past that point until it hits that value.

Sprite placement

Sprites are quite simple to define. It takes six bytes to define one sprite. The first two bytes are the x location of the sprite, and the next two bytes are the y location of the sprite. The 5th byte is the number on the sprite array to lookup to get the location for the function to use for the programming of that sprite, and the 6th byte is an optional declaration to use with the function for that sprite. Go here for more info on what exactly that means, and a list of all the sprites in the S2 rom.

Main level block mappings

The block mappings in the S2 final rom are compressed. If you want to edit them you need to extract them first, edit them, and then recompress them afterwards. For more information on exactly what the block mappings do, and how to edit them, refer to the sonic 2 savestate breakdown. Note that the 16x16 block mappings in the S2 beta rom are not compressed, so if any port from the beta to the final is to be successful, those mappings will need to be compressed first.

Main level pattern blocks

Unlike the beta, the main pattern block for the levels do not use the standard art compression format, but a less complex one to allow the patterns to be loaded faster into the VRAM, and hence cut down on loading times for levels significantly. Also unlike the standard art compression format, this one has been cracked. A decompression utility such as ChaoSaX-Extract is capable of decompressing these patterns. If a port is to be done from the beta, it will be necessary to either allow the game to decompress the main pattern block into the VRAM, and then recompressing the appropriate blocks manually and putting them into the rom, or just cheat and stick these patterns on the pattern load cue. That is rather sloppy though. For information on how to edit extracted patterns, refer to the Sonic 2 savestate breakdown.

Uncompressed art

Any art that needs to be updated on the fly will not be compressed in the rom. This is because the game can't work with compressed data, and needs to extract any data it wants to use to the ram. This decompression process takes a fair bit of computation, and because of that it wouldn't be possible to create the appearance of a smooth animation using compressed data. The same reason is true as to why any data that is not loaded into the ram will always be uncompressed, because otherwise they would have to load it into the ram just to read it.

Now, for example all of the blocks for Sonic and Tails are uncompressed, because they of course need to be updated quickly. You can use basically any editing utility to edit them, but you can only change what each block looks like through this. In order to edit what blocks are placed where in each of Sonic's animation frames, you need to edit the mappings for them, and for more information on that go here. Now in their uncompressed form, you can edit them just like you would in the VRAM, so for more information on that check the sonic 2 savestate breakdown.


Mappings for Sonic/Tails

What the mappings do is they tell the game what patterns to display, and where to put them for each of the frames that the sprite has. The mappings for most sprites are contained within their function (go here for more details), but with the Sonic and Tails sprites, to allow the programmers to add a new frame easily without having to recompile the function, and hence the whole game because of the size difference, they created a separate array containing the mapping data for each frame. I haven't examined this to see how it works yet, but when I do I’ll explain the format here.

Sega intro sound

The Sega intro sound is just a 16000HZ wav sound. Opening up the rom in any sound editing program that supports raw audio with the settings listed next to the location on the list will enable you to playback the sound effect. You could also insert your own sound in the same place as long as it's at the same bitrate. The bitrate is to do with the quality of the sound. The lower it is the crappier it will sound, because that's to do with how often the output is modified. Just think of the difference between long play and short play on a VCR. Stuff recorded in long play does save space, but the quality of the recording is worse.

Art compression format

The art compression format is a very dense compression format. It's only used for art because the format relies on the data being in blocks of 64 bytes. This format is used for all the compressed art in sonic 1 and sonic 2 beta, and all the compressed art except for the main level pattern blocks in Sonic 2 and S3&K. As I said this format is very dense, and as such it requires a hell of a lot of computation to decompress. Because of this it also requires a hell of a lot of time and effort to crack. I've had a go at it, but the lightning has yet to strike. When I crack it I’ll post the format breakdown here, and create a simple program to decompress it, but until then it is impossible to directly edit any art using this format. The porting of a compressed block of art is simple though, so if you want to transfer beta art to the final, you can just tack it onto the end and enter the pointer into the pattern load cue of the level or event you want it to appear at, along with a VRAM location to load it into. Go here for more information on that.

Dynamic pattern reloading

Dynamic pattern reloading is a method of loading patterns into the VRAM, but unlike the other methods, this one has no limitations, because it uses actual programmed code. Basically this is here for any effects to do with patterns changing in game that isn't posible using the normal load cue system, like the hills in the background of HTZ where the patterns to display are determined by the position of the screen. Because the programming for it is in the form of compiled code, direct editing of it is not possible.

Animated pattern load cue's

Animated patterns require the art they are working with to be in an uncompressed form, so if you are attempting to make an animated pattern, make sure the art is uncompressed or it won't work. Now, the length of each load request on the cue varies depending on the animation. The first byte specifies a value that will determine how often to switch frames in the animation. If you use this value you will not be able to specify a frame as having a different duration to another. Setting this to FF will disable automatic frame control and allow the user to input a manual duration for each frame. This will mean that for every frame the user wants in the animation, they have to allow another byte at the end of the load request. If you want automatic pattern control, which you would use if you want all the animations frames to have the same duration. Just enter how many screen refreshes to wait until the next frame of the animation is displayed. Bytes 2,3, and 4 are the address in the rom to load the patterns from. Bytes 5 and 6 are the location in VRAM to load the patterns into. Byte 7 is the number of frames the animation has, and byte 8 is the number of spaces in VRAM to use for each frame. The function of the bytes beyond this point depend on whether or not automatic frame control is enabled, so refer to appropriate section below.

With automatic frame control:
One byte per frame of animation. This byte simply specifies the image to use for each frame of the animation. Based on the loading address entered, this value is the offset in 8x8 blocks to load each frame from in the rom. So if for example you were dealing with an animation that had 4 8x8 blocks per frame, and there were 4 frames of that, and you wanted it to display each frame one by one, you would enter the value 0004 080C.


Without automatic frame control:
Two bytes per frame of animation. The first byte is the offset of blocks in the file to load the animation frame from. This byte simply specifies the image to use for each frame of the animation. Based on the loading address entered, this value is the offset in 8x8 blocks to load each frame from in the rom. The second byte is the number of screen refreshes to keep that image loaded for, before going on to the next animation frame.

Misc sprite definitions

It looks like there are some sprites that get thier mappings and whatnot from this index, so they can reuse just a couple of sprites for some of the the miscellaneous objects in a level that the character doesn't actually interact with, but those objects can be completely different from one level to the next. A handy way of avioding programming each one individually, and thus saving a hell of a lot of space. As for how to edit them, well I haven't looked at that yet, but when I do i'll post an explination of the format here.

Rasterised layer deformation

Raster effects are simply effects to do with deformation of an image based on lines of pixels. In Sonic 2, these effects are used to create the movement effects for the backgrounds of all the levels, as well as the 2 player splitscreen effect. Because the programming for these effects are stored in the form of compiled code, you'll have to learn 68K ASM in order to edit them. Switching between levels is easy enough though, just change the corresponding value on the preceeding offset index to link to the effect you wish to use.

Palettes

All the main palettes used in the game are linked in a pointer table at 294E. In this pointer table there are 8 bytes per palette. The first four simply give a location in the rom for the data to load. The fifth and sixth bytes give the location in the system ram to load the data into, and the seventh and eighth bytes give the number of bytes being loaded. Here's a palette pointer:

0000 2942 FB20 0007

Now in this case the palette is being loaded from 00002942 in the rom into the beginning of the second above water palette row (FB20), and it's loading 4 colours (0007). Here's a listing of the palette pointers in the S2 rom:

00 2782 SEGA screen palette (28C2)
01 278A Title screen palette (2942)
02 2792 Unknown palette (2962)
03 279A "Sonic and Miles" screen palette (29E2)
04 27A2 EHZ palete (2A22)
05 27AA Level value 01 palette (2A22)
06 27B2 WZ palette (2A82)
07 27BA Level value 03 palette (2A22)
08 27C2 MTZ palette (2AE2)
09 27CA MTZ act 3 palette (2AE2)
0A 27D2 WFZ palette (2B42)
0B 27DA HTZ palette (2BA2)
0C 27E2 HPZ palette (2C02)
0D 27EA Level value 09 (2A22)
0E 27F2 OOZ palette (2CE2)
0F 27FA MCZ palette (2D42)
10 2802 CNZ palette (2DA2)
11 280A CPZ palette (2E02)
12 2812 DEZ palette (2EE2)
13 281A ARZ palette (2F42)
14 2822 SCZ palette (3022)
15 282A HPZ underwater palette (2C62)
16 2832 CPZ underwater palette (2E62)
17 283A ARZ underwater palette (2FA2)
18 2842 Main special stage palette (3162)
19 284A Unknown palette (3082)
1A 2852 Unknown palette (30A2)
1B 285A Special stage 1 palette (31C2)
1C 2862 Special stage 2 palette (31E2)
1D 286A Special stage 3 palette (3202)
1E 2872 Special stage 4 palette (3222)
1F 287A Special stage 5 palette (3242)
20 2882 Special stage 6 palette (3262)
21 288A Special stage 7 palette (3282)
22 2892 Unknown palette (32A2)
23 289A Unknown palette (32C2)
24 28A2 Unknown palette (32E2)
25 28AA OOZ boss palette (30C2)
26 28B2 Menu palette (30E2)
27 28BA Unknown palette (3302)

To change the palette being loaded for each level, you need to change the palette index number in the main level load block. For more information on that go here. The palettes themeslves are very easy to modify as they are all uncompressed in the rom. Refer to the savestate hacking documents for information on how to edit palettes.

Level size array

All the sizes of the levels are stored in a simple array, and can be easily modified to change the boundaries of the level. This array is located at C054, and for each act there are four values. The first gives the X start location of the level, and the second gives the X end location of the level. Likewise the third value gives the Y start location of the level, and the fourth gives the Y end location of the level.

Character start location array

The start location for the characers and the camera for each level are stored in this array at address C1D0. It couldn't be any simpler to modify, there's just two values per act, the first being the X location, and the second being the Y location.

Music playlist for levels

This is actually part of a sub in the code, but it's editable all the same. Pretty simple, just one byte per level. That one byte is the value of the song you wish to play. You must enter the value in the form in which it is displayed in the beta version, which is with 80 as the starting value, not 00 as it is displayed in the final. You'll notice with the value for death egg, it's 08 not 88, which is why there's no sound in the level.

Level order

There are several different sections in the game to do with the order of levels. The first one is the one that determins which level the game loads when someone finishes a level. The second one is the one which determins which level to load when you select a level from the level select menu. The level select one is easy to modify, just enter the level value followed by an act number for each of the levels you want to load, in the order you want them to be loaded. For a list of the level values for all the different stages, look at the beginning of the introduction to this page. Note that if you load the same level into the level order twice, when you link to it via the level select, it will continue the sequence from the last one in the list, not the first.

The second system for which level to load when one ends works slightly differently. There is a list of values, with two bytes allocated to each act of each level. That two byte value is simply the value of the level you wish to load when that level ends. So, if you wanted ARZ act 1 to load up when you finish MTZ act 2, you would take the location of the table, which in this case is 142F8, and you would add 18 bytes to that location, and then you would replace the next two bytes from that point with 0F00. That's becuase you add four bytes to the address for every level that comes before it, and in this case there are 4, and then you would add another 2 bytes becuase you want to alter the level to load when you finish the second act.

Also, note that when you want a level to be the last level in the game, you must enter the value FFFF as the stage to load when it finishes. This tells the game to end and return to the title screen.


Object debug list

This list is what determins what sprites you can place in debug mode, and in what levels. An offset index is used to locate which object debug list to use for which level, so if you want further info on that go here. Now, there is a 2 byte value at the start of each debug list. That 2 byte value is simply the number of sprites in the list. After that there are 8 bytes per sprite. Here's an object that's present in an object debug list from sonic 2:

2601 2D36 0800 0680
1 2 3 4 5 6 7 8


And here's a quick referance sheet of what each byte does. For further info on each one, refer to information below.

1 Object number
2-4 Sprite mappings
5 Declaration
6 Frame to display
7 and 8 flip/mirror/palette/VRAM location


Object number:
This value is what determins which object to use. For a list of all the sprites in the game, check out the sprite programming section of this document here. In the case of the above example the object number is 26, which is a monitor.

Sprite mappings:
This is a pointer to the location in the rom to load the mappings for that sprite. This will be located in the programming for the sprite itself. Do not change this unless porting between levels, or you're absolutely sure you know what you're doing, or the game will most likely hang. This only affects the preview picture, not the placed object itself. In this case, the sprite mappings are being loaded from the address 012D36 in the rom.

Declaration:
This is the declaration for the loading of the sprite. For information on exactly what that is, go here. In this example the declaration is 08, which switches the type of monitor it is in the case of this sprite.

Frame to display:
This is simply the frame of the sprite that will be displayed on the preview picture before you place an object. Right now it's set to 00, which is the first frame.

Flip/mirror/VRAM location:
The first hex value of the 7th byte is to do with flipping and mirroring of the sprite, as well as the palette line to use for it. Refer to the following table for an explination of what responce each value will create.

Value palette line flipped horizntally flipped vertically
0 1 n n
1 1 n y
2 2 n n
3 2 n y
4 3 n n
5 3 n y
6 4 n n
7 4 n y
8 1 n n
9 1 y n
A 2 n n
B 2 y n
C 3 n n
D 3 y n
E 4 n n
F 4 y n

In the case of our example, the value of 0 is used, so the preview image will use the first palette line, and will not be flipped or mirrored.

The last hex value of the 7th byte, and all of the 8th byte in this block combine to give a starting location in the VRAM to find the patterns to use for that sprite when displaying the preview. This is not an actual location, but merely the number of blocks after which to load the patterns from. After the value of 800 is passed, the block number resets to zero but the image is mirrored. In this case, that block number is 680.

And that's about it. I've just realised that this is a rediculous amount of detail for such a small thing, but at least you're sure to get it.

Sprite programming

The programming for a sprite in the sonic games are stored as a function, and that function can take one declaration. People often confuse this declaration with a subtype value, but it's not really. What that basically means for the non programmers out there is that when the game places a sprite, you can enter a value along with the sprite number that may alter something about that sprite, but what it does varies depending on what sprite you're working with. Now because these functions are now compiled, the only way you can effectively edit them is to find the code for it and decompile it into assembly, alter it as necessary, and then recompile it and enter it back into the rom. This document will contain all the info necessary to enter a new sprite or replace an old one, but when it comes to the ASM you're on your own.

Now, the value assigned to a sprite in the game is done by a pointer index at 1600C-1637C. It’s Pretty simple, just one pointer per address value. Here's the pointer list in Sonic 2. I've named all the ones I could at the time. I made this list quite a while ago though, and I think I could do a better job if I redid it now, but I can't be stuffed doing it at this point in time.

1 Sonic [19F50]
2 Tails [1B8A4]
3  ??????? [1FCDC]
4  ??????? [208DC]
5  ??????? [1D200]
6 Rotating cylinder in Metropolis zone [214C4]
7 Oil (stretches across entire map) [24020]
8 Unknown (some kind of vertical barrier, but barrier is not visible) [1DD20]
9  ??????? [338EC]
A  ??????? [1D320]
B Section of pipe that tips you off from chemical plant zone [2009C]
C Unknown (some strange thing that bobs up and down. Possibly top of water in HPZ.) [20210]
D Unknown (hit it from left or right and get thrown back faster than should be possible) [191B8]
E Flashing stars from intro [12E18]
F  ??????? [13600]
10 Unknown (tails won't move) [347EC]
11  ??????? [F66C]
12 Master emerald [2031C]
13  ??????? [203AC]
14 See saw thingy from hill top zone [21928]
15 Swinging platform from ARZ [FC9C]
16 Diagonally moving lift thing from HTZ [21DAC]
17 Unknown (looks like some sort of steam burst like from MTZ) [10310]
18 Stationary floating platform from ARZ [104AC]
19 Unknown (some kind of floating platform that moves back and forth, but not very far) [22018]
1A Collapsing platform from either OOZ or MCZ [108BC]
1B Booster things from CPZ [222AC]
1C  ??????? [111D4]
1D Unknown (seemed to have a random area within a set distance from the sprite in which you could get hurt.) [22408]
1E Spin tube from CPZ [2259C]
1F Collapsing platform from OOZ [10A08]
20 Unknown (lava bomb that Robotnic drops in HTZ?) [22FF8]
21 Unknown (sprite just changes between two palette lines) [80BE]
22 Arrow shooter from ARZ [25694]
23 Pillar that drops it's lower part from ARZ [2588C]
24  ??????? [1F8A8]
25 A ring [11F44]
26 Monitor [12670]
27 An explosion of an enemy, giving off an animal and 100 points [21088]
28 An animal and the 100 that are given off from busting a badnick [1188C]
29 The 100 [11DC6]
2A Stomper from MCZ [115C4]
2B Raising pillar from ARZ [25A5A]
2C Sprite that makes leaves fly off when you hit it from ARZ [26104]
2D One way barrier from CPZ and DEZ [1169A]
2E Image of what was in monitor flying up like it does when you bust it [12854]
2F Unknown (a small block) [23300]
30 Unknown (something you can't see with a collision box the size of the whole damn screen) [238DC]
31 Lava collision marker [20DEC]
32 Unknown (A block that when you hit it from the top you get 100 points, and it then splits into six pieces which fly down off the screen) [2351A]
33 Platform that shoots up in the air from oil ocean zone [23AF4]
34 Sprite for level title card [13C48]
35  ??????? [1D97E]
36 Vertical spikes [15900]
37 Sprite of rings spraying out from being hit by an enemy [12078]
38 Shield that surrounds character [1D8F2]
39 Unknown (sprite comes from the left, and sits on the screen near the centre. If you press jump it will reset to Sega logo. Possibly game over sprite.) [13F74]
3A End of level result screen [14086]
3B Unknown (a block) [15CC8]
3C Unknown (a barrier you can smash by dashing into. Like the rock barriers in Sonic 3.) [15D44]
3D Block thingy in OOZ that launches you into the round ball things [24DD0]
3E Egg prison [3F1E4]
3F Fan blowing to the left from OOZ [2A7B0]
40 Weird lever like spring from CPZ and ARZ [26370]
41 Red spring facing upwards [18888]
42 Thing that pops up and releases steam sideways from metropolis zone [26634]
43 Spiky ball from OOZ [23E40]
44 Star ball that sonic bounces off from CNZ [1F730]
45 Strange spring from OOZ facing vertically [240F8]
46 Ball sitting on strange spring from OOZ [24A16]
47 Button [2FCF4]
48 Thingy from OOZ that you enter when flying as a ball, and it turns and throws you another direction [25244]
49 Unknown (Huge vertical laser from WFZ?) [20B9E]
4A Octopus badnick from OOZ [2CA14]
4B Buzz bomber from EHZ [2D068]
4C  ??????? [1637C]
4D  ??????? [1637C]
4E  ??????? [1637C]
4F  ??????? [1637C]
50 Seahorse badnick from OOZ [2CCC8]
51 CNZ boss [318F0]
52 HTZ boss [2FC50]
53 Things spinning around MTZ boss [32940]
54 MTZ boss [32288]
55 OOZ boss [32F90]
56 EHZ boss [2EF18]
57 MCZ boss and Earthquake [30FA4]
58 Unknown (some kind of really big explosion?) [2D494]
59 Unknown (alters the palette to put in some colours that look really awesome in ARZ, then teleports you back to x0 y0 and doesn't allow you to move) [35FBC]
5A  ??????? [35554]
5B  ??????? [353FE]
5C Shark badnick from EHZ [2D394]
5D CPZ boss [2D734]
5E  ??????? [6FC0]
5F  ??????? [70F0]
60  ??????? [34FA0]
61  ??????? [34EB0]
62  ??????? [1637C]
63  ??????? [340A4]
64 Twin stompers from MTZ [26920]
65 Unknown (a long platform) [26AE0]
66 Unknown (a tall bumper from CNZ, that I don't think was ever implemented in a level) [26F58]
67 One of the spin tubes from MTZ [2715C]
68 Block that has a spike that comes out of each side sequentially from MTZ [27594]
69 Nut from MTZ [27884]
6A Unknown (jump on it and it's fine. Jump off it and it moves down) [27AB0]
6B Unknown (Same type of block as above, but it doesn't move) [27D6C]
6C Unknown (a block that moves up and to the left slowly)[28034]
6D Floor spike from MTZ [27794]
6E Unknown (a block that rotates round in a circle) [283AC]
6F End of special stage result screen [143C0]
70 Unknown (Big circle of sprites rotating around, and changing their tiles depending on their position) [285C0]
71 Unknown (six vertical blocks that change patterns) [112F0]
72  ??????? [2893C]
73 Unknown (a small thing with a picture of a ring on it) [289D4]
74 Unknown (a small block with no patterns on it) [20EE0]
75  ??????? [28BC8]
76 Spike block thing from MCZ [28DF8]
77 Unknown (long block) [28F88]
78 Stairs from CPZ that move down to open the way [291CC]
79 Starpoll [1F0B0]
7A Platform that moves back and forth on top of chemicals in CPZ [293A0]
7B Unknown (acts exactly like a spring, but tries to use level specific patterns) [29590]
7C Big pylon thing that's in the foreground in CPZ [20FD2]
7D  ??????? [1F624]
7E  ??????? [1E0F0]
7F Vine switch that you hang off in MCZ [297E4]
80 Vine that you hang off and it moves down from MCZ [2997C]
81 Unknown (Long invisible vertical barrier. Suspect it's pasted over the force fields used in the boss at the end of WFZ.) [2A000]
82 Platform that is usually swinging from ARZ [2A290]
83 3 adjoined platforms from ARZ that rotate in a circle [2A4FC]
84  ??????? [2115C]
85 Vertical spring from CNZ that you hold down jump on to pull back further [2AB84]
86 Flipper from CNZ [2B140]
87  ??????? [7356]
88  ??????? [34A5C]
89 ARZ boss [30480]
8A Unknown (a line of text on the centre of the screen. Will have to put in correct tiles to see what it says.) [3EAC8]
8B  ??????? [21392]
8C Blowfly enemy from ARZ [36924]
8D Unknown (ummm, a blowfly behind a wall like grounder is, but not exactly behind it. When it busts out weird things happen.) [36A76]
8E Unknown (Same as above) [36A76]
8F Unknown (a thing that sits in one place and does nothing. You can bust it like a badnick.) [36B88]
90 Unknown (a sprite that launches up and to the left, then curves back down. You can bust it like a badnick.) [36BD4]
91 Unknown (heads towards you. Can be busted like a badnick.) [36DAC]
92 Unknown (when you pass it, it sends a large burst up which hurts you.) [36F0E]
93 Unknown (sprite rapidly reverses direction and spirals down.) [36FE6]
94 Lava snake [37322]
95 Red circle dude from hill top zone that has lava balls circling around him that he throws at you. [370FE]
96 Lava snake... again [37322]
97 Unknown (sprite accelerates down and to the right) [373D0]
98  ??????? [376E8]
99 Bomber badnick from SCZ [377C8]
9A Turtle thing on the back of another larger turtle thing from SCZ [37936]
9B  ??????? [37A06]
9C  ??????? [37A82]
9D Coconuts (the badnick) from EHZ [37BFA]
9E Snake like badnick from MCZ that flies out from wall at you [37E16]
9F Crab like badnick from MTZ [3800C]
A0 Unknown (sprite falls down) [3815C]
A1 Praying Mantis dude from MTZ [383B4]
A2 Unknown (sprite falls down, then locks up emulator) [384A2]
A3 Glowbug from MCZ [3873E]
A4 Exploding star from MTZ [3899C]
A5 Unknown (sprite moves back and forth, throwing something at you that curves up and back down) [38AEA]
A6 Unknown (sprite moves up and down slowly, shooting a fast moving projectile down and to the left) [38B86]
A7 Spider badnick from CPZ [38DBA]
A8  ??????? [38F66]
A9  ??????? [39032]
AA  ??????? [39066]
AB Unknown (sprite sits there and does nothing. You can bust it like a badnick) [390A2]
AC Jet badnick from SCZ [3937A]
AD Unknown (appears to be a block and has no image, but if you hit it in the corner it busts like a badnick) [3941C]
AE  ??????? [39452]
AF Unknown (block that laser beams shoot from to form barrier at end of WFZ? Just a hunch.) [3972C]
B0 Unknown (weird sums it up. It alters the palette, 128x128 block mappings, and quickly moves to the left as a killable badnick. Destroying it interrupts the process of altering the block mappings data (among other things).) [3A1DC]
B1 Unknown (appears across from it's actual position and does nothing. Can be busted like a badnick.) [3A3F8]
B2  ??????? [3A790]
B3  ??????? [3B2DE]
B4 Unknown (sprite flashes between frames. Can be busted like a badnick.) [3B36A]
B5  ??????? [3B3FA]
B6 Tilting platform from WFZ [3B5D0]
B7 Unknown (sprite flashes between there and not there really fast, then disappears completely) [3B8A6]
B8 Wall turret from WFZ [3B968]
B9 Unknown (sprite flies really fast to the left. I suspect it's the laser shot from wing fortress zone.) [3BABA]
BA Unknown (sprite sits there and does nothing. Can be busted like a badnick.) [3BB4C]
BB Unknown (refer to above) [3BB7C]
BC Unknown (sprite flashes present and not present really fast) [3BBBC]
BD Unknown (sprite keeps on dropping things that fall straight down) [3BC1C]
BE Platform that pops in and out from WFZ [3BD7A]
BF Unknown (sprite flashes between frames) [3BEAA]
C0 Unknown (it appears to be a spring sort of thing that was cut from the final. It makes you bounce off to the left without gaining much height.) [3BF04]
C1 Sprite that sonic hangs onto on the back of Robotnic's getaway ship at the end of WFZ [3C0AC]
C2 Rivet thing that you bust to get into the ship at the end of WFZ [3C328]
C3 Unknown (sprite moves up and to the left changing frames as it goes, then disappears completely.) [3C3D6]
C4 Unknown (same as above) [3C3D6]
C5 Laser boss guy at end of WFZ [3C442]
C6 Unknown (sprite sits there and does nothing. Can be busted like a badnick) [3CED0]
C7 Death Egg [3D4C8]
C8 Bad guy in CNZ [3D23E]
C9 Unknown (sprite changes palette) [132F0]
CA Movie sequence at end of game (will display the pictures, alter the block mappings, and after sequence is over will teleport Sonic to appropriate location on map.) [A1D6]
CB  ??????? [A9F2]
CC Unknown (appears to be later trigger of above one. It will alter block mappings and teleport sonic.) [A3C8]
CD Unknown (sprite bobs up and down, then moves off to the left) [AAAE]
CE  ??????? [A894]
CF  ??????? [A988]
D0  ??????? [1637C]
D1  ??????? [1637C]
D2 Flashing blocks in CNZ that appear and disappear in a rectangular shape that you can walk across [2B528]
D3  ??????? [2B84C]
D4 Big block from casino night zone that moves back and forth [2B8EC]
D5 Elevator going up from CNZ [2BA08]
D6 Poky that gives out points from CNZ [2BB6C]
D7 Unknown (some kind of bumper) [2C448]
D8 Block thingy in CNZ that changes colour when you hit it and gives you points, until it disappears) [2C6AC]
D9 A sprite that you can hold on to, like the rails in WFZ [2C92C]
DA Continue text (kinda funny. It uses the rings variables to store the number of seconds you have left, so it's weird to see it in a level.) [7A68]
DB Sprite of sonic lying down from continue screen [7B82]
DC  ??????? [125E6]

References


Sonic Community Hacking Guide
General
SonED2 Manual | Subroutine Equivalency List
Game-Specific
Sonic the Hedgehog (16-bit) | Sonic the Hedgehog (8-bit) | Sonic CD (prototype 510) | Sonic CD | Sonic CD (PC) | Sonic CD (2011) | Sonic 2 (Simon Wai prototype) | Sonic 2 (16-bit) | Sonic 2 (Master System) | Sonic 3 | Sonic 3 & Knuckles | Chaotix | Sonic Jam | Sonic Jam 6 | Sonic Adventure | Sonic Adventure DX: Director's Cut | Sonic Adventure DX: PC | Sonic Adventure (2010) | Sonic Adventure 2 | Sonic Adventure 2: Battle | Sonic Adventure 2 (PC) | Sonic Heroes | Sonic Riders | Sonic the Hedgehog (2006) | Sonic & Sega All-Stars Racing | Sonic Unleashed (Xbox 360/PS3) | Sonic Colours | Sonic Generations | Sonic Forces
Technical information
Sonic Eraser | Sonic 2 (Nick Arcade prototype) | Sonic CD (prototype; 1992-12-04) | Dr. Robotnik's Mean Bean Machine | Sonic Triple Trouble | Tails Adventures | Sonic Crackers | Sonic 3D: Flickies' Island | Sonic & Knuckles Collection | Sonic R | Sonic Shuffle | Sonic Advance | Sonic Advance 3 | Sonic Battle | Shadow the Hedgehog | Sonic Rush | Sonic Classic Collection | Sonic Free Riders | Sonic Lost World
Legacy Guides
The Nemesis Hacking Guides The Esrael Hacking Guides
ROM: Sonic 1 | Sonic 2 | Sonic 2 Beta | Sonic 3

Savestate: Sonic 1 | Sonic 2 Beta/Final | Sonic 3

Sonic 1 (English / Portuguese) | Sonic 2 Beta (English / Portuguese) | Sonic 2 and Knuckles (English / Portuguese)
Move to Sega Retro
Number Systems (or scrap) | Assembly Hacking Guide | 68000 Instruction Set | 68000 ASM-to-Hex Code Reference | SMPS Music Hacking Guide | Mega Drive technical information