Actions

SCHG

Esrael s1

From Sonic Retro

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.


Original translation by Sanderson Hk

Using a hex editor it is possible to modify Sonic the Hedgehog, editing it byte by byte. By knowing where each function is and modifying it correctly, it is possible to customize the game. You can draw another character in Sonic's place, but it's not very easy, because it needs to be drawn pixel by pixel. You can change the level names in the level select menu and in the level title cards. But to program the game, it needs to be in the binary format. It isn't hard to convert the game to binary form. You can use a conversion program or the Genecyst emulator's DUMP ROM option, which does the conversion.

Level Select Menu

Sonic 1's level select menu uses a 26 char per line plain text format. In all the lines, you can type text whose length is 26 characters, including the lines which only contain an act number. The first character in each line is the first character of the level name, and the last character is the act number. The first character of the next line starts where the previous line ends. The location of each line is as follows:

Level Address
GREEN HILL ZONE STAGE 1 $35A2-$35B9
STAGE 2 $35BA-$35D1
STAGE 3 $35D2-$35E9
LABYRINTH ZONE STAGE 1 $35EA-$3601
STAGE 2 $3602-$3619
STAGE 3 $361A-$3631
MARBLE ZONE STAGE 1 $3632-$3649
STAGE 2 $364A-$3661
STAGE 3 $3662-$3679
STAR LIGHT ZONE STAGE 1 $367A-$3691
STAGE 2 $3692-$36A9
STAGE 3 $36AA-$36C1
SPRING YARD ZONE STAGE 1 $36C2-$36D9
STAGE 2 $36DA-$36F1
STAGE 3 $36F2-$3709
SCRAP BRAIN ZONE STAGE 1 $370A-$3721
STAGE 2 $3722-$3739
STAGE 3 $373A-$3751
FINAL ZONE $3752-$3769
SPECIAL STAGE $376A-$3781
SOUND TEST $3782-$3799

Level names use non ASCII characters, and thus need to be modified using the letter codes given below:

00 = 0 01 = 1 02 = 2 03 = 3 04 = 4
05 = 5 06 = 6 07 = 7 08 = 8 09 = 9
0A = $ 0B = - 0C = = 0D = -> 0E = ->
0F = Y 10 = Z 11 = A 12 = B 13 = C
14 = D 15 = E 16 = F 17 = G 18 = H
19 = I 1A = J 1B = K 1C = L 1D = M
1E = N 1F = O 20 = P 21 = Q 22 = R
23 = S 24 = T 25 = U 26 = V 27 = W
28 = X FF = (space)

Level Title Cards

You also can change the level titles, but you have two restrictions: the number of characters you can put and the letters available. In the level cards, you cannot use the letters J, Q, V, W, or X, and thus level titles with these characters cannot be used. Also, the title modification isn't as easy as level select text modification, because you need to specify the distance between the letters to avoid overlaps. The code for each letter is given below:

05 00 00 = A 05 00 22 = K 05 00 46 = U
05 00 04 = B 05 00 26 = L 05 00 4A = Y
05 00 09 = C 05 00 2A = M 05 00 4E = Z
05 00 0C = D 05 00 2E = N 00 00 52 = .
05 00 10 = E 05 00 32 = O 0C 00 53 = act
05 00 14 = F 05 00 36 = P 02 00 57 = 1
05 00 18 = G 05 00 3A = R 06 00 5A = 2
05 00 1C = H 05 00 3E = S 06 00 60 = 3
01 00 20 = I 05 00 42 = T 00 00 56 = (space)

The level card mappings have the format LC [VS (LV CO DE) HS] [...]. LC is the number of letters that you want to be drawn, and the value of LC is the number of times VS (LV CO DE) HS occurs. VS is the vertical screen position of the letter, LV CO DE is one of the values in the table above, and HS is the horizontal screen position of the letter.

As an example to help understand this, let's look at the Green Hill title card data: 09 F8 05 00 18 B4 F8 05 00 3A C4 ... The 09 is the number of letters to be drawn. The other bytes are the letter configuration. The X value of the second letter is the X value of the first letter + the width of the first letter. The width of the letter I and the period character (.) are 8 pixels, the width of M $F pixels, and the width of all other letters $10 pixels. The locations of the title card mappings for each level are as follows:

Text Address
GREEN HILL $C9FE-$CA2B
LABYRINTH $CA2C-$CA59
MARBLE $CA5A-$CA79
STAR LIGHT $CA7A-$CAA7
SPRING YARD $CAA8-$CADA
SCRAP BRAIN $CADB-$CB0E
FINAL $CB8B-$CBA3
ZONE $CB0F-$CB24
SONIC HAS PASSED $CBEA-$CC31
CHAOS EMERALD $CCAD-$CCE8
SPECIAL STAGE $CD6C-$CDA7
SONIC GOT THEM ALL $CDA8-$CDF3

