IPB

Welcome Guest ( Log In | Register )


 

Recent Changes | Random | Help | Special Pages | Upload
home | info | forums | svn | irc | podcast | about

SCHG:Nem s2

From Sonic Retro

Contents

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:


00Emerald Hill zone
04Metropolis zone
05Metropolis zone act 3
06Wing fortress zone
07Hill Top zone
08Hidden Palace zone
0AOil Ocean zone
0BMystic Cave zone
0CCasino Night zone
0DChemical Plant zone
0EDeath Egg zone
0FAquatic Ruin zone
10Sky 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-FFVector table
100-200Header
14DE-????Programming to do wih decompression of art tiles to VRAMCompiled
2782-28C1Palette pointers
28C2Sega screen palette (00)
2942Title screen palette (01)
2962Unknown palette (02)
29E2"Sonic and Miles" screen palette (03)
2A22EHZ palette (04, 05, 07, 0D)
2A82WZ palette (06)
2AE2MTZ palette (08, 09)
2B42WFZ palette (0A)
2BA2HTZ palette (0B)
2C02HPZ palette (0C)
2C62HPZ underwater palette (15)
2CE2OOZ palette (0E)
2D42MCZ palette (0F)
2DA2CNZ palette (10)
2E02CPZ palette (11)
2E62CPZ underwater palette (16)
2EE2DEZ palette (12)
2F42ARZ palette (13)
2FA2ARZ underwater palette (17)
3022SCZ palette (14)
3082Unknown palette (19)
30A2Unknown palette (1A)
30C2OOZ boss palette (25)
30E2Menu palette (26)
3162Main special stage palette (18)
31C2Special stage 1 palette (1B)
31E2Special stage 2 palette (1C)
3202Special stage 3 palette (1D)
3222Special stage 4 palette (1E)
3242Special stage 5 palette (1F)
3262Special stage 6 palette (20)
3282Special stage 7 palette (21)
32A2Unknown palette (22)
32C2Unknown palette (23)
32E2Unknown palette (24)
3302Unknown palette (27)
3EA0-3EB0Music playlist for levelsFurther info
4948-498BPointers to demo file to use for levels
49E8-4A70Pointers to collision indexesFurther info
6FC0??????? (sprite)
70F0??????? (sprite)
7356??????? (sprite)
7A68Continue text (sprite)
7B82Sprite of sonic lying down from continue screen (sprite)
80BE??????? (sprite)
9454-947BLevel select level orderFurther info
A1D6Cut scene at end of game (sprite)
A3C8??????? (sprite)
A894??????? (sprite)
A988??????? (sprite)
A9F2??????? (sprite)
AAAE??????? (sprite)
C054-C14FLevel size arrayFurther info
C150-C1CFCode for initial character and screen placementCompiled
C1D0-C257Character start location arrayFurther info
C4FCOffset index of rasterised layer deformationFurther info
C51EUnknown (possibly title screen)Further info
C57EEHZ layer deformation info

Further info

C682Unknown (splitscreen, EHZ?)

Further info

C7F2HTZ layer deformation info

Further info

C7BAUnknown (level value 02)

Further info

C7F2Unknown (identical to WFZ)

Further info

C82AWFZ layer deformation info

Further info

C8CAUnknown (identical to HTZ)

Further info

C964HTZ layer deformation info

Further info

CA92Unknown (background fixed)

Further info

CB10Unknown (splitscreen, background locked, no deformation)

Further info

CBA0HPZ layer deformation info

Further info

CC66OOZ layer deformation info

Further info

CD2CMCZ layer deformation info

Further info

CE6CUnknown (splitscreen, background free moving, but no alteration)

Further info

D0C6CNZ layer deformation info

Further info

D194CNZ 2 player splitscreen

Further info

D27CCPZ layer deformation info

Further info

D382DEZ layer deformation info

Further info

D4AEARZ layer deformation info

Further info

D5DESCZ layer deformation info

Further info

D66601, 03, 09 layer deformation info

Further info

F66C??????? (sprite)
FC98Swinging platform from aquatic ruin zone (sprite)
10310??????? (sprite)
104ACStationary floating platform from aquatic ruin zone (sprite)
108BCCollapsing platform from either oil ocean zone or mystic cave zone (sprite)
10A08Collapsing platform from aquatic ruin zone (sprite)
111D4??????? (sprite)
112F0??????? (sprite)
115C4Stomper from MCZ (sprite)
1169AOne way barrier from chemical plant zone and DEZ (sprite)
1188CAn animal and the 100 that are given off from busting a badnick (sprite)
11DC6100 points (sprite)
11F44A ring (sprite)
12078Sprite of rings spraying out from being hit by an enemy (sprite)
125E6??????? (sprite)
12670Monitor (sprite)
12854Image of what was in monitor flying up like it does when you bust it (sprite)
12E18Flashing stars from intro (sprite)
132F0??????? (sprite)
13600??????? (sprite)
13C48Sprite for level title card (sprite)
13F74??????? (sprite)
14086End of level result screen (sprite)
142F8-1433BMain game level order

Further info

143C0End of special stage result screen (sprite)
15900Vertical spikes (sprite)
15CC8??????? (sprite)
15D44??????? (sprite)
1600CSprite programming pointers (one address per sprite value)

Further info

