Extend Music Slots in Sonic 1
From Sonic Retro
Revision as of 21:45, 20 December 2015 by Scarred Sun (talk | contribs) (Text replacement - "<asm>" to "<syntaxhighlight lang="asm">")
(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.