Actions

SCHG How-to

Fix the Level Select menu in Sonic 1

From Sonic Retro

(Original guide by STHX. Updated for GitHub Disassembly by Egor305)

The first part is based on information contained in SCHG:Sonic the Hedgehog/Text Editing, the second part has some original research. Also, this guide is useless if you use ESE, since it can easily change the Level Select menu and the pointers by itself, but it helps if you use a disassembly.


Anyway, let's start:

Introduction

If you have been a part of the Sonic Retro community for a long time, chances are you have played Sonic The Hedgehog, and if you played it, you know it has a Level Select code (UP DOWN LEFT RIGHT to activate it, A+START to enter the level select menu). However, the Zone order in the menu (in the game's first version) is not the actual in-game order, but the original planned order.

Sonic1 level select.png

This guide will show you how to change it and still maintain its functions. You will need a Hex Editor for this.

GitHub Disassembly

This version of guide is for GitHub Disassembly. (Known before as, and based on SVN Disassembly)

One of major differences between Hivebrain 2005 Disassembly and GitHub Disassembly is ability to add fixed/features from Japan-only revision 01, which have Level Select menu already fixed. Thanks to that, you don't need to change text/pointers by hand, because you can just copy-paste fixed data. It's still recommended to read old Hivebrain 2005 Disassembly guide, as it have information on how Level Select text/pointers can be changed.

Fast way

Fast (but not best) way to fix Level Select menu.

Search for LevelMenuText and LevSel_Ptrs. You will find those two lines:

LevelMenuText:	if Revision=0

and

LevSel_Ptrs:	if Revision=0

In those lines, replace 0 with 1. It's not recommended to use this method, because it's affects revision 01, which shouldn't be.

As with effective way, if you ever want to edit level select text later on, you will need to edit "Level Select Text (JP1).bin" instead of "Level Select Text.bin"

Step 1: The Text in the GitHub Disassembly

Open sonic.asm

Make a search for LevelMenuText. You should find this:

LevelMenuText:	if Revision=0
		incbin	"misc\Level Select Text.bin"
		else
		incbin	"misc\Level Select Text (JP1).bin"
		endc
		even

replace it with this:

LevelMenuText:	incbin	"misc\Level Select Text (JP1).bin"
		even

That way fixed level select text file from newer revision will be loaded instead of original one.

If you ever want to edit level select text later on, you will need to edit "Level Select Text (JP1).bin" instead of "Level Select Text.bin"

If you want to, (for proper naming) you can rename "Level Select Text (JP1).bin" to "Level Select Text.bin" (with overwriting) and use incbin "misc\Level Select Text.bin".

Step 2: The Level Pointers in the GitHub Disassembly

Open sonic.asm.

Make a search for LevSel_Ptrs. You should find this:

LevSel_Ptrs:	if Revision=0
		; old level order
		dc.b id_GHZ, 0
		dc.b id_GHZ, 1
		dc.b id_GHZ, 2
		dc.b id_LZ, 0
		dc.b id_LZ, 1
		dc.b id_LZ, 2
		dc.b id_MZ, 0
		dc.b id_MZ, 1
		dc.b id_MZ, 2
		dc.b id_SLZ, 0
		dc.b id_SLZ, 1
		dc.b id_SLZ, 2
		dc.b id_SYZ, 0
		dc.b id_SYZ, 1
		dc.b id_SYZ, 2
		dc.b id_SBZ, 0
		dc.b id_SBZ, 1
		dc.b id_LZ, 3		; Scrap Brain Zone 3
		dc.b id_SBZ, 2		; Final Zone
		else
		; correct level order
		dc.b id_GHZ, 0
		dc.b id_GHZ, 1
		dc.b id_GHZ, 2
		dc.b id_MZ, 0
		dc.b id_MZ, 1
		dc.b id_MZ, 2
		dc.b id_SYZ, 0
		dc.b id_SYZ, 1
		dc.b id_SYZ, 2
		dc.b id_LZ, 0
		dc.b id_LZ, 1
		dc.b id_LZ, 2
		dc.b id_SLZ, 0
		dc.b id_SLZ, 1
		dc.b id_SLZ, 2
		dc.b id_SBZ, 0
		dc.b id_SBZ, 1
		dc.b id_LZ, 3
		dc.b id_SBZ, 2
		endc
		dc.b id_SS, 0		; Special Stage
		dc.w $8000		; Sound Test
		even

replace it (yes whole label) with this:

LevSel_Ptrs:	dc.b id_GHZ, 0
		dc.b id_GHZ, 1
		dc.b id_GHZ, 2
		dc.b id_MZ, 0
		dc.b id_MZ, 1
		dc.b id_MZ, 2
		dc.b id_SYZ, 0
		dc.b id_SYZ, 1
		dc.b id_SYZ, 2
		dc.b id_LZ, 0
		dc.b id_LZ, 1
		dc.b id_LZ, 2
		dc.b id_SLZ, 0
		dc.b id_SLZ, 1
		dc.b id_SLZ, 2
		dc.b id_SBZ, 0
		dc.b id_SBZ, 1
		dc.b id_LZ, 3		; Scrap Brain Zone 3
		dc.b id_SBZ, 2		; Final Zone
		dc.b id_SS, 0		; Special Stage
		dc.w $8000		; Sound Test
		even

Hivebrain 2005 Disassembly

This is old version of guide, made for Hivebrain's Sonic 1 Disassembly 2005 (updated to ASM68K).

Step 1: The Text in the Hivebrain 2005 Disassembly

From the Hivebrain 2005 Disassembly open with an hex editor the file menutext.bin in the misc folder. (In GitHub Disassembly this file called Level Select Text.bin or Level Select Text (JP1).bin in case you already aplied fix.) You should have something like this:

17 22 15 15 1E FF 18 19 1C 1C FF 10 1F 1E 15 FF FF 23 24 11 17 15 FF 01 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 1C 11 12 0F 22 19 1E 24 18 FF 10 1F 1E 15 FF FF FF 23 24 11 17 15 FF 01 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 1D 11 22 12 1C 15 FF 10 1F 1E 15 FF FF FF FF FF FF 23 24 11 17 15 FF 01 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 23 24 11 22 FF 1C 19 17 18 24 FF 10 1F 1E 15 FF FF 23 24 11 17 15 FF 01 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 23 20 22 19 1E 17 FF 0F 11 22 14 FF 10 1F 1E 15 FF 23 24 11 17 15 FF 01 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 23 13 22 11 20 FF 12 22 11 19 1E FF 10 1F 1E 15 FF 23 24 11 17 15 FF 01 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 16 19 1E 11 1C FF 10 1F 1E 15 FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 20 15 13 19 11 1C FF 23 24 11 17 15 FF FF FF FF FF FF FF FF FF FF FF 23 1F 25 1E 14 FF 23 15 1C 15 13 24 FF FF FF FF FF FF FF FF FF FF FF FF

Now, if you have read the article SCHG:Sonic the Hedgehog/Text Editing, you know that all of this bytes can be translated to a character. In particular:

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)