1637C??????? (sprite)
18888Red spring facing upwards (sprite)
191B8??????? (sprite)
19F50Sonic (sprite)
1B8A4Tails (sprite)
1D200??????? (sprite)
1D320??????? (sprite)
1D8F2??????? (sprite)
1D97E??????? (sprite)
1DD20??????? (sprite)
1E0F0??????? (sprite)
1F0B0Starpoll (sprite)
1F624??????? (sprite)
1F730Star ball that sonic bounces off from CNZ (sprite)
1F8A8??????? (sprite)
1FCDC??????? (sprite)
2009CSection of pipe that tips you off from chemical plant zone (sprite)
20210??????? (sprite)
2031CMaster emerald (sprite)
203AC??????? (sprite)
208DC??????? (sprite)
20B9E??????? (sprite)
20DEC??????? (sprite)
20FD2Big pylon thing that's in the foreground in CPZ (sprite)
21088An explosion of an enemy, giving off an animal and 100 points (sprite)
2115C??????? (sprite)
21392??????? (sprite)
214C4Rotating cylinder in Metropolis zone (sprite)
21928See saw thingy from hill top zone (sprite)
21DACDiagonally moving lift thing from hill top zone (sprite)
22018??????? (sprite)
222ACBooster things from chemical plant zone (sprite)
22408??????? (sprite)
2259CSpin tube from chemical plant zone (sprite)
22FF8??????? (sprite)
23300??????? (sprite)
2351A??????? (sprite)
238DC??????? (sprite)
23AF4Platform that shoots up in the air from oil ocean zone (sprite)
23E40Spiky ball from OOZ (sprite)
24020Oil in OOZ (sprite)
240F8Strange spring from OOZ facing vertically (sprite)
24A16Ball sitting on strange spring from OOZ (sprite)
24DD0Block thingy in OOZ that launches you into the round ball things (sprite)
25244Thingy from oil ocean zone that you enter when flying as a ball, and it turns and throws you another direction (sprite)
25694Arrow shooter from aquatic ruin (sprite)
2588CPillar that drops it's lower part from aquatic ruin zone (sprite)
25A5ARaising pillar from ARZ (sprite)
26104Sprite that makes leaves fly off when you hit it from ARZ (sprite)
26370Weird lever like spring from chemical plant zone and ARZ (sprite)
26634Thing that pops up and releases steam sideways from metropolis zone (sprite)
26920Twin stompers from MTZ (sprite)
26AE0??????? (sprite)
26F58??????? (sprite)
2715COne of the spin tubes from MTZ (sprite)
27594Block that has a spike that comes out of each side sequentially from MTZ (sprite)
27794Floor spike from MTZ (sprite)
27884Nut from MTZ (sprite)
27AB0??????? (sprite)
27D6C??????? (sprite)
28034??????? (sprite)
283AC??????? (sprite)
285C0??????? (sprite)
28BC8??????? (sprite)
28DF8Spike block thing from MCZ (sprite)
28FF8??????? (sprite)
291CCStairs from CPZ that move down to open the way (sprite)
293A0Platform that moves back and forth on top of chemicals in CPZ (sprite)
29590??????? (sprite)
297E4Vine switch that you hang off in MCZ (sprite)
2997CVine that you hang off and it moves down from MCZ (sprite)
2A000??????? (sprite)
2A290Platform that is usually swinging from ARZ (sprite)
2A4FC3 adjoined platforms from ARZ that rotate in a circle (sprite)
2A7B0Fan blowing to the left from OOZ (sprite)
2AB84Vertical spring from CNZ that you hold down jump on to pull back further (sprite)
2B140??????? (sprite)
2B528Flashing blocks in CNZ that appear and disappear in a rectangular shape that you can walk across (sprite)
2B84C??????? (sprite)
2B8ECBig block from casino night zone that moves back and forth (sprite)
2BA08Elevator going up from CNZ (sprite)
2BB6CPoky that gives out points from CNZ (sprite)
2C448??????? (sprite)
2C6ACBlock thingy in CNZ that changes colour when you hit it and gives you points, until it disappears) (sprite)
2C92CA sprite that you can hold on to, like the rails in WFZ (sprite)
2CA14Octopus badnick from OOZ (sprite)
2CCC8Seahorse badnick from OOZ (sprite)
2D068Buzz bomber from EHZ (sprite)
2D394Shark badnick from EHZ (sprite)
2D494??????? (sprite)
2D734??????? (sprite)
2EF18??????? (sprite)
2FC50??????? (sprite)
2FCF4Button (sprite)
30480??????? (sprite)
30FA4Earthquake (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)
36924Blowfly enemy from ARZ (sprite)
36A76??????? (sprite)
36B88??????? (sprite)
36BD4??????? (sprite)
36DAC??????? (sprite)
36F0E??????? (sprite)
36FE6??????? (sprite)
370FERed circle dude from hill top zone that has lava balls circling around him that he throws at you. (sprite)
37322Lava snake (sprite)
373D0??????? (sprite)
376E8??????? (sprite)
377C8Bomber badnick from SCZ (sprite)
37936Turtle thing on the back of another larger turtle thing from SCZ (sprite)
37A06??????? (sprite)
37A82??????? (sprite)
37BFACoconuts (the badnick) from EHZ (sprite)
37E16Snake like badnick from MCZ that flies out from wall at you (sprite)
3800CCrab like badnick from MTZ (sprite)
3815C??????? (sprite)
383B4Praying Mantis dude from MTZ (sprite)
384A2??????? (sprite)
3873EGlowbug from MCZ (sprite)
3899CExploding star from MTZ (sprite)
38AEA??????? (sprite)
38B86??????? (sprite)
38DBASpider badnick from CPZ (sprite)
38F66??????? (sprite)
39032??????? (sprite)
39066??????? (sprite)
390A2??????? (sprite)
3937AJet badnick from SCZ (sprite)
3941C??????? (sprite)
39452??????? (sprite)
3972C??????? (sprite)
3A1DC??????? (sprite)
3A3F8??????? (sprite)
3A790??????? (sprite)
3B2DE??????? (sprite)
3B36A??????? (sprite)
3B3FA??????? (sprite)
3B5D0Tilting platform from WFZ (sprite)
3B8A6??????? (sprite)
3B968Wall turret from WFZ (sprite)
3BABA??????? (sprite)
3BB4C??????? (sprite)
3BB7C??????? (sprite)
3BBBC??????? (sprite)
3BC1C??????? (sprite)
3BD7APlatform that pops in and out from WFZ (sprite)
3BEAA??????? (sprite)
3BF04??????? (sprite)
3C0ACSprite that sonic hangs onto on the back of Robotnic's getaway ship at the end of WFZ (sprite)
3C328Rivet thing that you bust to get into the ship at the end of WFZ (sprite)
3C3D6??????? (sprite)
3C442Laser boss guy at end of WFZ (sprite)
3CED0??????? (sprite)
3D23EBad guy in CNZ (sprite)
3D4C8Death Egg (sprite)
3EAC8??????? (sprite)
3F1E4Egg prison (sprite)
3FCE0Offset index of dynamic pattern and animated pattern load cue'sDouble offset

