Actions

SCHG How-to

Difference between revisions of "Expand the music index from $94 to $9F"

From Sonic Retro

m
(Added info on extending the music index and pointers plus a "bug fix" for song 9F which normally won't play with the original tutorial.)
Line 14: Line 14:
  
 
And now the sound test will have the music slots going up to $9F, instead of $94, however attempts to play empty music slots will crash the sound driver, and possibly lock up the emulator. So, make sure you include a song in every slot.
 
And now the sound test will have the music slots going up to $9F, instead of $94, however attempts to play empty music slots will crash the sound driver, and possibly lock up the emulator. So, make sure you include a song in every slot.
 +
 +
''(Addition by [[User:Vanya|Vanya]])''
 +
 +
This applies to the Hivebrain 2005 disasm.
 +
Just adding the new .bin files to the sound folder isn't enough. You'll need to add entries to the music index and the music pointers.
 +
 +
First, search for "<b>MusicIndex:</b>" and following the same format add new entries for the new tracks.
 +
 +
<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
 +
</asm>
 +
 +
You should end up with 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>
 +
 +
Next, expand the music file pointers. They are at the end of the file just before the sound effect pointers.
 +
Just add entries for the remaining files at the end.
 +
 +
<asm>
 +
Music94: incbin sound\music94.bin
 +
even
 +
Music95: incbin sound\music95.bin
 +
even
 +
Music96: incbin sound\music96.bin
 +
even
 +
Music97: incbin sound\music97.bin
 +
even
 +
Music98: incbin sound\music98.bin
 +
even
 +
Music99: incbin sound\music99.bin
 +
even
 +
Music9A: incbin sound\music9A.bin
 +
even
 +
Music9B: incbin sound\music9B.bin
 +
even
 +
Music9C: incbin sound\music9C.bin
 +
even
 +
Music9D: incbin sound\music9D.bin
 +
even
 +
Music9E: incbin sound\music9E.bin
 +
even
 +
Music9F: incbin sound\music9F.bin
 +
even
 +
</asm>
 +
 +
One last thing to note is that song 9F won't play unless one more change is made.
 +
 +
<asm>LevSel_NoCheat:
 +
        cmpi.w    #$94,d0    ; is sound $80-$94 being played?
 +
        bcs.s    LevSel_PlaySnd; if yes, branch
 +
        cmpi.w    #$A0,d0    ; is sound $95-$A0 being played?
 +
        bcs.s    LevelSelect; if yes, branch</asm>
 +
Change the line:
 +
<asm>        bcs.s    LevSel_PlaySnd; if yes, branch</asm>
 +
So it reads:
 +
<asm>        ble.s    LevSel_PlaySnd; if yes, branch</asm>
  
 
{{S1Howtos}}
 
{{S1Howtos}}
 
[[Category:SCHG_How-tos|{{PAGENAME}}]]
 
[[Category:SCHG_How-tos|{{PAGENAME}}]]

Revision as of 12:53, 19 October 2014

(Original guide by lukeusher123)

To add more music slots to the sound test, search for this code in the level select routine: <asm>LevSel_NoCheat:

       cmpi.w    #$94,d0    ; is sound $80-$94 being played?
       bcs.s    LevSel_PlaySnd; if yes, branch
       cmpi.w    #$A0,d0    ; is sound $95-$A0 being played?
       bcs.s    LevelSelect; if yes, branch</asm>

Change the line: <asm> cmpi.w #$94,d0  ; is sound $80-$94 being played?</asm> So it reads: <asm> cmpi.w #$9F,d0  ; is sound $80-$9F being played?</asm> Then rebuild the ROM.

And now the sound test will have the music slots going up to $9F, instead of $94, however attempts to play empty music slots will crash the sound driver, and possibly lock up the emulator. So, make sure you include a song in every slot.

(Addition by Vanya)

This applies to the Hivebrain 2005 disasm. Just adding the new .bin files to the sound folder isn't enough. You'll need to add entries to the music index and the music pointers.

First, search for "MusicIndex:" and following the same format add new entries for the new tracks.

<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 </asm>

You should end up with 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>

Next, expand the music file pointers. They are at the end of the file just before the sound effect pointers. Just add entries for the remaining files at the end.

<asm> Music94: incbin sound\music94.bin even Music95: incbin sound\music95.bin even Music96: incbin sound\music96.bin even Music97: incbin sound\music97.bin even Music98: incbin sound\music98.bin even Music99: incbin sound\music99.bin even Music9A: incbin sound\music9A.bin even Music9B: incbin sound\music9B.bin even Music9C: incbin sound\music9C.bin even Music9D: incbin sound\music9D.bin even Music9E: incbin sound\music9E.bin even Music9F: incbin sound\music9F.bin even </asm>

One last thing to note is that song 9F won't play unless one more change is made.

<asm>LevSel_NoCheat:

       cmpi.w    #$94,d0    ; is sound $80-$94 being played?
       bcs.s    LevSel_PlaySnd; if yes, branch
       cmpi.w    #$A0,d0    ; is sound $95-$A0 being played?
       bcs.s    LevelSelect; if yes, branch</asm>

Change the line: <asm> bcs.s LevSel_PlaySnd; if yes, branch</asm> So it reads: <asm> ble.s LevSel_PlaySnd; if yes, branch</asm>

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 | Fix a remember sprite related bug
Changing Design Choices
Change Spike Behavior | Collide with Water After Being Hurt | 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 | Add Super Sonic | Add the Air Roll
Sound Features
Expand the Sound Index | Play Different Songs Per Act | Port Sonic 2 Final Sound Driver | Port Sonic 3's Sound Driver | Port Flamewing's Sonic 3 & Knuckles Sound Driver | Change The SEGA Sound
Extending the Game
Load Chunks From ROM | Add Extra Characters | Make an Alternative Title Screen | Use Dynamic Tilesets | Make GHZ Load Alternate Art | Make Ending 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 | Use Dynamic Palettes
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)