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)
NOTE: First off, Credit HPZMan for the Original Guide he made for Sonic 1, which can be found right here.
Second of all, you need to have the Sonic 2 Clone Driver in your hack, to get the Clone Driver, go to this topic, this requires the Sonic 1 Sound Driver to be installed in your Sonic 2 hack first.
First, go to "PlayMusic:"
You will see something like this: <asm> PlayMusic:
- tst.b ($FFFFFFE0).w
- bne.s +
- move.b d0,($FFFFFFE0).w
move.b d0,($FFFFF00A).w rts + move.b d0,($FFFFF00A).w rts </asm> Change it to:
<asm> 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
</asm> Then, go to "PlaySound:".
You will see something like this:
<asm> PlaySound: move.b d0,($FFFFF00B).w rts </asm> Change it to:
<asm> 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
</asm> Then, go to "loc_7202C:"
You will see something like this:
<asm> 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 </asm> Change it to:
<asm> 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
</asm> Then, search for "Go_MusicIndex:"
You will see something like this:
<asm> Go_MusicIndex: dc.l MusicIndex ; XREF: Sound_81to9F </asm> Add this below "Go_MusicIndex:":
<asm> Go_MusicIndex_01to1F: dc.l MusicIndex_01plus </asm> Then, go to "MusicIndex:"
You will see something like this:
<asm> 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 </asm> Then, add this below "MusicIndex:"
<asm> MusicIndex_01plus:
dc.l Music01, Music02
</asm> 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:
<asm> 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 </asm> Change it to:
<asm> 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 </asm> Now, go to "Sound_81to9F:", and change it to this:
<asm> 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
</asm>
Finally, we are going to Change the number of sound test slots in the options menu
Go to "word_917A:"
You will see something like this:
<asm> dc.w $7FFF ; 4 dc.w Sound_test_sound ; 5 </asm> Change the "$7" in "$7FFF" to anything you like, like "$FFFF", or "$CFFF"
That's all for now, this guide will cover Level Select Sound Test Slot expansion soon