Actions

SCHG

Sonic the Hedgehog 2 (16-bit)

From Sonic Retro

Revision as of 02:55, 18 February 2007 by Scarred Sun (talk | contribs)


Sonic Community Hacking Guide
Sonic the Hedgehog 2 (16-bit)
Art
Objects
Levels
Text
Music
RAM
Miscellaneous

This is the Sonic Community Hacking Guide for Sonic the Hedgehog 2. Originally based on Nemesis and Saxman's guide, this document has grown to outclass those two documents in most ways, and is now preferred over the original guides (which were written three or four years ago with limited knowledge of the game's code). This is due to the updating of those documents to give them a living, breathing nature.

Contributors

(In alphabetical order; if you are a contributor and have worked on a specific part of the guide, feel free to note that.)

Miscellaneous

Pieces of the guide not big enough for their own page should be left here.

Game Configuration

003CD2 - Enable level select 003C79 - Starting lives for player 1 0041CC - How to determine how many rings to start with 0041D0 - How to determine how much time starts on the timer 0142F8 - Order that the levels come in 01600C - Object code pointers

Each of the object code pointers are in 32-bits. They locate where the code for the object starts in the ROM. It starts with object 01 (Sonic) and goes in order from there. You will find a total of 255 pointers. These are useful if you want to create your own object code, or if you want to make one object into another. Check out the object list to see what each object is.

016398 - Amount of gravity player has (16-bit) 019FA2 - Max speed (16-bit) 019FA8 - Acceleration (16-bit) 019FAE - Slow down speed (16-bit) 01A0E8 - Invincibility time (16-bit) 01A122 - Max speed after super sneakers wear off (16-bit) 01A122 - Acceleration after super sneakers wear off (16-bit) 01A12E - Slow down speed after super sneakers wear off (16-bit) 01A1B8 - Max speed under water (16-bit) 01A1BE - Acceleration under water (16-bit) 01A1C4 - Slow down speed under water (16-bit) 01A5BD - Use this animation when looking down 01A5D5 - How far to look down (player Y - input value) (16-bit) 01AA5C - Jump height (16-bit) 01AC47 - Do spindash if this frame is shown 01B1BE - Flash time after hit (16-bit) 01B8A4 - Stop Tails from going to the left when end level sign is active (16-bit) 01F1FC - Rings needed for special stage (16-bit) 04082F - Specify the minute that causes "TIME" to flash red 040DED - Max minutes of timer 040DF9 - Max middle seconds of timer 042594 - Art/mapping pointers for levels

Each full level has 3 pointers. However, the pointers are 24-bits in size. The extra 8-bits in each pointer has a unique function. These are known as 'flags'. The pointers will define mapping sets, as well as art for a specific level. In total, 12 bytes are used per level. Here is what each flag/pointer does.

Flag 1 - Unknown Pointer 1 - Level art Flag 2 - Level specific graphics (player icons included) Pointer 2 - 16x16 mappings Flag 3 - Palette number Pointer 3 - 128x128 mappings.

Cheats Editing

In this section, you can change any of the cheat codes to whatever you want them to be.

003DEE - Tails / Miles switch 0097B2 - Level select / slow motion (example) 0097B7 - 14 continues (example) 0097BC - Debug mode (example) 0097C5 - Super Sonic (example)

These codes (except for the first one listed) use the regular sound 00-7F format, not the 80-FF format that the regular sound pointers use. Also, you can make these codes as long as you want. Simply use '00' to tell the game that the code ends there. If you make the very first sound to play in the code sequence a '00', it will then require you to play that sound along with the rest of the code.

The first code (Tails / Miles switch) is based on the Motorolla key format: 1 2 3 4 5 6 7 8 (this is a byte represented in bits) S A C B U D L R (these are the bits translated to show what each key is)

If you want to relocate some of these cheat codes to another area of the ROM, just change these address pointers.

003DB6 - Tails / Miles switch cheat pointer 009164 - Level select / slow motion cheat pointer 00916A - 14 continues cheat pointer 009574 - Debug mode cheat pointer 00957A - Super Sonic cheat pointer

Debug Mode

This will allow you to change the objects available in each of level when using debug mode. Each object uses 8 bytes to reference it in debug mode. Here are the notes you need to modify these references.

FORMAT:

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

1 - Object value 2 - ??? (usually 01) 3 + 4 - Size of selection 5 - Object type 7 +8 - Sprites for selection

You can use #3, #4, #7, and #8 for porting a selection sprite. Now, you need to know how the game understands how many sprites to read for a level. Each set of objects has a 2 byte header. Together, both bytes define how many objects should be available in debug mode. The first byte should probley stay 00 unless you want more than 255 objects! Now, you just need to know where the section is that tells what sprite set is used for what level.

041D0C - 16-bit address pointers for each level

Here are some of the objects that are listed and their locations

Default 041D30 - Ring 041D38 - Warp Monitor

Emerald Hill 041D42 - Ring 041D4A - Warp Monitor 041D52 - Starpost

Demo Recording

To show off a game, developers record demo's. Many other people like to record their own demo's too when it's possible. This is one of the fun things you can do in the Sonic 2 ROM.

003D4E - Number of demo's to play 003DAC - Levels that are played during demo sequence 0042AA - Number of frames that a demo plays (16-bit) 004948 - 32-bit address pointers for each level 004CA8 - Demo for EHZ (Sonic) 004D08 - Demo for EHZ (Tails) 004D68 - Demo for CNZ 004DD8 - Demo for CPZ 004E38 - Demo for ARZ

FORMAT:

  1. 1 #2

1 - Keys pressed 2 - Frame count

For keys pressed, you simply need to know the Motorolla key format: 1 2 3 4 5 6 7 8 (this is a byte represented in bits) S A C B U D L R (these are the bits translated to show what each key is)

With a 1, that means the button is being used (on) and with a 0, the button isn't being used.


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