Actions

SCHG How-to

Difference between revisions of "Extend Music Slots in Sonic 1"

From Sonic Retro

m (Text replacement - "</asm>" to "</syntaxhighlight>")
m (Text replacement - "<asm>" to "<syntaxhighlight lang="asm">")
Line 5: Line 5:
 
To start go to Sound_ChkValue, if you see this line:
 
To start go to Sound_ChkValue, if you see this line:
  
<asm> cmpi.b #$E4,d7
+
<syntaxhighlight lang="asm"> cmpi.b #$E4,d7
 
bls.s Sound_E0toE4</syntaxhighlight>
 
bls.s Sound_E0toE4</syntaxhighlight>
 
Add this under Sound_E0toE4:
 
Add this under Sound_E0toE4:
  
<asm> cmpi.b #$FF,d7
+
<syntaxhighlight lang="asm"> cmpi.b #$FF,d7
 
bls.w Sound_E5toFF</syntaxhighlight>
 
bls.w Sound_E5toFF</syntaxhighlight>
 
Then, go to Sound_81to9F, and add this above Sound_81to9F:
 
Then, go to Sound_81to9F, and add this above Sound_81to9F:
  
<asm>Sound_E5toFF:
+
<syntaxhighlight lang="asm">Sound_E5toFF:
 
jsr sub_725CA(pc)
 
jsr sub_725CA(pc)
 
movea.l (off_719A0).l,a4
 
movea.l (off_719A0).l,a4
Line 22: Line 22:
 
Then go to loc_7202C, and change it to:
 
Then go to loc_7202C, and change it to:
  
<asm>
+
<syntaxhighlight lang="asm">
 
loc_7202C:
 
loc_7202C:
 
jsr sub_725CA(pc)
 
jsr sub_725CA(pc)
Line 43: Line 43:
 
Then, change:
 
Then, change:
  
<asm>
+
<syntaxhighlight lang="asm">
 
Go_SoundTypes: dc.l SoundTypes ; XREF: Sound_Play
 
Go_SoundTypes: dc.l SoundTypes ; XREF: Sound_Play
 
Go_SoundD0: dc.l SoundD0Index ; XREF: Sound_D0toDF
 
Go_SoundD0: dc.l SoundD0Index ; XREF: Sound_D0toDF
Line 52: Line 52:
 
To:
 
To:
  
<asm> align $10
+
<syntaxhighlight lang="asm"> align $10
 
Go_SoundTypes: dc.l SoundTypes ; XREF: Sound_Play
 
Go_SoundTypes: dc.l SoundTypes ; XREF: Sound_Play
 
Go_SoundD0: dc.l SoundD0Index ; XREF: Sound_D0toDF
 
Go_SoundD0: dc.l SoundD0Index ; XREF: Sound_D0toDF
Line 62: Line 62:
 
Then, go to:
 
Then, go to:
  
<asm>Music9F: incbin sound\music9F.bin
+
<syntaxhighlight lang="asm">Music9F: incbin sound\music9F.bin
 
even</syntaxhighlight>
 
even</syntaxhighlight>
 
And add the following lines under the line I posted above:
 
And add the following lines under the line I posted above:
  
<asm>MusicIndex_E5plus:
+
<syntaxhighlight lang="asm">MusicIndex_E5plus:
 
                                 dc.l MusicE5, MusicE6
 
                                 dc.l MusicE5, MusicE6
 
dc.l MusicE7, MusicE8
 
dc.l MusicE7, MusicE8
Line 84: Line 84:
 
Then, under MusicIndex_E5toFF, add these lines:
 
Then, under MusicIndex_E5toFF, add these lines:
  
<asm>MusicE5: incbin sound\musicE5.bin
+
<syntaxhighlight lang="asm">MusicE5: incbin sound\musicE5.bin
 
even
 
even
 
MusicE6: incbin sound\musicE6.bin
 
MusicE6: incbin sound\musicE6.bin
Line 140: Line 140:
 
Next, we are going to extend the slots in the Sound Test, first go to LevSel_SndTest, and change:
 
Next, we are going to extend the slots in the Sound Test, first go to LevSel_SndTest, and change:
  
<asm> moveq #$4F,d0 ; if sound test moves below 0, set to $4F</syntaxhighlight>
+
<syntaxhighlight lang="asm"> moveq #$4F,d0 ; if sound test moves below 0, set to $4F</syntaxhighlight>
 
To:
 
To:
  
<asm> moveq #$7F,d0 ; if sound test moves below 0, set to $7F</syntaxhighlight>
+
<syntaxhighlight lang="asm"> moveq #$7F,d0 ; if sound test moves below 0, set to $7F</syntaxhighlight>
 
Then, go to LevSel_Right, and change:
 
Then, go to LevSel_Right, and change:
  
<asm> cmpi.w #$50,d0</syntaxhighlight>
+
<syntaxhighlight lang="asm"> cmpi.w #$50,d0</syntaxhighlight>
 