if your hex editor supports TBL files, you can use this 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= 

These are the corresponding values, that, when rearranged will look like this:

17 22 15 15 1E FF 18 19 1C 1C FF 10 1F 1E 15 FF FF 23 24 11 17 15 FF 01 (GREEN HILL ZONE STAGE 1)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 (STAGE 2)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 (STAGE 3)
1C 11 12 0F 22 19 1E 24 18 FF 10 1F 1E 15 FF FF FF 23 24 11 17 15 FF 01 (LABYRINTH ZONE STAGE 1)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 (STAGE 2)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 (STAGE 3)
1D 11 22 12 1C 15 FF 10 1F 1E 15 FF FF FF FF FF FF 23 24 11 17 15 FF 01 (MARBLE ZONE STAGE 1)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 (STAGE 2)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 (STAGE 3)
23 24 11 22 FF 1C 19 17 18 24 FF 10 1F 1E 15 FF FF 23 24 11 17 15 FF 01 (STAR LIGHT ZONE STAGE 1)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 (STAGE 2)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 (STAGE 3)
23 20 22 19 1E 17 FF 0F 11 22 14 FF 10 1F 1E 15 FF 23 24 11 17 15 FF 01 (SPRING YARD ZONE STAGE 1)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 (STAGE 2)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 (STAGE 3)
23 13 22 11 20 FF 12 22 11 19 1E FF 10 1F 1E 15 FF 23 24 11 17 15 FF 01 (SCRAP BRAIN ZONE STAGE 1)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 (STAGE 2)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 (STAGE 3)
16 19 1E 11 1C FF 10 1F 1E 15 FF FF FF FF FF FF FF FF FF FF FF FF FF FF (FINAL ZONE)
23 20 15 13 19 11 1C FF 23 24 11 17 15 FF FF FF FF FF FF FF FF FF FF FF (SPECIAL STAGE)
23 1F 25 1E 14 FF 23 15 1C 15 13 24 FF FF FF FF FF FF FF FF FF FF FF FF (SOUND SELECT)