Further info

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

Further info

3FD26Dynamic pattern reloading for HTZ

Further info

3FF08Dynamic pattern reloading for CNZ

Further info

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

Further info

3FF24Dynamic pattern reloading for ARZ

Further info

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

Further info

3FF94EHZ animated pattern load cue (4)

Further info

3FFF8MTZ animated pattern load cue (3)

Further info

40038HTZ animated pattern load cue (4)

Further info

4009CHPZ animated pattern load cue (2)

Further info

400C8OOZ animated pattern load cue (4)

Further info

4010ECNZ animated pattern load cue (1)

Further info

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

Further info

401B2CPZ animated pattern load cue (0)

Further info

401C4DEZ animated pattern load cue (0)

Further info

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

Further info

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

Further info

40372EHZ, HTZ misc sprite mappings

Further info

403EEMTZ misc sprite mappings

Further info

404C2HPZ misc sprite mappings

Further info

405B6OOZ misc sprite mappings

Further info

4061ACNZ misc sprite mappings

Further info

406BEUnknown misc sprite mappings (that damn phantom group again)

Further info

40762CPZ misc sprite mappings

Further info

4076EDEZ misc sprite mappings

Further info

4077AARZ misc sprite mappings

Further info

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

Further info

4134C-41A6BBig and small numbers used on counters in gameUncompressed

Further info

41D0C-41D2DOffset index of object debug lists

Further info

41D2EEHZ/01/02/03/DEZ object debug lists

Further info

42AA8MTZ/MTZ act 3 object debug lists

Further info

41EECWFZ object debug lists

Further info

41FEEHTZ object debug lists

Further info

420E8HPZ/OOZ object debug lists

Further info

421F2MCZ object debug lists

Further info

422B4CNZ object debug list

Further info

42376CPZ object debug list

Further info

42438ARZ object debug list

Further info

42522SCZ object debug list

Further info

42594-4265FMain level load block pointers

Further info

42660-426E5Offset index of pattern load cue's

Further info

426E6-42D4FPattern load cues

Further info

42D50Curve and resistance mapping

Further info

42E50Collision array

Further info

44E50EHZ and HTZ primary 16x16 collision indexCompressed

Further info

44F40EHZ and HTZ secondary 16x16 collision indexCompressed

Further info

45040MTZ primary 16x16 collision indexCompressed

Further info

45100OOZ primary 16x16 collision indexCompressed

Further info

45200MCZ primary 16x16 collision indexCompressed

Further info

452A0CNZ primary 16x16 collision indexCompressed

Further info

45330CNZ secondary 16x16 collision indexCompressed

Further info

453C0CPZ and DEZ primary 16x16 collision indexCompressed

Further info

454E0CPZ and DEZ secondary 16x16 collision indexCompressed

Further info

45610ARZ primary 16x16 collision indexCompressed

Further info

45760ARZ secondary 16x16 collision indexCompressed

Further info

458C0WFZ/SCZ primary 16x16 collision indexCompressed

Further info

459A0WFZ/SCZ secondary 16x16 collision indexCompressed

Further info

45A80Offset index of level layout's

Further info

45AC4EHZ act 1 level layoutLevel compression

Further info

45C84EHZ act 2 level layoutLevel compression

Further info

45E74MTZ act 1 level layoutLevel compression

Further info

462A4MTZ act 2 level layoutLevel compression

Further info

46684MTZ act 3 level layoutLevel compression

Further info

46B04WFZ level layoutLevel compression

