Sonic 2 Hacking Guide
Binary - Text Editing

One of the most useful things to change in the game is the text. Though, there are many different formats for the many different types of text in the game. The known formats are listed here.

2 Player Mode
00874B-008756 Emerald Hill
008759-008763 Mystic Cave
008765-008770 Casino Night
008772-00877E Special Stage
008783-008789 Special
00878D-008790 Zone
008793-008797 Stage
008799-0087A1 Game over
0087A3-0087AB Time over
0087AD-0087B3 No game
0087B5-0087B8 Tied
0087BB-0081BC 1P
0087BF-0087C0 2P

Options
0097CB-0097DB * Player select *
0097DD-0097EB Sonic and Miles
0097ED-0097FB Sonic and Tails
0097FD-00980B Sonic alone
00980D-00981B Miles alone
00981D-00982B Tails alone
00982D-00983D * Vs mode items *
00983F-00984D All kinds items
00984F-00985B Teleport only
00985F-00986F * Sound test*

To properly modify the text, you will need to become farmiliar with the character set. Listed here is the entire character set that you can use.

00 - Space
10 - 0
11 - 1
12 - 2
13 - 3
14 - 4
15 - 5
16 - 6
17 - 7
18 - 8
19 - 9
1A - *
1B -
1C - :
1D - .
1E - A
1F - B
20 - C
21 - D
22 - E
23 - F
24 - G
25 - H
26 - I
27 - J
28 - K
29 - L
2A - M
2B - N
2C - O
2D - P
2E - Q
2F - R
30 - S
31 - T
32 - U
33 - V
34 - W
35 - X
36 - Y
37 - Z
0E - Start a new text line
10 - Start a new selection box

 

Level Select
009AEB-??????
009B44 - ARZ
009B58 - WFZ
009BEF - OOZ

The format for level select text is very different. This is because it is mapped. This can be very confusing because it uses a very odd format -- 10 bits for each character. So, the easiest way to modify it is to take 5 bytes and convert them into bits. Then take the bits and seperate them into 4 sets of 10 bits. So, if I have "C1 E0 B8 32 07", then I'd convert that into bits. The Windows calculator will work this feature just fine (although if you don't have 2000 or later, you'll have to do two calculations, as only Dword length is supported on the older versions of the Windows calculator). Then break up the large line of bits into sets. So, "C1 E0 B8 32 07" would become this.

1100000111 (A)
1000001011 (Q)
1000001100 (U)
1000000111 (A)

This is the confusing part. You'll have to 'shift' the bits over to the left by 2. So, take a look at A and Q (1100000111 1000001011). Shifting over to the left by 2 would convert these into 0000011110 00001011(10). The extra 10 on the end of the Q comes from the first two bits of the U. So, the values above come out to be this.

0000011110 (A)
0000101110 (Q)
0000110010 (U)
00000111(10) (A)

These values represent the character number of each listing in the games VRAM. So, like 0000011110 (1E in hex form) for example is the letter A found in the VRAM. You can also use the chart at the top of this page for a full listing of the major characters.

Death Egg and Hill Top aren't editable yet though. Nobody has figured out why, and I haven't really taken the time to look at them. For now, Death Egg and Hill Top will have to remain the way they are on the level select.

 

1992 SEGA
For editing the " 1992 SEGA" text string on the title screen, you must use a different character set. Here are the instructions.

003E80 - 1992 SEGA

FORMAT:
#1 #2

1+2 - Sprite selection in VRAM.

Every time you get up to 08 00 in a sprite selection, it wraps from the beginning of the VRAM, but with a different palette. Here are the standard sprite numbers for each character.

00 00 - Space
06 80 - 0
06 81 - 1
06 82 - 2
06 83 - 3
06 84 - 4
06 85 - 5
06 86 - 6
06 87 - 7
06 88 - 8
06 89 - 9
06 8A - *
06 8B -
06 8C - :
06 8D - .
06 8E - A
06 8F - B
06 90 - C
06 91 - D
06 92 - E
06 93 - F
06 94 - G
06 95 - H
06 96 - I
06 97 - J
06 98 - K
06 99 - L
06 9A - M
06 9B - N
06 9C - O
06 9D - P
06 9E - Q
06 9F - R
06 A0 - S
06 A1 - T
06 A2 - U
06 A3 - V
06 A4 - W
06 A5 - X
06 A6 - Y
06 A7 - Z

 

Credits/Intro
Now that we have gotten all the basic text editing information out of the way, we can now learn how to edit the larger font text. This uses X and Y coordinates to place the character on the screen rather than just using a fixed font. Here are the instructions for editing the intro screen and the credits.

003A30 - Pointer to screen 1 information (intro)
00A016 - Pointer to data pointers for each screen (credits)

00B2B0 - Screen 1 information (intro)
00B2CA - Data pointers for each screen (credits)
00B322 - Screen 1 information (credits)

This is the format for laying pieces out onto the screen. This will not edit the actual text though.

FORMAT:
#1 #2 #3 #4 #5 #6

1+2+3+4 - 32-bit address for text location
5 - Every time this value changes every 2 values, it will move on the Y axis 3 characters (24 pixels)
6 - Every time this value changes every 2 values, it will move on the X axis characters (8 pixels). Every 80 changes in value will move on the Y axis 1 character (8 pixels).