Now you can change the code to make it reflect the true in-game Zone order (Green Hill Zone, Marble Zone, Spring Yard Zone, Labyrinth Zone, Star Light Zone, Scrap Brain Zone, Final Zone). In the end, you should have something like this:

17 22 15 15 1E FF 18 19 1C 1C FF 10 1F 1E 15 FF FF 23 24 11 17 15 FF 01 (GREEN HILL ZONE STAGE 1)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 (STAGE 2)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 (STAGE 3)
1D 11 22 12 1C 15 FF 10 1F 1E 15 FF FF FF FF FF FF 23 24 11 17 15 FF 01 (MARBLE ZONE STAGE 1)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 (STAGE 2)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 (STAGE 3)
23 20 22 19 1E 17 FF 0F 11 22 14 FF 10 1F 1E 15 FF 23 24 11 17 15 FF 01 (SPRING YARD ZONE STAGE 1)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 (STAGE 2)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 (STAGE 3)
1C 11 12 0F 22 19 1E 24 18 FF 10 1F 1E 15 FF FF FF 23 24 11 17 15 FF 01 (LABYRINTH ZONE STAGE 1)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 (STAGE 2)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 (STAGE 3)
23 24 11 22 FF 1C 19 17 18 24 FF 10 1F 1E 15 FF FF 23 24 11 17 15 FF 01 (STAR LIGHT ZONE STAGE 1)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 (STAGE 2)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 (STAGE 3)
23 13 22 11 20 FF 12 22 11 19 1E FF 10 1F 1E 15 FF 23 24 11 17 15 FF 01 (SCRAP BRAIN ZONE STAGE 1)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 02 (STAGE 2)
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 23 24 11 17 15 FF 03 (STAGE 3)
16 19 1E 11 1C FF 10 1F 1E 15 FF FF FF FF FF FF FF FF FF FF FF FF FF FF (FINAL ZONE)
23 20 15 13 19 11 1C FF 23 24 11 17 15 FF FF FF FF FF FF FF FF FF FF FF (SPECIAL STAGE)
23 1F 25 1E 14 FF 23 15 1C 15 13 24 FF FF FF FF FF FF FF FF FF FF FF FF (SOUND SELECT)

Save, test, build, and you should have done it. However, now that the text is changed, there seems to a bigger problem...

STHX LS guide 2.png

Because if you select Marble Zone Stage 1...

STHX LS guide 3.png

You will go to Labyrinth Zone instead! So, does this mean we screwed up? Yes, but only because the level pointers were not altered, and now we will change them.

Step 2: The Level Pointers in the Hivebrain 2005 Disassembly

From the Hivebrain 2005 Disassembly open with an hex editor the file ls-point.bin in the misc folder. You should have something like this:

00 00 00 01 00 02 01 00 01 01 01 02 02 00 02 01 02 02 03 00 03 01 03 02 04 00 04 01 04 02 05 00 05 01 01 03 05 02 07 00 80 00

This file tells the game in what Zone the various selections of the Level Select Menu will take Sonic (The Level Pointers). But... What does it mean?

Before going on, let me explain something on the Zones. The game gives a hex value to all Zones and to all Acts, and the order follows (Again) the original planned order of the levels. Each level is identified with a pair of bytes, the first indicates the zone number (remember, they are in Hex, and they start at 00):

00 = Green Hill Zone
01 = Labyrinth Zone
02 = Marble Zone
03 = Star Light Zone
04 = Spring Yard Zone
05 = Scrap Brain Zone
06 = Ending level (The one where you go after clearing Final Zone)
07 = Special Stage

While the second indicate the zone act:

00 = Act 1
01 = Act 2
02 = Act 3
03 = Act 4 (No, it's not a mistake. Sonic The Hedgehog has a fourth Act, I'll explain this after)

Still unclear? Then let's arrange the code:

