Expand the music index to start at $00 instead of $80 (Sonic 2 Clone Driver version)
From Sonic Retro
(Original guide by Mikel, based on a guide by HPZMan)
Notes:
- Firstly, credit to HPZMan for the original guide he made for Sonic 1.
- Secondly, you need to have the Sonic 2 Clone Driver in your hack. To get the Clone Driver, go to this topic; it requires the Sonic 1 Sound Driver to be ported to your Sonic 2 hack first.
First, go to "PlayMusic:"
You will see something like this:
PlayMusic: ; tst.b ($FFFFFFE0).w ; bne.s + ; move.b d0,($FFFFFFE0).w move.b d0,($FFFFF00A).w rts + move.b d0,($FFFFF00A).w rts
Change it to:
PlayMusic: 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 you get slot that starts in $81 move.b #$01, ($FFFFFFFC) .w; $FFFFFC moves $01 you you make sound to driver load secound index NormalSoundRequest: move.b d0, ($FFFFF00A) .w rts
Then, go to "PlaySound:".
You will see something like this:
PlaySound: move.b d0,($FFFFF00B).w rts
Change it to:
PlaySound: 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 you get slot that starts in $81 move.b #$01, ($FFFFFFFC) .w; $FFFFFC moves $01 you you make sound to driver load secound index NormalSoundRequest_Special: move.b d0, ($FFFFF00B) .w rts
Then, go to "loc_7202C:"
You will see something like 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 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 cmpi.b #$01, ($FFFFFFFC) .w bne.s NormalIndexLoad movea.l (Go_MusicIndex_01to1F) .l, a4 NormalIndexLoad: clr.w ($FFFFFFFC) .w
Then, search for "Go_MusicIndex:"
You will see something like this:
Go_MusicIndex: dc.l MusicIndex ; XREF: Sound_81to9F
Add this below "Go_MusicIndex:":
Go_MusicIndex_01to1F: dc.l MusicIndex_01plus
Then, go to "MusicIndex:"
You will see something like this:
MusicIndex: dc.l Music81, Music82 dc.l Music83, Music84 dc.l Music85, Music86 dc.l Music87, Music88 dc.l Music89, Music8A dc.l Music8B, Music8C dc.l Music8D, Music8E dc.l Music8F, Music90 dc.l Music91, Music92 dc.l Music93, Music94 dc.l Music95, Music96 dc.l Music97, Music98 dc.l Music99, Music9A dc.l Music9B, Music9C dc.l Music9D, Music9E dc.l Music9F
Then, add this below "MusicIndex:"
MusicIndex_01plus: dc.l Music01, Music02
The "dc.l Music01, Music02" is basically an example of what music slots you should use for Slots $01 to any number you want to stop at
Then, go to "Sound_ChkValue:"
You should see something like 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 #$E0,d7 bge.s Sound_E0plus Sound_ChkValue_OtherChecks: cmpi.b #$FF,d7 bge.s Sound_E0toF8 cmpi.b #$9F,d7 ble.w Sound_81To9F cmpi.b #$F0,d7 ble.w Sound_A0ToCF cmpi.b #$F9,d7 bge.w Sound_E0toE4
Change it to:
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 #$E0,d7 bge.s Sound_E0plus cmpi.b #$01, ($FFFFFFFC) .w bne.s Load81to9F jmp Sound_ChkValueFor00 Load81to9F: cmpi.b #$9F, d7 bls.w Sound_81to9F; music $81-$9F Sound_ChkValue_OtherChecks: cmpi.b #$FF,d7 bge.s Sound_E0toF8 cmpi.b #$F0,d7 ble.w Sound_A0ToCF cmpi.b #$F9,d7 bge.w Sound_E0toE4
Now, go to "Sound_81to9F:", and change it to this:
Sound_ChkValueFor00: cmpi.b #$FF, d7; $FF = Last slot will be musics in index $00 - $7F ($FF = $7F) bls.w Sound_81to9F rts Sound_81to9F: ; XREF: Sound_ChkValue cmpi.b #$98,d7 ; is "extra life" music played? bne.s loc_72024 ; if not, branch tst.b $27(a6) bne.w loc_721B6 lea $40(a6),a5 moveq #9,d0
Finally, we are going to Change the number of sound test slots in the options and level select menus
To change the Options Sound Test,
Go to "word_917A:"
You will see something like this:
dc.w $7FFF ; 4 dc.w Sound_test_sound ; 5
Change the "$7" in "$7FFF" to anything you like, like "$FFFF", or "$CFFF"
To change the Level Select Sound Test,
Go to "loc_9522:"
You will see something like this:
loc_9522: cmpi.w #$15,(Level_select_zone).w bne.s loc_958A move.w (Sound_test_sound).w,d0 move.b (Ctrl_1_Press).w,d1 btst #2,d1 beq.s loc_953E subq.b #1,d0 bcc.s loc_953E moveq #$7F,d0
On the last moveq Change the "$7" in "$7F,d0" to mach the first two letters in the value you used above, like "$FF", or "$CF".
Go to "loc_954E:"
You will see something like this:
loc_954E: btst #6,d1 beq.s loc_955C addi.b #$10,d0 andi.b #$7F,d0
As before but on andi.b Change the "$7" in "$7F,d0" to the value you used above, like "$FF", or "$CF".
Lastly, Head back up to "loc_953E:" it should be between the two sections you just changed.
You will see something like this:
loc_953E: btst #3,d1 beq.s loc_954E addq.b #1,d0 cmpi.w #$80,d0 bcs.s loc_954E moveq #0,d0
change it to this:
loc_953E: btst #3,d1 beq.s loc_954E addq.b #1,d0
ADDITIONAL NOTES: Level Select Sound Test code was contributed by User:MattATobin with guidance from Ayla and Sik