For text, it works by placing 8x8 tiles together to make up the text.

Credits
00 - Space
01 & 02 - A
03 & 04 - B
05 & 06 - C
07 & 08 - D
09 & 0A - E
0B & 0C - F
0D & 0E - G
0F & 10 - H
11 - I
12 & 13 - J
14 & 15 - K
16 & 17 - L
18 & 19 - M
1A & 1B - N
1C & 1D - O
1E & 1F - P
20 & 21 - Q
22 & 23 - R
24 & 25 - S
26 & 27 - T
28 & 29 - U
2A & 2B - V
2C & 2D - W
2E & 2F - X
30 & 31 - Y
32 & 33 - Z
34 & 35 - 2
36 - (
37 - )
38 - "
39 - .
3A -
3B & 3C - 1
3D & 3E - 9
3F & 40 - :
Intro
00 & 01 - Space
02 & 03 - A
04 & 05 - B
06 & 07 - C
08 & 09 - D
0A & 0B - E
0C & 0D - F
0E & 0F - G
10 & 11 - H
12 - I
13 & 14 - J
15 & 16 - K
17 & 18 - L
19 & 1A - M
1B & 1C - N
1D & 1E - O
1F & 20 - P
21 & 22 - Q
23 & 24 - R
25 & 26 - S
27 & 28 - T
29 & 2A - U
2B & 2C - V
2D & 2E - W
2F & 30 - X
31 & 32 - Y
33 & 34 - Z
35 & 36 - 2
37 - (
38 - )
39 - "
3A - .
3B -
3C & 3D - 1
3E & 3F - 9
40 & 41 - :

Look in the games VRAM (patterns) to get the full listing of each character.

On text strings, FF is a separator that tells it to stop reading further. After FF, the next byte tells what palette info to use. This goes in 32's for each palette. This goes in 1's for change in tile set (move down the list of tiles every 256 tiles per every change in value). Use 00, 20, 40, and 60 for the credits and use 05, 25, 45, and 65 for the intro.

 

Level Splash Startup
015832-01583F (E)m(e)rald( )Hi(ll)
015842-01584F M(e)tr(o)p(o)lis
015852-01585B Hil(l )T(o)p
01585E-01586B Hid(den )Palac(e)
01586E-015875 (O)il( O)c(e)a(n)
015878-015887 Mystic( )Cav(e)
01588A-015897 Casi(no )(N)ight
01589A-0158A9 Ch(e)mical( )Pla(n)t
0158AC-0158B9 Aquatic( )Rui(n)
0158BC-0158C7 Sky( )Chas(e)
0158CA-0158D7 Wi(n)g( )F(o)rtr(e)s(s)
0158DA-0158E3 D(e)ath( )(E)gg

The above locations hold information that tells the game what sprites to load for the specific level splash text. Below is a list of all the characters you can choose from and what their values are.

00 - A
04 - B
08 - C
0C - D
10 - F
14 - G
18 - H
1C - I
1E - J
22 - K
26 - L
2A - M
30 - P
34 - Q
38 - R
3C - S
40 - T
44 - U
48 - V
4C - W
52 - X
56 - Y
5A - .
FF FF - End of string

Now down to business. First off, you need to understand that E, N, O, Z (spells Zone), and space are not with this text editing section. They are in another section in which will be discussed after these notes. It is important that you understand the format. Here is how it works.

FORMAT:
#1 #2

1 - Character
2 - Length that the character is drawn

Characters that are present more that once only show up once. This is because this stuff is only the info to tell what loads at startup and doesn't need to load the same thing twice since its already there. Here is a list of where all the strings are located.

Now, you will want to edit the actual strings and not just the sprites that load. So, here are the notes you need.

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

1 - Y position of the character every pixel
2 - Length (going by the character size bytes gives a corrected length)
3 - Graphics every 256 8x8 sprites
4 - Graphics every 8x8 sprite
5 - ???
6 - ???
7 - ???
8 - X position of the character every pixel

Now, remember that there is a 2 byte header for each string that tells how many characters to read. Now you will probably want the location that allows you to change what string is used for each level. So, here it is.

0147BA - 2 bytes for location after this location for each level

Here is how each string is listed.

Level 00
Level 01
Level 02
Level 03
Level 04
Level 05
Level 06
Level 07
Level 08
Level 09
Level 0A
Level 0B
Level 0C
Level 0D
Level 0E
Level 0F
Level 10
"Zone"
1
2
3
"Sonic The Hedgehog"
Red splash screen panel edges

Now, you need to know what value to give each character. Here are the values.

80 - E
84 - N
88 - O
8C - Z
DE - Character list (see "Level Splash Startup" above)

For quick referencing, here are some of the string locations.

Emerald Hill
0147EA - E
0147F2 - M
0147FA - E
014802 - R
01480A - A
014812 - L
01481A - D
014822 - H
01482A - I
014832 - L
01483A - L

Metropolis
014844 - M
01484C - E
014854 - T
01485C - R
014864 - O
01486C - P
014874 - O
01487C - L
014884 - I
01488C - S

Splash Screen Panel
014C32