(GREEN HILL ZONE STAGE 1) 00 00
(STAGE 2) 00 01
(STAGE 3) 00 02
(LABYRINTH ZONE STAGE 1 01 00
(STAGE 2) 01 01
(STAGE 3) 01 02
(MARBLE ZONE STAGE 1) 02 00
(STAGE 2) 02 01
(STAGE 3) 02 02
(STAR LIGHT ZONE STAGE 1) 03 00
(STAGE 2) 03 01
(STAGE 3) 03 02
(SPRING YARD ZONE STAGE 1) 04 00
(STAGE 2) 04 01
(STAGE 3) 04 02
(SCRAP BRAIN ZONE STAGE 1) 05 00
(STAGE 2) 05 01
(STAGE 3) 01 03 [Remember the fourth act thing? Then do not forget that SBZ Act 3 is in truth LZ act 4. This is important! FZ is the true SBZ Act 3]
(FINAL ZONE) 05 02
(SPECIAL STAGE) 07 00
(SOUND SELECT) 80 00 [This does not point to any level]

Now it's a lot easier to understand that bunch of Hex values. Now change them so they reflect the new Text in the menu. In the end you should have something like this:

00 00 00 01 00 02 02 00 02 01 02 02 04 00 04 01 04 02 01 00 01 01 01 02 03 00 03 01 03 02 05 00 05 01 01 03 05 02 07 00 80 00 

Which, if rearranged:

(GREEN HILL ZONE STAGE 1) 00 00
(STAGE 2) 00 01
(STAGE 3) 00 02
(MARBLE ZONE STAGE 1) 02 00
(STAGE 2) 02 01
(STAGE 3) 02 02
(SPRING YARD ZONE STAGE 1) 04 00
(STAGE 2) 04 01
(STAGE 3) 04 02
(LABYRINTH ZONE STAGE 1 01 00
(STAGE 2) 01 01
(STAGE 3) 01 02
(STAR LIGHT ZONE STAGE 1) 03 00
(STAGE 2) 03 01
(STAGE 3) 03 02
(SCRAP BRAIN ZONE STAGE 1) 05 00
(STAGE 2) 05 01
(STAGE 3) 01 03
(FINAL ZONE) 05 02
(SPECIAL STAGE) 07 00
(SOUND SELECT) 80 00

Save, build, and try again to select Marble Zone Stage 1.

STHX LS guide 5.png

Success!!! The level select menu will not only have the the Zones arranged in the right order, but you will actually go there when you select them.

Final note

This can help you if you plan to change the Zone names and/or order in your hack, and still have a perfect Level Select Menu. Have fun!

SCHG How-To Guide: Sonic the Hedgehog (16-bit)
Fixing Bugs
Fix Demo Playback | Fix a Race Condition with Pattern Load Cues | Fix the SEGA Sound | Display the Press Start Button Text | Fix the Level Select Menu | Fix the Hidden Points Bug | Fix Accidental Deletion of Scattered Rings | Fix Ring Timers | Fix the Walk-Jump Bug | Correct Drowning Bugs | Fix the Death Boundary Bug | Fix the Camera Follow Bug | Fix Song Restoration Bugs | Fix the HUD Blinking | Fix the Level Select Graphics Bug
Changing Design Choices
Change Spike Behavior | Fix Special Stage Jumping Physics | Improve the Fade In\Fade Out Progression Routines | Fix Scattered Rings' Underwater Physics | Remove the Speed Cap | Port the REV01 Background Effects | Port Sonic 2's Level Art Loader | Retain Rings Between Acts | Add Sonic 2 (Simon Wai Prototype) Level Select | Improve ObjectMove Subroutines
Adding Features
Add Spin Dash ( Part 1 / Part 2 / Part 3 / Part 4 ) | Add Eggman Monitor
Sound Features
Expand Music Index From $94 to $9F | Extend Music Slots | Play Different Songs Per Act | Expand Music Index to Start at $00 | Port Sonic 2 Final Sound Driver | Port Sonic 3's Sound Driver
Extending the Game
Load Chunks From ROM | Add Extra Characters | Make an Alternative Title Screen | Use Dynamic Tilesets | Make GHZ Load Alternate Art | Add a New Zone | Set Up the Goggle Monitor | Add New Moves | Add a Dynamic Collision System | Dynamic Special Stage Walls System | Extend Sprite Mappings and Art Limit | Enigma Credits
Miscellaneous
Convert the Hivebrain 2005 Disassembly to ASM68K
Split Disassembly Guides
Set Up a Split Disassembly | Basic Level Editing | Basic Art Editing | Basic ASM Editing (Spin Dash)