don't click here

How to extend Music Slots in Sonic 1

Discussion in 'Engineering & Reverse Engineering' started by Mikel, Oct 6, 2008.

Thread Status:
Not open for further replies.
  1. Mikel

    Mikel

    Member
    Well, you remember the guide I posted in GasparXR's help topic, right?

    I'm going to post a modified version of my music extending guide here.

    To start go to Sound_ChkValue, if you see this line:

    Code (ASM):
    1.         cmpi.b  #$E4,d7
    2.         bls.s   Sound_E0toE4
    Add this under Sound_E0toE4:

    Code (ASM):
    1.         cmpi.b  #$FF,d7
    2.         bls.w   Sound_E5toFF
    Then, go to Sound_81to9F, and add this above Sound_81to9F:

    Code (ASM):
    1. Sound_E5toFF:
    2.         jsr sub_725CA(pc)
    3.         movea.l (off_719A0).l,a4
    4.         subi.b  #$E5,d7
    5.         move.b  (a4,d7.w),$29(a6)
    6.         movea.l (Go_MusicIndex_E5toFF).l,a4
    7.                   jmp Music_Continue
    Then go to loc_7202C, and change it to:

    Code (ASM):
    1.  
    2. loc_7202C:
    3.         jsr sub_725CA(pc)
    4.         movea.l (off_719A0).l,a4
    5.         subi.b  #$81,d7
    6.         move.b  (a4,d7.w),$29(a6)
    7.         movea.l (Go_MusicIndex).l,a4
    8. Music_Continue:
    9.         lsl.w   #2,d7
    10.         movea.l (a4,d7.w),a4
    11.         moveq   #0,d0
    12.         move.w  (a4),d0
    13.         add.l   a4,d0
    14.         move.l  d0,$18(a6)
    15.         move.b  5(a4),d0
    16.         move.b  d0,$28(a6)
    17.         tst.b   $2A(a6)
    18.         beq.s   loc_72068
    19.         move.b  $29(a6),d0
    Then, change:

    Code (ASM):
    1.  
    2. Go_SoundTypes:  dc.l SoundTypes     ; XREF: Sound_Play
    3. Go_SoundD0: dc.l SoundD0Index   ; XREF: Sound_D0toDF
    4. Go_MusicIndex:  dc.l MusicIndex     ; XREF: Sound_81to9F
    5. Go_SoundIndex:  dc.l SoundIndex     ; XREF: Sound_A0toCF
    6. off_719A0:  dc.l byte_71A94     ; XREF: Sound_81to9F
    7. Go_PSGIndex:    dc.l PSG_Index      ; XREF: sub_72926
    To:

    Code (ASM):
    1.         align $10
    2. Go_SoundTypes:  dc.l SoundTypes     ; XREF: Sound_Play
    3. Go_SoundD0: dc.l SoundD0Index   ; XREF: Sound_D0toDF
    4. Go_MusicIndex:  dc.l MusicIndex     ; XREF: Sound_81to9F
    5. Go_MusicIndex_E5toFF:   dc.l MusicIndex_E5plus      ; XREF: Sound_81to9F
    6. Go_SoundIndex:  dc.l SoundIndex     ; XREF: Sound_A0toCF
    7. off_719A0:  dc.l byte_71A94     ; XREF: Sound_81to9F
    8. Go_PSGIndex:    dc.l PSG_Index      ; XREF: sub_72926
    Then, go to:

    Code (ASM):
    1. Music9F:    incbin  sound\music9F.bin
    2.         even
    And add the following lines under the line I posted above:

    Code (ASM):
    1. MusicIndex_E5plus: 
    2.                                 dc.l MusicE5, MusicE6
    3.         dc.l MusicE7, MusicE8
    4.         dc.l MusicE9, MusicEA
    5.         dc.l MusicEB, MusicEC
    6.         dc.l MusicED, MusicEE
    7.         dc.l MusicEF, MusicF0
    8.         dc.l MusicF1, MusicF2
    9.         dc.l MusicF3, MusicF4
    10.                                 dc.l MusicF5, MusicF6
    11.         dc.l MusicF7, MusicF8
    12.         dc.l MusicF9, MusicFA
    13.         dc.l MusicFB, MusicFC
    14.         dc.l MusicFD, MusicFE
    15.         dc.l MusicFF
    Then, under MusicIndex_E5toFF, add these lines:

    Code (ASM):
    1. MusicE5:    incbin  sound\musicE5.bin
    2.         even
    3. MusicE6:    incbin  sound\musicE6.bin
    4.         even
    5. MusicE7:    incbin  sound\musicE7.bin
    6.         even
    7. MusicE8:    incbin  sound\musicE8.bin
    8.         even
    9. MusicE9:    incbin  sound\musicE9.bin
    10.         even
    11. MusicEA:    incbin  sound\musicEA.bin
    12.         even
    13. MusicEB:    incbin  sound\musicEB.bin
    14.         even
    15. MusicEC:    incbin  sound\musicEC.bin
    16.         even
    17. MusicED:    incbin  sound\musicED.bin
    18.         even
    19. MusicEE:    incbin  sound\musicEE.bin
    20.         even
    21. MusicEF:    incbin  sound\musicEF.bin
    22.         even
    23. MusicF0:    incbin  sound\musicF0.bin
    24.         even
    25. MusicF1:    incbin  sound\musicF1.bin
    26.         even
    27. MusicF2:    incbin  sound\musicF2.bin
    28.         even
    29. MusicF3:    incbin  sound\musicF3.bin
    30.         even
    31. MusicF4:    incbin  sound\musicF4.bin
    32.         even
    33. MusicF5:    incbin  sound\musicF5.bin
    34.         even
    35. MusicF6:    incbin  sound\musicF6.bin
    36.         even
    37. MusicF7:    incbin  sound\musicF7.bin
    38.         even
    39. MusicF8:    incbin  sound\musicF8.bin
    40.         even
    41. MusicF9:    incbin  sound\musicF9.bin
    42.         even
    43. MusicFA:    incbin  sound\musicFA.bin
    44.         even
    45. MusicFB:    incbin  sound\musicFB.bin
    46.         even
    47. MusicFC:    incbin  sound\musicFC.bin
    48.         even
    49. MusicFD:    incbin  sound\musicFD.bin
    50.         even
    51. MusicFE:    incbin  sound\musicFE.bin
    52.         even
    53. MusicFF:    incbin  sound\musicFF.bin
    54.         even
    Next, we are going to extend the slots in the Sound Test, first go to LevSel_SndTest, and change:

    Code (ASM):
    1.         moveq   #$4F,d0     ; if sound test moves below 0, set to $4F
    To:

    Code (ASM):
    1.         moveq   #$7F,d0     ; if sound test moves below 0, set to $7F
    Then, go to LevSel_Right, and change:

    Code (ASM):
    1.         cmpi.w  #$50,d0
    To:

    Code (ASM):
    1.         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:

    Code (ASM):
    1.         cmpi.w  #$9F,d0     ; is sound $80-$9F being played?
    2.         ble.s   LevSel_PlaySnd  ; if yes, branch
    To:

    Code (ASM):
    1.         cmpi.w  #$FF,d0     ; is sound $E5-$FF being played?
    2.         ble.s   LevSel_PlaySnd  ; if yes, branch
    Then, build the rom and check out your newly added tunes.

    That's all, if you have any questions on Sound Test expansion, PM me, or post here.
     
  2. PsychoSk8r

    PsychoSk8r

    PsychedelAnt | Tone Turner Oldbie
    2,641
    57
    28
    Birmingham, UK
    30 Day Project: Revisited.A New Release!
    That right there is just what I need. Awesome. I very much appreciate this.
    Also, Good to see you're using my generator in your sig =P
     
  3. Master3k

    Master3k

    Member
    278
    0
    0
    Great! I see that you covered things that you didn't before (such as the Music_Continue routine which was non-existant on the older code). Might use this someday...

    EDIT:Double-written a word
     
  4. Spanner

    Spanner

    The Tool Member
    Nice work. This definately allows plenty of other stuff that could be used such as seperate certain tunes if you've added a second character.
    Maybe you could try getting 01 to FF to work, I've been trying to do that in Sonic 2 but to no avail.
     
  5. Eduardo Knuckles

    Eduardo Knuckles

    Not a loved one, but the most hated person. Banned
    414
    10
    18
    Someplace somewhere
    Project S.A.M.G.
    Wow, now it works. Thank you so much, man
     
  6. GasparXR

    GasparXR

    I'm back! Member
    I remember the one you posted in my topic didn't even work right. =P Once I get home I'm trying this, it looks good.
     
  7. GasparXR

    GasparXR

    I'm back! Member
    Double post >.< Since I don't have any tracks 95-9F or E6-FF, I only added 94 and E5 to whichever loading routine they belong to(pardon the vocabulary I'm using). Now when I loaded them in MusicIndex & MusicIndexE5plus(as well as incbinning them) 94 will play in the soundtest, but E5 won't. Ingame, If I set the speedshoes music to E5 it treats it as if it's silence; the zone music still plays. When it's supposed to return to zone music, it just restarts the zone music.

    Strangely enough, it's able to build with no errors. =\ Any ideas?
     
  8. Hayate

    Hayate

    Tech Member
    I did this for Project Nanako (for various reasons, neither 00 nor 80 can be used). I might sometime write up a topic on how to do it.
     
  9. roxahris

    roxahris

    Everyone's a hypocrite. Take my word for it. Member
    1,224
    0
    0
    Doing anything at all
    Please, please do, it would be awesome...
     
  10. Spanner

    Spanner

    The Tool Member
    Sorry, I meant 7F not FF. Just saying.
     
  11. roxahris

    roxahris

    Everyone's a hypocrite. Take my word for it. Member
    1,224
    0
    0
    Doing anything at all
    What's the difference? :)
     
  12. Eduardo Knuckles

    Eduardo Knuckles

    Not a loved one, but the most hated person. Banned
    414
    10
    18
    Someplace somewhere
    Project S.A.M.G.
    A lot. FF is the end of music index (sure after having done the tutorial), 80 is the Begin of it...
    Do not forget that we have the sound effects soon after the first songs. So, starting at E5 is being another music index.
    (I think)
     
  13. roxahris

    roxahris

    Everyone's a hypocrite. Take my word for it. Member
    1,224
    0
    0
    Doing anything at all
    I meant in terms of making music below 80 work. I already know about 80-FF. There's just little difference between 7F and FF except FF is the absolute end of the music slots, and 7F is just the end of the ones before 80 (like 81 are the ones after 80).

    Besides, I'm talking about Sonic 2, which already has music from 81-FF. Why do you think going below 80 would be needed in Sonic 1? Well, unless you needed a large amount of music and sound effects...
     
  14. nineko

    nineko

    I am the Holy Cat Tech Member
    6,298
    475
    63
    italy
    In Sonic 1, 81-9F + E5-FF gives you 58 slots, and I used them all in soniNeko. Which is why I recently edited the code to allow for 14848 song slots :D
     
  15. Alriightyman

    Alriightyman

    I am back... from the dead! Tech Member
    357
    11
    18
    Somewhere in hot, death Florida
    0101001101101111011011100110100101100011 00000010: 0101001100000011 01000101011001000110100101110100011010010110111101101110
    HOLY SHIT! How the hell? That's awesome! :)
     
  16. Overlord

    Overlord

    Now playable in Smash Bros Ultimate Moderator
    19,218
    965
    93
    Long-term happiness
    14848 / 58 = 256 - I'm assuming there's a second byte involved =P
     
Thread Status:
Not open for further replies.