Title Card Configuration

This game area tells the game how the text must be shown when the level starts: where it starts and where it ends. Each level uses 16 bytes to configure the title cards. For example, if we look at the Green Hill Zone configuration, we see: 00000120FEFC013C0414015402140154. Separating this sequence in 4 byte group, we have:

  • 00 00 01 20 - about the text
  • FE FC 01 3C - about the "ZONE" title
  • 04 14 01 54 - about the "ACT X" title, where X is 1, 2 or 3
  • 02 14 01 54 - about the blue background

For each group, the first two bytes are the start position of the text, and the last two are the end position. The table below gives the locations of the configuration data for each level:

Level Address
GREEN HILL $C448-$C457
LABYRINTH $C458-$C467
MARBLE $C468-$C477
STAR LIGHT $C478-$C487
SPRING YARD $C488-$C497
SCRAP BRAIN $C498-$C4A7
FINAL $C4A8-$C4B7

Press Start Button Text

You can show the message "PRESS START BUTTON" in the title screen. To do this, go to the address indicated below and change the byte 02 to 00:

ROM Revision Address
REV00 $17271
REV01 $17A1D

Credits and Presentation Screen

To edit the credits text, simply refer to the explanation in the title cards. It is the same format, but the letter widths and restrictions are slightly different. The letters Q, V, W and Z cannot be used. The letter widths are 8 for the letter X, $14 for the letter M, and $10 for all other letters. The letter codes are as follows:

05-00-04 = A 05-00-3A = H 05-00-12 = P
05-00-48 = B 01-00-46 = I 05-00-22 = R
05-00-1E = C 05-00-4C = J 05-00-2E = S
05-00-42 = D 05-00-58 = K 05-00-3E = T
05-00-50 = X 05-00-16 = L 05-00-32 = U
05-00-0E = E 09-00-08 = M 00-00-2A = Y
05-00-5C = F 05-00-1A = N 0C-00-36 = Z
05-00-00 = G 05-00-26 = O

And the locations for the mappings data are as follows:

Text Address
SONIC TEAM STAFF $172F8-$1733E
GAME PLAN CAROL YAS $1733F-$1738F
PROGRAM YU 2 $17390-$173C2
CHARACTER DESIGN BIGISLAND $173C3-$1743B
DESIGN JINYA PHENIX RIE $1743C-$174A0
SOUND PRODUCE MASATO NAKAMURA $174A1-$17523
SOUND PROGRAM JIMITA MACKY $17524-$17597
SPECIAL THANKS FUJIO MINEGISHI PAPA $17598-$17633
PRESENTED BY SEGA $17634-$1767F
TRY AGAIN $17680-$176A8
SONIC TEAM PRESENTS $176A9-$176FE

Music Pointers

The music pointers are located at $71A9C. The following table gives the music ID, name, and location of the music data:

Music ID Music Name Location
$81 Green Hill Zone $745DC
$82 Labyrinth Zone $74D44
$83 Marble Zone $75194
$84 Star Light Zone $755F2
$85 Spring Yard Zone $75A60
$86 Scrap Brain Zone $75EAC
$87 Invincibility $763FC
$89 Special Stage $766D0
$8C Boss Music $76E42
$8D Final Zone $7705E


Sonic Community Hacking Guide
General
Sonic Music Hacking Guide | SonED2 Manual
Game-Specific
Sonic the Hedgehog (16-bit) | Sonic the Hedgehog (8-bit) | Sonic Eraser | Sonic CD (prototype 510) | Sonic CD | Sonic CD (PC) | Sonic CD (2011) | Sonic 2 (Nick Arcade prototype) | Sonic 2 (Simon Wai prototype) | Sonic 2 (16-bit) | Sonic 2 (8-bit) | Sonic 2 & Knuckles | Dr. Robotnik's Mean Bean Machine | Sonic Triple Trouble | Sonic 3 | Sonic & Knuckles | Sonic 3 & Knuckles | Sonic & Knuckles Collection | Sonic Crackers | Sonic 3D: Flickies' Island | Chaotix | Sonic R PC | Sonic Jam 6 | Sonic Advance | Sonic Advance 2 | Sonic Advance 3 | Sonic Battle | 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 | Shadow the Hedgehog | Sonic Riders | Sonic the Hedgehog (2006) | Sonic & Sega All-Stars Racing | Sonic Unleashed (Xbox 360/PS3) | Sonic Generations
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 | Subroutine Equivalency List | 68000 Instruction Set | 68000 ASM-to-Hex Code Reference | VDP Documentation | Official Sega 32X Documentation | Official Mega-CD Documentation | Official Sega Mega Drive Documentation