Further info

46DD4HTZ act 1 level layoutLevel compression

Further info

47044HTZ act 2 level layoutLevel compression

Further info

47404OOZ act 1 level layoutLevel compression

Further info

47784OOZ act 2 level layoutLevel compression

Further info

47B24MCZ act 1 level layoutLevel compression

Further info

47D24MCZ act 2 level layoutLevel compression

Further info

47FF4CNZ act 1 level layoutLevel compression

Further info

483C4CNZ act 1 level layoutLevel compression

Further info

48774CPZ act 1 level layoutLevel compression

Further info

48A84CPZ act 2 level layoutLevel compression

Further info

48DE4DEZ level layoutLevel compression

Further info

48E94ARZ act 1 level layoutLevel compression

Further info

49264ARZ act 2 level layoutLevel compression

Further info

49634SCZ level layoutLevel compression

Further info

49714Animated flowers in EHZ and HTZUncompressed

Further info

49914Pulsing thing against chequered backing from EHZUncompressed

Further info

49A14Dynamically reloaded cliffs in background from HTZArt compression
192 blocks
4A33EDynamically reloaded clouds in background from HTZUncompressed

Further info

4A73ESpinning metal cylinder patterns in MTZUncompressed

Further info

4B73ELava patterns in MTZ and HTZUncompressed

Further info

4BD3EAnimated section of MTZ backgroundUncompressed

Further info

4BF7EPulsing ball in OOZUncompressed

Further info

4C0FESquare rotating around ball in OOZUncompressed

Further info

4C4FEOil in OOZUncompressed

Further info

4D4FEFlipping foreground section in CNZUncompressed

Further info

4EEFEBonus pictures for pokie in CNZUncompressed

Further info

4FAFEAnimated background section in CPZ and DEZUncompressed

Further info

4FCFEWaterfall patterns from ARZUncompressed

Further info

50000Patterns for SonicUncompressed

Further info

64180Patterns for TailsUncompressed

Further info

6FBE0Unknown offset index

Further info

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

Further info

714E0Unknown offset index

Further info

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

Further info

71D8EBubbleArt compression
32 blocks
71F14Invincibility starsArt compression
00, 34 blocks
71FFCSplash in waterUncompressed

Further info

7287CSmoke from dashingUncompressed

Further info

7393CSupersonic starsArt compression
00, 14 blocks
739E2Unknown offset index

Further info

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

Further info

7446CUnknown offset index

Further info

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

Further info

74876SEGA patternsArt compression
127 blocks
74F6CMain patterns from title screenArt compression
336 blocks
7667ASonic and tails from title screen Art compression
674 blocks
78CBCA few menu patternsArt compression
10 blocks
78DACButton Art compression
16 blocks
78E84Vertical spring Art compression
00, 20 blocks
78FA0Horizontal spring Art compression
12 blocks
7906ADiagonal spring Art compression
00, 32 blocks
7923EScore, Rings, Time patterns Art compression
24 blocks
79346Sonic lives counter Art compression
12 blocks
7945CRingArt compression
00, 14 blocks
79550Monitors and contents Art compression
60 blocks
7995CSpikesArt compression
8 blocks
799ACNumbersArt compression
18 blocks
79A86StarpollArt compression
00, 16 blocks
79BDESignpostArt compression
78 blocks
7A1A0SignpostUncompressed

Further info

7AB4AStrange spring from CPZ and ARZ Art compression
00, 28 blocks
7AC9ALong horizontal spike Art compression
00, 8 blocks
7AD16Bubble man, and bubbles from bubble man Art compression
00, 37 blocks
7AEE2Bubbles from character Art compression
00, 10 blocks
7AF82Countdown text for drowning Uncompressed

Further info

7B400Game/Time over text Art compression
34 blocks
7B592Explosion Art compression
68 blocks
7B946Miles life counter Art compression
00, 12 blocks
7BA32Egg prison Art compression
49 blocks
7BDBEImage of tails in plane when sonic is on final frame at end of gameArt compression
00, 36 blocks
7C0AASonic continue Art compression
12 blocks
7C20CTails life counter Art compression
12 blocks
7C2F2Tails continue Art compression
12 blocks
7C43EASCII characters used in game Art compression
00, 88 blocks
7C9AE1P/2P wins text from 2P modeArt compression
38 blocks
7CD30Sonic/Miles animated background from options and level select menuUncompressed

Further info

