Actions

SCHG How-to

Expand the music index to start at $00 instead of $80

From Sonic Retro

(Original guide by HPZMan)

Here's a easy way on how to use all slots from $00 to $FF on the Sonic 1 M68K Sound Driver.

Some notes:

After the changes, the addresses $FFFFFFFC and $FFFFFFFD will be used. Technically, it aren't new slots. Instead of this, it is a duplication from the slots $80 using a unique different index.

Slots $00 to $7F

Make a search for PlaySound:. You will see this:

PlaySound:
		move.b	d0,($FFFFF00A).w
		rts


Change to this:

PlaySound:
		cmpi.b  #$7F,d0
		ble.s   ChkSounds00to7F
		jmp	 NormalSoundRequest
ChkSounds00to7F:
		cmpi.b  #$01,d0
		bge.s   LoadSlots00to7F
		jmp	 NormalSoundRequest
LoadSlots00to7F:
		add.b   #$80,d0; Add $80 to get slot to starts at $81			
		move.b  #$01,($FFFFFFFC).w; Move $01 to $FFFFFC to make sound driver to load the secound index
NormalSoundRequest:
		move.b	d0,($FFFFF00A).w
		rts


Make a search for PlaySound_Special: You can see this:

PlaySound_Special:
		move.b	d0,($FFFFF00B).w
		rts


Change to this:

PlaySound_Special:
		cmpi.b  #$7F,d0
		ble.s   ChkSounds00to7F_Special
		jmp	 NormalSoundRequest_Special
ChkSounds00to7F_Special:

		cmpi.b  #$01,d0
		bge.s   LoadSlots00to7F_Special
		jmp	 NormalSoundRequest_Special
LoadSlots00to7F_Special:
		add.b   #$80,d0; Add $80 to get slot to starts at $81			
		move.b  #$01,($FFFFFFFC).w; Move $01 to $FFFFFC to make the sound driver to load the secound index
NormalSoundRequest_Special:
		move.b	d0,($FFFFF00B).w
		rts


Search for loc_7202C:, you will see this:

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


Change to this:

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
		cmpi.b  #$01,($FFFFFFFD).w
		bne.s   CheckSounds00to80
		movea.l	(Go_MusicIndexFF).l,a4
		jmp	 NormalIndexLoad
CheckSounds00to80:
		cmpi.b  #$01,($FFFFFFFC).w
		bne.s   NormalIndexLoad
		movea.l	(Go_MusicIndex00).l,a4		
NormalIndexLoad:
		clr.w   ($FFFFFFFC).w


Search for Go_MusicIndex:, you can see this:

Go_MusicIndex:	dc.l MusicIndex; XREF: Sound_81to9F


Below the Go_MusicIndex: code, add this:

Go_MusicIndex00:	dc.l MusicIndex00
Go_MusicIndexFF:	dc.l MusicIndexFF

Slots $E5 to $FF

Search for Sound_ChkValue:, you will see this:

Sound_ChkValue:; XREF: sub_71B4C
		moveq	#0,d7
		move.b	9(a6),d7
		beq.w	Sound_E4
		bpl.s	locret_71F8C
		move.b	#$80,9(a6); reset	music flag
		cmpi.b	#$9F,d7
		bls.w	Sound_81to9F; music	$81-$9F
		cmpi.b	#$A0,d7
		bcs.w	locret_71F8C
		cmpi.b	#$CF,d7
		bls.w	Sound_A0toCF; sound	$A0-$CF
		cmpi.b	#$D0,d7
		bcs.w	locret_71F8C
		cmpi.b	#$E0,d7
		bcs.w	Sound_D0toDF; sound	$D0-$DF
		cmpi.b	#$E4,d7
		bls.s	Sound_E0toE4; sound	$E0-$E4

locret_71F8C:
		rts


Change to this:

Sound_ChkValue:; XREF: sub_71B4C
		moveq	#0,d7
		move.b	9(a6),d7
		beq.w	Sound_E4
		bpl.s	locret_71F8C
		move.b	#$80,9(a6); reset	music flag
		cmpi.b  #$01,($FFFFFFFC).w
		bne.s   Load81to9F
		jmp	 Sound_ChkValueFor00
Load81to9F:
		cmpi.b	#$9F,d7
		bls.w	Sound_81to9F; music	$81-$9F
ContinueSound_ChkValue:
		cmpi.b	#$A0,d7
		bcs.w	locret_71F8C
		cmpi.b	#$CF,d7
		bls.w	Sound_A0toCF; sound	$A0-$CF
		cmpi.b	#$D0,d7
		bcs.w	locret_71F8C
		cmpi.b	#$E0,d7
		bcs.w	Sound_D0toDF; sound	$D0-$DF
		cmpi.b	#$E4,d7
		bls.s	Sound_E0toE4; sound	$E0-$E4
		cmpi.b  #$FF,d7
		bls.w   Sound_E5toFF

locret_71F8C:
		rts


Search for Sound_81to9F: and above Sound_81to9F, add this:

Sound_ChkValueFor00:
		cmpi.b  #$FF,d7; $FF = Last slot for musics in index $00 - $7F ($FF = $7F)
		bls.w   Sound_81to9F
		rts

Sound_E5toFF:
		move.b  #$01,($FFFFFFFD).w
		sub.b   #$64,d7

Inserting new songs

Now you just need to create the pointers for the songs at the index, and include them! To do it for the songs $01 to $7F, create in some place a index called MusicIndex00:. The index have to work like this:

MusicIndex00:
		dc.l	Music01; Music for slot $01
		dc.l	Music02; Music for slot $02
......


To the songs $E5 to $FF, create in some place a index called MusicIndexFF. The index have to work like this:

MusicIndexFF:
		dc.l	MusicE5; Music for slot $E5
		dc.l	MusicE6; Music for slot $E6
......


Making the Sound Test values to start at $00

Search for loc_3550:, you will see this:

		addi.w	#$80,d0

Remove or comment this line.


Make a search for LevelSelect:, below from this you can see:

		addi.w	#$80,d0

Remove or comment this line.


Search for LevSel_Right:, above it you will see this:

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

Change or comment these lines.


Search for LevSel_Refresh2:, above it you will see this:

		cmpi.w	#$50,d0
		bcs.s	LevSel_Refresh2
		moveq	#0,d0; if sound test	moves above $4F, set to	0

Remove or comment these lines.


Fixing possible problems with sound effects and songs

Go to SoundTypes:, you can see this:

SoundTypes:	dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$80
		dc.b $70, $70, $70, $70, $70, $70, $70,	$70, $70, $68, $70, $70, $70, $60, $70,	$70
		dc.b $60, $70, $60, $70, $70, $70, $70,	$70, $70, $70, $70, $70, $70, $70, $7F,	$60
		dc.b $70, $70, $70, $70, $70, $70, $70,	$70, $70, $70, $70, $70, $70, $70, $70,	$80
		dc.b $80, $80, $80, $80, $80, $80, $80,	$80, $80, $80, $80, $80, $80, $80, $80,	$90
		dc.b $90, $90, $90, $90


Change to this:

SoundTypes:	dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90,	$90
		dc.b $90, $90, $90, $90, $90, $90, $90,	$90, $90, $90, $90, $90, $90, $90, $90, $90


It should fix possible problems on play songs/sound effects and will not interfere the original songs and sound effects.

Optional - Putting the default Sonic 1 songs at the $0X slots index

Go to the index for songs $8X, MusicIndex.

Copy the pointers from it, remove them and paste it at the begin from the $0X slot index MusicIndex00.

Done.

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 | Port Sonic 2 Level Select
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)