SCHG How-to

Extend Music Slots in Sonic 1

From Sonic Retro

(Original guide by Mikel and ValleyBell)

This guide is now outdated because if you want to have more music tracks go here

Important note: This guide prefers label names of the Sonic 1 GitHub disassembly, but labels of the 2005 disassembly are also mentioned.

You may notice that in the Sound Test stops on $CF, and can't go any further than $CF. So here are instructions on how to extend the Music Slots to $FF in Sonic 1.

Step 1: editing the sound driver

To start go to Sound_ChkValue, if you see this line:

		cmpi.b	#$E4,d7
		bls.s	Sound_E0toE4

Add this under Sound_E0toE4:

		cmpi.b	#$FF,d7
		bls.w	Sound_PlayMoreBGM

Then, go to Sound_PlayBGM (Sound_81to9F in the 2005 disassembly), and add this right above Sound_PlayBGM:

Sound_PlayMoreBGM:	; Sound_E5toFF
		subi.b	#$45, d7	; map E5-FF range to A0-BA
		; fall through to Sound_PlayBGM

Then, go to MusicIndex. At first make sure that Music81 to Music9F are listed. If the list contains only Music81 to Music93, add Music94 to Music9F (and don't forget to define/include those songs).
Then add MusicE5 to MusicFF to the end of the list, after Music9F:

		dc.l MusicE5, MusicE6, MusicE7, MusicE8
		dc.l MusicE9, MusicEA, MusicEB, MusicEC
		dc.l MusicED, MusicEE, MusicEF, MusicF0
		dc.l MusicF1, MusicF2, MusicF3, MusicF4
		dc.l MusicF5, MusicF6, MusicF7, MusicF8
		dc.l MusicF9, MusicFA, MusicFB, MusicFC
		dc.l MusicFD, MusicFE, MusicFF

Then search for Music9F:

Music9F:	incbin	sound\music9F.bin

and add these lines:

MusicE5:	incbin	sound\musicE5.bin
MusicE6:	incbin	sound\musicE6.bin
MusicE7:	incbin	sound\musicE7.bin
MusicE8:	incbin	sound\musicE8.bin
MusicE9:	incbin	sound\musicE9.bin
MusicEA:	incbin	sound\musicEA.bin
MusicEB:	incbin	sound\musicEB.bin
MusicEC:	incbin	sound\musicEC.bin
MusicED:	incbin	sound\musicED.bin
MusicEE:	incbin	sound\musicEE.bin
MusicEF:	incbin	sound\musicEF.bin
MusicF0:	incbin	sound\musicF0.bin
MusicF1:	incbin	sound\musicF1.bin
MusicF2:	incbin	sound\musicF2.bin
MusicF3:	incbin	sound\musicF3.bin
MusicF4:	incbin	sound\musicF4.bin
MusicF5:	incbin	sound\musicF5.bin
MusicF6:	incbin	sound\musicF6.bin
MusicF7:	incbin	sound\musicF7.bin
MusicF8:	incbin	sound\musicF8.bin
MusicF9:	incbin	sound\musicF9.bin
MusicFA:	incbin	sound\musicFA.bin
MusicFB:	incbin	sound\musicFB.bin
MusicFC:	incbin	sound\musicFC.bin
MusicFD:	incbin	sound\musicFD.bin
MusicFE:	incbin	sound\musicFE.bin
MusicFF:	incbin	sound\musicFF.bin

If you would try to play songs in the range E5-FF now, they might not always play. The reason for this is, that the sound priority list has values for sound IDs 81-E4 only. So go to SoundPriorities (SoundTypes in the 2005 disassembly). The last line of the array is:

		dc.b $90,$90,$90,$90,$90                                            	; $E0

Now add the additional values for sound IDs E5-FF by replacing the line with:

		dc.b $90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90	; $E0
		dc.b $90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90,$90	; $F0

Step 2: extending the sound test

Next, we are going to extend the slots in the Sound Test. First go to LevSel_SndTest, and change:

		moveq	#$4F,d0		; if sound test	moves below 0, set to $4F


		moveq	#$7F,d0		; if sound test	moves below 0, set to $7F

Then, go to LevSel_Right, and change:

		cmpi.w	#$50,d0


		cmpi.w	#$80,d0

Last but not least, we are going to allow the Sound Test to read slots $E5 to $FF, so go to LevSel_NoCheat, and comment all lines until LevSel_PlaySnd out. (It should be 4 instructions.)

Then, build the rom and check out your newly added tunes.

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 | Fix a remember sprite related 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 | Port Sonic 2 Level Select
Adding Features
Add Spin Dash ( Part 1 / Part 2 / Part 3 / Part 4 ) | Add Eggman Monitor | Add Super Sonic
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 | Use Dynamic Palettes
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)