7D22CTitle card patternsArt compression
94 blocks
7D58AAlphabet for font using large broken lettersArt compression
92 blocks
7D990A menu box with a shadowArt compression
21 blocks
7DA10Pictures in level preview box in level selectArt compression
170 blocks
7E86AUnknown. More text I haven't figured outArt compression
68 blocks
7EB58Text for end of special stage, along with patterns for 3 emeralds.Art compression
72 blocks
7EEBE"Perfect" textArt compression
00, 14 blocks
7EF60BluebirdArt compression
00, 16 blocks
7F0A2SquirrelArt compression
00, 20 blocks
7F206MouseArt compression
00, 20 blocks
7F340ChickenArt compression
16 blocks
7F4A2BeaverArt compression
00, 20 blocks
7F5E2PenguinArt compression
16 blocks
7F710PigArt compression
18 blocks
7F846SealArt compression
00, 14 blocks
7F962PenguinArt compression
00, 18 blocks
7FADETurtleArt compression
00, 20 blocks
7FC90BearsArt compression
00, 20 blocks
7FDD2RabbitArt compression
00, 18 blocks
7FF2ARivet thing that you bust to get inside ship at the end of WFZArt compression
00, 4 blocks
7FF98Breakaway panels in WFZArt compression
15 blocks
8007CSpiked ball from OOZArt compression
00, 32 blocks
80274Unknown. HPZ style shaded blocksArt compression
6 blocks
8030AStriped blocks from CPZArt compression
4 blocks
80376Oil falling into oil in OOZArt compression
16 blocks
804F2Cascading oil from OOZArt compression
13 blocks
805C0Ball on spring from OOZArt compression
20 blocks
806E0Spinball from OOZArt compression
53 blocks
809D0Collapsing platform form OOZArt compression
40 blocks
80C64Diagonal and vertical weird spring from OOZArt compression
30 blocks
80E26Swinging platform from OOZArt compression
28 blocks
810484 stripy blocks from OOZArt compression
4 blocks
810B8Raising platform in OOZArt compression
24 blocks
81254Fan in OOZArt compression
30 blocks
81514Green flame from thingy that shots platform up in OOZArt compression
18 blocks
81600Patterns for appearing and disappearing string of platforms in CNZArt compression
00, 4 blocks
81668Spiky ball from poky in CNZArt compression
00, 04 blocks
816C8Moving cube from either CNZ and CPZArt compression
16 blocks
817B4Elevator in CNZArt compression
4 blocks
81826Bars from pokies in CNZArt compression
12 blocks
81894Hexagonal bumper in CNZArt compression
6 blocks
8191ENormal round bumper from CNZArt compression
24 blocks
81AB0Diagonal spring from CNZ that you pull back onArt compression
32 blocks
81C96Vertical red springArt compression
18 blocks
81DCCWeird blocks in CNZ that you hit 3 times to get rid of themArt compression
28 blocks
81EF2Flippers from CNZArt compression
52 blocks
82216Large moving platform from CPZArt compression
00, 10 blocks
82364Top of water in HPZ and CPZArt compression
00, 24 blocks
824D4Booster things in CPZArt compression
00, 4 blocks
8253CCPZ enemy made up of a string of ballsArt compression
00, 04 blocks
825AECPZ metal thingsArt compression
33 blocks
827B8CPZ large moving platform blocksArt compression
4 blocks
827F8Stripy blocks from CPZArt compression
8 blocks
82864Small yellow moving platform from CPZArt compression
48 blocks
82A46Moving block from CPZArt compression
24 blocks
82C06Spring that covers tube in CPZArt compression
32 blocks
82E02Top of water in ARZArt compression
00, 16 blocks
82EE8Leaves from ARZArt compression
00, 07 blocks
82F74Arrow shooter and arrow from ARZArt compression
00, 17 blocks
830D2One way barrier from ARZArt compression
8 blocks
8316ABuzz bomberArt compression
00, 28 blocks
8336AOctopus badnick from OOZArt compression
00, 58 blocks
8368AFlying badnick from OOZArt compression
00, 56 blocks
839EAFish badnick from EHZArt compression
22 blocks
83BF6Robotnic's main shipArt compression
96 blocks
84332Robotnic enemy from CPZArt compression
111 blocks
84890Large explosionArt compression
00, 100 blocks
84F18Mini explosionArt compression
00, 8 blocks
84F96Unknown. Trail of smoke of some kind.Art compression
00, 16 blocks
8507CEHZ bossArt compression
128 blocks
85868Chopper blades for EHZ bossArt compression
00, 20 blocks
8595CHTZ bossArt compression
00, 107 blocks
86128ARZ bossArt compression
166 blocks
86B6EMCZ bossArt compression
204 blocks
87AACCNZ bossArt compression
00, 133 blocks
882D6OOZ bossArt compression
181 blocks
88DA6MTZ bossArt compression
124 blocks
894E4UnknownUncompressed

Further info

