Sonic 3 sound driver in Sonic 1

Discussion in 'Tutorials Archive' started by Tornado, Jan 5, 2009.

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

    Tornado Active Member Member

    Joined:
    Dec 1, 2008
    Messages:
    30
    Location:
    Hydrocity - Angel Island
    Sonic 3 sound driver in Sonic 1


    Following this tutorial will allow you to have the music, effects and samples of Sonic 3 in Sonic 1.


    Required Files:


    - Sonic 3 driver


    Download


    Part 1


    1. Go to "SoundDriverLoad" and replace:




    SoundDriverLoad: ; XREF: GameClrRAM; TitleScreen


    nop


    move.w #$100,($A11100).l; stop the Z80


    move.w #$100,($A11200).l; reset the Z80


    lea (Kos_Z80).l,a0; load sound driver


    lea ($A00000).l,a1


    bsr.w KosDec; decompress


    move.w #0,($A11200).l


    nop


    nop


    nop


    nop


    move.w #$100,($A11200).l; reset the Z80


    move.w #0,($A11100).l; start the Z80


    rts


    ; End of function SoundDriverLoad



    To




    SoundDriverLoad: ; XREF: GameClrRAM; TitleScreen


    nop


    jmp Sound_Driver


    rts


    ; End of function SoundDriverLoad



    2. Go to "PlaySound":




    PlaySound:


    move.b d0,($FFFFF00A).w


    rts


    ; End of function PlaySound



    And replace it with this..




    PlaySound:


    nop


    jmp Play_Music_new


    rts


    ; End of function PlaySound



    3. Now find PlaySound_Special:




    PlaySound_Special:


    move.b d0,($FFFFF00B).w


    rts


    ; End of function PlaySound_Special



    Replace it with this:




    PlaySound_Special:


    nop


    jmp Play_Sfx_new


    rts


    ; End of function PlaySound_Special



    4. Go to "pausegame":




    PauseGame: ; XREF: Level_MainLoop; et al


    nop


    tst.b ($FFFFFE12).w; do you have any lives left?


    beq.s Unpause ; if not, branch


    tst.w ($FFFFF63A).w; is game already paused?


    bne.s loc_13BE; if yes, branch


    btst #7,($FFFFF605).w; is Start button pressed?


    beq.s Pause_DoNothing; if not, branch


    loc_13BE:


    move.w #1,($FFFFF63A).w; freeze time


    move.b #1,($FFFFF003).w; pause music


    loc_13CA:


    move.b #$10,($FFFFF62A).w


    bsr.w DelayProgram


    tst.b ($FFFFFFE1).w; is slow-motion cheat on?


    beq.s Pause_ChkStart; if not, branch


    btst #6,($FFFFF605).w; is button A pressed?


    beq.s Pause_ChkBC; if not, branch


    move.b #4,($FFFFF600).w; set game mode to 4 (title screen)


    nop


    bra.s loc_1404


    ; ===========================================================================


    Pause_ChkBC: ; XREF: PauseGame


    btst #4,($FFFFF604).w; is button B pressed?


    bne.s Pause_SlowMo; if yes, branch


    btst #5,($FFFFF605).w; is button C pressed?


    bne.s Pause_SlowMo; if yes, branch


    Pause_ChkStart: ; XREF: PauseGame


    btst #7,($FFFFF605).w; is Start button pressed?


    beq.s loc_13CA; if not, branch


    loc_1404: ; XREF: PauseGame


    move.b #$80,($FFFFF003).w


    Unpause: ; XREF: PauseGame


    move.w #0,($FFFFF63A).w; unpause the game


    Pause_DoNothing: ; XREF: PauseGame


    rts


    ; ===========================================================================


    Pause_SlowMo: ; XREF: PauseGame


    move.w #1,($FFFFF63A).w


    move.b #$80,($FFFFF003).w


    rts


    ; End of function PauseGame



    Replace it with this




    PauseGame: ; XREF: Level_MainLoop; et al


    nop


    jmp Pause_New


    rts



    5. Add this to the end of the ROM:




    include 's3driver.asm'



    Put the the driver that you downloaded with your disassembly.


    6. Go to sub_71B4C:




    sub_71B4C: ; XREF: loc_B10; PalToCRAM


    move.w #$100,($A11100).l; stop the Z80


    nop


    nop


    nop



    Disable the function with a rts




    sub_71B4C: ; XREF: loc_B10; PalToCRAM


    rts



    Part 2: Fixing the Playlist


    1. Open in hex editor the file muslist1.bin



    Code:
    8182838485868D00


    As you can see, it is in a simple format, showing the order as track 81, 82, 83, etc. Simply replace this with the music of your choice such as this:





    Code:
    0103130C070A etc.

    Part 3: Fixing the sound effects


    Coming soon.


    Post your questions.


    Total credits Esrael by the driver and for helping me to correct errors :(


    [Edited by Qjimbo]
     
    Last edited by a moderator: Jan 31, 2009
  2. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,445
    Location:
    Northern Germany
    Where is the S3 Sound Driver? I can't find the downloadlink in your link!
     
  3. SonicVaan

    SonicVaan I'm a cyberpunk with a taste for guns Member

    Joined:
    Sep 12, 2008
    Messages:
    456
    Location:
    Germany, Cologne
    Open your eyes.
     
  4. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,445
    Location:
    Northern Germany
    1. There is no "s3driver.asm".

    2. Where should I put the "include 's3driver.asm'"?



    And:

    Oh... :(
     
  5. SonicVaan

    SonicVaan I'm a cyberpunk with a taste for guns Member

    Joined:
    Sep 12, 2008
    Messages:
    456
    Location:
    Germany, Cologne
    Open your eyes, again:

     
  6. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,445
    Location:
    Northern Germany
    WHERE is this?
     
  7. SonicVaan

    SonicVaan I'm a cyberpunk with a taste for guns Member

    Joined:
    Sep 12, 2008
    Messages:
    456
    Location:
    Germany, Cologne
    It's very down of the sonic1.asm file, where much files are included. (Sound, music, ...)
     
  8. Tornado

    Tornado Active Member Member

    Joined:
    Dec 1, 2008
    Messages:
    30
    Location:
    Hydrocity - Angel Island
    when you download, you will see a folder with the name of s_driver, there is what you are looking for
     
    Last edited by a moderator: Jan 31, 2009
  9. Infiniti

    Infiniti Newcomer Trialist

    Joined:
    Jan 31, 2009
    Messages:
    4
    Sorry if this is a bump, but I was trying this out and was hoping for a little bit more information.


    I managed to get up to:


    5. Add this to the end of the ROM


    and added



    Code:
    include 's3driver.asm'
    BEFORE



    Code:
    ; end of 'ROM'
    
    EndOfRom:


    Now this is where you have to explain it in a bit more detail...



    Because, If followed word for word, your guide tells us to put ONLY the s3driver.asm file in the same folder as the Sonic1.asm, Build.bat etc...(if thats right?) then moves on to:



    6. Go to sub_71B4C:



    Code:
    sub_71B4C:		&#59; XREF: loc_B10; PalToCRAM
    
    		move.w	#$100,($A11100).l; stop the Z80
    
    		nop	
    
    		nop	
    
    		nop


    Disable the function with a rts





    Code:
    sub_71B4C:		&#59; XREF: loc_B10; PalToCRAM
    
    		rts

    and mentions nothing about the other files in the s_driver folder...


    I can't see anything wrong with what I've done so-far. But any input from you at this stage would be very helpful.
     
  10. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    Not bad. B)


    It is working fine for me. Thanks!
     
  11. PsychoSk8r

    PsychoSk8r HighKnights Member

    Joined:
    Aug 9, 2007
    Messages:
    271
    Location:
    Birmingham, UK
    When should we expect part 3?


    I've just tested what you have, and it's like S1 on drugs =P


    I'm getting random sound effects everywhere, which I guess part 3 shall cover. =P
     
  12. Tornado

    Tornado Active Member Member

    Joined:
    Dec 1, 2008
    Messages:
    30
    Location:
    Hydrocity - Angel Island

    Part 3, only to change the sound effects that play out of place, I am now preparing a code with it solved. pulp work. :downs:
     
  13. PsychoSk8r

    PsychoSk8r HighKnights Member

    Joined:
    Aug 9, 2007
    Messages:
    271
    Location:
    Birmingham, UK
    Great, I look forward to it. =P
     
  14. Spanner

    Spanner The Tool Member

    Joined:
    Aug 9, 2007
    Messages:
    2,569
    Probably off-topic, however to make matters easier you could use variables for the sound playing. Then you can just change the sound ID easily by changing a simple ID. For example:



    audio $8C



    Would become:



    audio Music_Boss



    And if you wanted to change the music:



    Music_Boss = $8C ; change the $** to another music ID



    Yes I used the SVN disassembly as an example, don't moan. D: This system would be easier to work with.
     
    Last edited by a moderator: Feb 5, 2009
  15. PsychoSk8r

    PsychoSk8r HighKnights Member

    Joined:
    Aug 9, 2007
    Messages:
    271
    Location:
    Birmingham, UK
    That's not too bad an Idea , SOTI. I may use your idea in the s3driver.asm, see how it works out, when this guide is finished ofcourse. =P
     
  16. Tweaker

    Tweaker OI! MIRON! Member

    Joined:
    Aug 10, 2007
    Messages:
    324
    A lot of people like using macros and equates and such, but I always found that just putting the literal values in there as-is worked best for me. Maybe it's just because I'm accustomed to them, but it just feels more... well, comfortable.


    Take that how you will, I guess.
     
    Last edited by a moderator: Feb 6, 2009
  17. PsychoSk8r

    PsychoSk8r HighKnights Member

    Joined:
    Aug 9, 2007
    Messages:
    271
    Location:
    Birmingham, UK
    Plus, putting the literal values usually mean less keypresses too. :v:
     
  18. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    Me too. Equates? In my disasm? No thanks.
     
  19. Spanner

    Spanner The Tool Member

    Joined:
    Aug 9, 2007
    Messages:
    2,569
    I was only saying that because it would be a quick solution if this driver was used. Other than that, the current setup is fine.
     
  20. Alriightyman

    Alriightyman I'm back! Member

    Joined:
    Oct 3, 2007
    Messages:
    156
    Location:
    USA
    Actually, I did this for my hack. Mostly because I was going back and forth between Sonic 3, Sonic 2 and Sonic 1's sound driver to figure out wich one I liked. Sonic 3's has a lot of issues that annoyed me (fading wasn't working unless you were using voices from the Universal sound bank. Timing in Ports was wierd.) Although, I don't know how to fix such a thing with music. So I went back to the Sonic 2 sound driver, and edited it a little.
     
Thread Status:
Not open for further replies.