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: <asm>PlaySound: move.b d0,($FFFFF00A).w rts</asm>


Change to this: <asm>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</asm>


Make a search for PlaySound_Special: You can see this: <asm>PlaySound_Special: move.b d0,($FFFFF00B).w rts</asm>


Change to this: <asm>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</asm>


Search for loc_7202C:, you will see 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 to 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 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</asm>


Search for Go_MusicIndex:, you can see this: <asm>Go_MusicIndex: dc.l MusicIndex; XREF: Sound_81to9F</asm>


Below from the thing you found, add this: <asm>Go_MusicIndex00: dc.l MusicIndex00 Go_MusicIndexFF: dc.l MusicIndexFF</asm>


Slots $E5 to $FF

Search for Sound_ChkValue:, you will see 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 #$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</asm>


Change to 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 #$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</asm>


Search for Sound_81to9F: and above the thing you found, add this: <asm>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</asm>


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: <asm>MusicIndex00: dc.l Music01; Music for slot $01 dc.l Music02; Music for slot $02 ......</asm>


To the songs $E5 to $FF, create in some place a index called MusicIndexFF. The index have to work like this: <asm>MusicIndexFF: dc.l MusicE5; Music for slot $E5 dc.l MusicE6; Music for slot $E6 ......</asm>


Making the Sound Test values to start at $00

Search for loc_3550:, you will see this: <asm> addi.w #$80,d0</asm> Remove or comment this line.


Make a search for LevelSelect:, below from this you can see: <asm> addi.w #$80,d0</asm> Remove or comment this line.


Search for LevSel_Right:, above it you will see this: <asm> bcc.s LevSel_Right moveq #$4F,d0; if sound test moves below 0, set to $4F</asm> Change or comment these lines.


Search for LevSel_Refresh2:, above it you will see this: <asm> cmpi.w #$50,d0 bcs.s LevSel_Refresh2 moveq #0,d0; if sound test moves above $4F, set to 0</asm> Remove or comment these lines.


Fixing possible problems with sound effects and songs

Go to SoundTypes:, you can see this: <asm>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</asm>


Change to this: <asm>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</asm>


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.