89534Blowfly from ARZArt compression
00, 9 blocks
8970EGrounder from ARZArt compression
00, 50 blocks
89B9AFish from ARZArt compression
24 blocks
89DECLava snake from HTZArt compression
00, 19 blocks
89FAAEnemy with spike cone on top form HTZArt compression
20 blocks
8A142Circular badnick from SCZArt compression
28 blocks
8A362Turtle badnick from SCZArt compression
00, 57 blocks
8A87ACoconuts from EHZArt compression
38 blocks
8AB36Snake like badnick from MCZArt compression
10 blocks
8AC5EFirefly from MCZArt compression
00, 20 blocks
8AD80Praying mantis badnick from MTZArt compression
00, 32 blocks
8B058Crab badnick from MCZArt compression
00, 36 blocks
8B300Exploding star badnick from MTZArt compression
00, 15 blocks
8B430Weird crawling badnick from CPZArt compression
00, 32 blocks
8B6B4Spider badnick in CPZArt compression
00, 45 blocks
8B9DCScratch from WFZArt compression
26 blocks
8BC16Jet like badnick from SCZArt compression
00, 25 blocks
8BE12Robotic sonicArt compression
00, 217 blocks
8CC44The tornadoArt compression
79 blocks
8D1A0Wall turret from WFZArt compression
24 blocks
8D388Hook on chain in WFZArt compression
00, 20 blocks
8D540Retracting platform from WFZArt compression
54 blocks
8D7D8Wheel for belt in WFZArt compression
00, 16 blocks
8D96EMoving platform in WFZArt compression
00, 12 blocks
8DA6EGiant unused vertical red laser in WFZArt compression
12 blocks
8DAFCCloudsArt compression
00, 18 blocks
8DC42Red horizontal laser in WFZArt compression
10 blocks
8DCA2Platform that shoots sonic across from WFZArt compression
00, 05 blocks
8DD0CRising platforms on belt from WFZArt compression
00, 12 blocks
8DDF6Unused badnick in WFZArtcompression
12 blocks
8DEB8Vertical spinning blades from WFZArt compression
4 blocks
8DEE8Horizontal spinning blades from WFZArt compression
00, 29 blocks
8E010Platforms that tilt in WFZArt compression
12 blocks
8E0C4Thrust from Robotnic's getaway ship in WFZArt compression
00, 8 blocks
8E138Laser boss from WFZArt compression
00, 117 blocks
8E886Robotnic's headArt compression
00, 24 blocks
8EA5ARobotnicArt compression
76 blocks
8EE52Robotnic's lower halfArt compression
28 blocks
8EF96Window in back that Robotnic looks through in DEZArt compression
00, 08 blocks
8F024Death eggArt compression
327 blocks
901A4Bouncer badnik from CPZArt compression
42 blocks
90520Rocket thruster for tornadoArt compression
00, 26 blocks
906DE-90973Mappings for movie sequence and images at end of game
90974Movie sequence at end of gameArt compression
00, 193 blocks
91F3CFinal image of tornado with it and sonic facing screenArt compression
00, 127 blocks
927E0Mini pictures of tornado in final ending sequenceArt compression
00, 109 blocks
92F0AMini pictures of sonic and final image of sonicArt compression
135 blocks
93848Mini pictures of sonic and final image of sonic in supersonic modeArt compression
117 blocks
93F3CFinal image of Tails Art compression
181 blocks
94B28Sonic the hedgehog 2 image at end of creditsArt compression
72 blocks
94E74EHZ 16x16 block mappingsCompressed

Further info

95C24EHZ/HTZ main level patternsCompressed

Further info

985A4HTZ 16x16 block mappingsCompressed

Further info

98AB4HTZ pattern suppliment to EHZ level patternsCompressed

Further info

99D34EHZ/HTZ 128x128 block mappingsCompressed

Further info

9CFD4MTZ 16x16 block mappingsCompressed

Further info

9DB64MTZ main level patternsCompressed

Further info

A06C4MTZ 128x128 block mappingsCompressed

Further info

A3364OOZ 16x16 block mappingsCompressed

Further info

A4204OOZ main level patternsCompressed

Further info

A6834OOZ 128x128 block mappingsCompressed

Further info

A8D04MCZ 16x16 block mappingsCompressed

Further info

A9D74MCZ main level patternsCompressed

Further info

AD454MCZ 128x128 block mappingsCompressed

Further info

AFFC4CNZ 16x16 block mappingsCompressed

Further info

B0894CNZ main level patternsCompressed

Further info

B2CF4CNZ 128x128 block mappingsCompressed

Further info

B5234CPZ/DEZ 16x16 block mappingsCompressed

Further info

B6174CPZ/DEZ main level patternsCompressed

Further info

B90F4CPZ/DEZ 128x128 block mappingsCompressed

Further info

BB944ARZ 16x16 block mappingsCompressed

Further info

BCC24ARZ main level patternsCompressed

Further info

C1434ARZ 128x128 block mappingsCompressed

Further info

C4074WFZ/SCZ 16x16 block mappingsCompressed

Further info

C5004WFZ/SCZ main level patternsCompressed

Further info

C7EC4WFZ pattern suppliment to SCZ tilesCompressed

Further info

C85E4WFZ/SCZ 128x128 block mappingsCompressed

Further info

CA906-?????????????? (Special stage stuff)
DCD68Background patterns for special stage Art compression
127 blocks
DD48ASonic/Miles and number text from special stage Art compression
62 blocks
DD790"Start" patterns in special stage Art compression
48 blocks
DD8CEStars in special stage Art compression
00, 37 blocks
DD9C8Unknown. Text in special stage. Art compression
13 blocks
DDA7ERing patterns in special stage Art compression
104 blocks
DDFA4Horizontal shadow patterns in special stage Art compression
38 blocks
DE05ADiagonal shadow patterns from special stage Art compression
58 blocks
DE120Vertical shadow patterns in special stage Art compression
25 blocks
DE188Explosion patterns in special stage Art compression
00, 48 blocks
DE4BCBomb patterns in special stage Art compression
80 blocks
DE8ACEmerald patterns in special stage Art compression
46 blocks
DEAF4Unknown. Text in special stage. Art compression
99 blocks
DEEAESonic 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)
E34EEUnknown. 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
E427CData block acting as seperator
E4300Offset index of ring location lists

Further info

E4344EHZ act 1 ring locations

Further info

E456AEHZ act 2 ring locations

Further info

E47ACUnknown (empty)

Further info

E47AEUnknown (empty)

Further info

E47B0Unknown (empty)

Further info

E47B2Unknown (empty)

Further info