To:
 
To:
  
<asm> cmpi.w #$80,d0</syntaxhighlight>
+
<syntaxhighlight lang="asm"> cmpi.w #$80,d0</syntaxhighlight>
 
Last but not least, we are going to allow the Sound Test to read slots $E5 to $FF, so go to LevSel_NoCheat, and change:
 
Last but not least, we are going to allow the Sound Test to read slots $E5 to $FF, so go to LevSel_NoCheat, and change:
  
<asm> cmpi.w #$9F,d0 ; is sound $80-$9F being played?
+
<syntaxhighlight lang="asm"> cmpi.w #$9F,d0 ; is sound $80-$9F being played?
 
ble.s LevSel_PlaySnd ; if yes, branch</syntaxhighlight>
 
ble.s LevSel_PlaySnd ; if yes, branch</syntaxhighlight>
 
To:
 
To:
  
<asm> cmpi.w #$FF,d0 ; is sound $E5-$FF being played?
+
<syntaxhighlight lang="asm"> cmpi.w #$FF,d0 ; is sound $E5-$FF being played?
 
ble.s LevSel_PlaySnd ; if yes, branch</syntaxhighlight>
 
ble.s LevSel_PlaySnd ; if yes, branch</syntaxhighlight>
 
Then, build the rom and check out your newly added tunes.
 
Then, build the rom and check out your newly added tunes.

Revision as of 21:45, 20 December 2015

(Original guide by Mikel)

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.

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_E5toFF

Then, go to Sound_81to9F, and add this above Sound_81to9F:

Sound_E5toFF:
		jsr	sub_725CA(pc)
		movea.l	(off_719A0).l,a4
		subi.b	#$E5,d7
		move.b	(a4,d7.w),$29(a6)
		movea.l	(Go_MusicIndex_E5toFF).l,a4
                  jmp Music_Continue

Then go to loc_7202C, and change it to:

loc_7202C:
		jsr	sub_725CA(pc)
		movea.l	(off_719A0).l,a4
		subi.b	#$81,d7
		move.b	(a4,d7.w),$29(a6)
		movea.l	(Go_MusicIndex).l,a4
Music_Continue:
		lsl.w	#2,d7
		movea.l	(a4,d7.w),a4
		moveq	#0,d0
		move.w	(a4),d0
		add.l	a4,d0
		move.l	d0,$18(a6)
		move.b	5(a4),d0
		move.b	d0,$28(a6)
		tst.b	$2A(a6)
		beq.s	loc_72068
		move.b	$29(a6),d0

Then, change:

Go_SoundTypes:	dc.l SoundTypes		; XREF: Sound_Play
Go_SoundD0:	dc.l SoundD0Index	; XREF: Sound_D0toDF
Go_MusicIndex:	dc.l MusicIndex		; XREF: Sound_81to9F
Go_SoundIndex:	dc.l SoundIndex		; XREF: Sound_A0toCF
off_719A0:	dc.l byte_71A94		; XREF: Sound_81to9F
Go_PSGIndex:	dc.l PSG_Index		; XREF: sub_72926

To:

		align $10
Go_SoundTypes:	dc.l SoundTypes		; XREF: Sound_Play
Go_SoundD0:	dc.l SoundD0Index	; XREF: Sound_D0toDF
Go_MusicIndex:	dc.l MusicIndex		; XREF: Sound_81to9F
Go_MusicIndex_E5toFF:	dc.l MusicIndex_E5plus		; XREF: Sound_81to9F
Go_SoundIndex:	dc.l SoundIndex		; XREF: Sound_A0toCF
off_719A0:	dc.l byte_71A94		; XREF: Sound_81to9F
Go_PSGIndex:	dc.l PSG_Index		; XREF: sub_72926

Then, go to:

Music9F:	incbin	sound\music9F.bin
		even

And add the following lines under the line I posted above:

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

Then, under MusicIndex_E5toFF, add these lines:

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

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

To:

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

Then, go to LevSel_Right, and change:

		cmpi.w	#$50,d0

To:

		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 change:

		cmpi.w	#$9F,d0		; is sound $80-$9F being played?
		ble.s	LevSel_PlaySnd	; if yes, branch

To:

		cmpi.w	#$FF,d0		; is sound $E5-$FF being played?
		ble.s	LevSel_PlaySnd	; if yes, branch

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 | Collide with Water After Being Hurt | 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 | Add the Air Roll
Sound Features
Expand the Sound Index | Play Different Songs Per Act | Port Sonic 2 Final Sound Driver | Port Sonic 3's Sound Driver | Port Flamewing's Sonic 3 & Knuckles Sound Driver | Change The SEGA Sound
Extending the Game
Load Chunks From ROM | Add Extra Characters | Make an Alternative Title Screen | Use Dynamic Tilesets | Make GHZ Load Alternate Art | Make Ending 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
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)