E47B4Unknown (empty)

Further info

E47B6Unknown (empty)

Further info

E47B8MTZ act 1 ring locations

Further info

E4A2AMTZ act 2 ring locations

Further info

E4C48MTZ act 3 ring locations

Further info

E4D72MTZ act 4 ring locations (empty)

Further info

E4D74HTZ act 1 ring locations

Further info

E4EAAHTZ act 2 ring locations

Further info

E50E8HPZ act 1 ring locations

Further info

E525AHPZ act 2 ring locations (empty)

Further info

E525CUnknown (empty)

Further info

E525EUnknown (empty)

Further info

E5260OOZ act 1 ring locations

Further info

E5422OOZ act 2 ring locations

Further info

E5598MCZ act 1 ring locations

Further info

E570EMCZ act 2 ring locations

Further info

E5944CNZ act 1 ring locations

Further info

E5B7ECNZ act 2 ring locations

Further info

E5E2CCPZ act 1 ring locations

Further info

E5F9ECPZ act 2 ring locations

Further info

E6150DEZ act 1 ring locations (empty)

Further info

E6152DEZ act 2 ring locations (empty)

Further info

E6154WFZ act 1 ring locations

Further info

E6292WFZ act 2 ring locations

Further info

E6294ARZ act 1 ring locations

Further info

E642EARZ act 2 ring locations

Further info

E6684SCZ act 1 ring locations

Further info

E66D6SCZ act 2 ring locations (empty)

Further info

E66D8Data block acting as seperator

Further info

E6800Offset index of sprite lists

Further info

E684AEHZ act 1 sprite locations

Further info

E6B7AEHZ act 2 sprite locations

Further info

E6F34MTZ act 1 sprite locations

Further info

E73C0MTZ act 2 sprite locations

Further info

E78EEMTZ act 3 sprite locations

Further info

E7F48WFZ act 1 sprite locations

Further info

E82FCWFZ act 2 sprite locations (empty)

Further info

E8302HTZ act 1 sprite locations

Further info

E8668HTZ act 2 sprite locations

Further info

E8C80HPZ act 1 sprite locations

Further info

E8D94HPZ act 2 sprite locations (empty)

Further info

E8D9AUnknown (empty)

Further info

E8DA0OOZ act 1 sprite locations

Further info

E9214OOZ act 2 sprite locations

Further info

E968EMCZ act 1 sprite locations

Further info

E99A0MCZ act 2 sprite locations

Further info

E9D1ECNZ act 1 sprite locations

Further info

EA3D8CNZ act 2 sprite locations

Further info

EA9D2CPZ act 1 sprite locations

Further info

EAD6ECPZ act 2 sprite locations

Further info

EB230DEZ act 1 sprite locations

Further info

EB254DEZ act 2 sprite locations (empty)

Further info

EB25AARZ act 1 sprite locations

Further info

EB6A4ARZ act 2 sprite locations

Further info

EBBDESCZ act 1 sprite locations

Further info

EBD4CSCZ act 2 sprite locations (empty)

Further info

EBD52Unknown (empty)

Further info

EBD58Unknown (empty)

Further info

EBD5EUnknown (empty)

Further info

EBD64Unknown (empty)

Further info

EBD66Data block acting as seperator
EC000????????? (Sound effects?)
ED100????????? (instruments?)
F0160Fireball from EHZArt compression
20 blocks
F02D6Waterfall tiles Art compression
24 blocks
F03DCAnother fireball Art compression
00,16 blocks
F052ABridge in EHZ Art compression
00, 8 blocks
F0602Diagonally moving lift in HTZ Art compression
48 blocks
F08F6One way barrier from HTZ Art compression
4 blocks
F096ESee-saw in HTZ Art compression
24 blocks
F0B06Fireball from HTZ Art compression
24 blocks
F0C14Rock from HTZ Art compression
20 blocks
F0D4ABadnick from HTZ with 4 balls of fire spinning around himArt compression
4 blocks
F0DB6Large spinning wheel from MTZ Art compression
120 blocks
F120EIndent in large spinning wheel from MTZ Art compression
9 blocks
F12B6Unknown. MTZ block.Art compression
00, 8 blocks
F1384Steam from MTZArt compression
00, 15 blocks
F148ESpike from MTZArt compression
00, 8 blocks
F1550Similarly shaded blocks from MTZArt compression
54 blocks
F15C6Lava bubble from MTZ Art compression
00, 9 blocks
F167CUnknown. A steam vent? Art compression
00, 4 blocks
F16ECThings from MTZ Art compression
8 blocks
F178ESmall cog from MTZ Art compression
00, 12 blocks
F1870Unknown. Four blocks that are all the same colour from MTZ. Art compression
00, 4 blocks
F187ELarge wooden box from MCZ Art compression
32 blocks
F1ABACollapsing platform from MCZ Art compression
00, 26 blocks
F1C64Switch that you pull on from MCZ Art compression
16 blocks
F1D5CVine that lowers in MCZ Art compression
10 blocks
F1E06Unknown. A log viewed from the end Art compression
00, 4 blocks
F1E8CSEGA intro sound16000Hz 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:

00426E6Standard block 1 (score\time\rings/lives/ring/numbers)(3)
0142700Standard block 2 (starpoll/monitor/stars/bubbles)(3)
024271Apattern block for level with water (explosion/stars/bubbles)(2)
034272Egame/time over (game\time over text)(0)
0442736EHZ (waterfall/bridge/fireball/buzz bomber/coconuts/fish)(6)
054275CEHZ (spikes/diagonal spring/horizontal\vertical spring)(3)
0642776Miles 1up patch (Miles lives counter)(0)
074277EMiles life counter (Miles lives counter)(0)
0842786Tails 1up patch (Tails lives counter)(0)
094278ETails life counter (Tails lives counter)(0)
0A42796MTZ (Wheel/Unknown/Unknown/MSC from MTZ/steam/Unknown/MTZ spike/Badnick/starbomb)(8)
0B427CEMTZ (Button/spikes/Mantis/vertical spring/horizontal spring/Unknown/Lava bubble/Cog/Unknown)(8)
0C42806WFZ (Tornado/clouds/vertical blades/horizontal blades/jet badnick/unknown/scratch/tilting platforms/tornado/clouds)(9)
0D42844WFZ (vertical blades/ horizontal blades/ unknown/ turret/ unknown/ unknown/ unknown/ unknown/ belt/ platforms/ retracting platform/ unknown/ trolley/ rivet/ unknown)(D)
0E4289AHTZ (fireball/rock/conveyor/orbit badnick/unknown badnick/unknown badnick/spikes/diagonal spring/vertical spring/horizontal spring)(9)
0F428D8HTZ (lift/fireball/unknown)(2)
10428ECOOZ (green flame/raising platform/spikeball/unknown/unknown/cascading oil/unknown/unknown)(8)
1142924OOZ (unknown/ unknown/ swinging platform/ unknown/ fan/ button/ spikes/ diagonal spring/ vertical spring/ horizontal spring/ seahorse/ octopus)(B)
124296EMCZ (box/collapsing platform/vine switch/lowering vine/firefly/unknown badnick)(5)
1342994MCZ (long horizontal spike/ spikes/ unknown/ other spring/ vertical spring/ horizontal spring)(5)
14429BACNZ (unknown badnick/ moving cube/ unknown/ unknown/ unknown/ unknown/ unknown/ unknown/ unknown/ destroyable blocks)(9)
15429F8CNZ (poky spring/vertical red spring/spikes/diagonal spring/vertical spring/horizontal spring)(5)
1642A1ECPZ (CPZ stuff/CPZ stuff/booster/moving platform/small moving platform/spring cap/water surface/moving block/CPZ platform blocks)(8)
1742A56CPZ (unknown badnick/unknown badnick/spikes/unknown/other spring/vertical spring/horizontal spring)(6)
1842A82DEZ (stripy blocks from CPZ)(0)
1942A8ADEZ (robotic sonic/unknown/Robotnic/Robotnic's head/Robotnic's lower half)(4)
1A42AAAARZ (one way barrier/water surface/leaves/arrow shooter)(3)
1B42AC4ARZ (shark/blowfly/grounder/bubbles/spikes/other spring/vertical spring/horizontal spring)(7)
1C42AF6SCZ (tornado)(0)
1D42AFESCZ (clouds/vertical blades/horizontal blades/jet badnick/turtle badnick/bomber)(5)
1E42B24Sonic end of level results screen (title card patterns/unknown/sonic continue/perfect text)(3)
1F42B3EEnd of level signpost (signpost)(0)
2042B46CPZ boss (Robotnic's main ship/CPZ boss/mini explosion/unknown/large explosion)(4)
2142B66EHZ boss (Robotnic's main ship/EHZ boss/chopper blades/large explosion)(3)
2242B80HTZ boss (Robotnic's main ship/HTZ boss/large explosion/unknown)(3)
2342B9AARZ boss (Robotnic's main ship/ARZ boss/large explosion)(2)
2442BAEMCZ boss (Robtnic's main ship/MCZ boss/large explosion)(2)
2542BC2CNZ boss (Robotnic's main ship/CNZ boss/large explosion)(2)
2642BD6MTZ boss (Robotnic's main ship/MTZ boss/mini explosion/large explosion)(3)
2742BF0OOZ boss (OOZ boss/large explosion)(1)
2842BFEUnknown (large explosion)(0)
2942C06Death egg (Death egg)(0)
2A42C0EEHZ animals (squirrel/blue bird)(1)
2B42C1CMCZ animals (rat/chicken)(1)
2C42C2AHTZ/MTZ/WFZ animals (beaver/penguin)(1)
2D42C38DEZ animals (pig/chicken)(1)
2E42C46Unknown (HPZ animals) (rat/seal)(1)
2F42C54OOZ animals (penguin/seal)(1)
3042C62SCZ animals (turtle/chicken)(1)
3142C70CNZ animals (bears/blue bird)(1)
3242C7ECPZ animals (rabbit/penguin)(1)
3342C8CARZ animals (penguin/blue bird)(1)
3442C9ASpecial 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)
3542CDEUnknown (Unknown)(0)
3642CF4Boss at end of WFZ (Laser boss from WFZ/Robotnic/Robotnic's head/Robotnic's lower half/explosion)(4)
3742D12Tornado at end of WFZ (tornado/rocket thruster from tornado/clouds)(2)
3842D26Egg prison (egg prison)(0)
3942D2ENormal explosion (explosion)(0)
3A42D36Tails 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 o