Correcting Sonic 1 PAL Music Tempo

Discussion in 'Approved' started by Crash, Feb 9, 2012.

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

    Crash Well-Known Member Member

    Joined:
    Jul 15, 2010
    Messages:
    302
    Location:
    Australia
    This is a fix for a problem that not that many people are going to experience; I have a flash cart and a PAL console and it annoys the shit out of me that the music is slow. (Actually, the whole game is slower, but whatever)


    What this does is run the sound driver a second time every 5th frame, increasing the tempo to match the NSTC tempo.


    First we need to find a free byte in ram to keep count of how many times the sound driver has been run.




    v_palmuscounter = $FFFFFFBF ; counts up to 5 then runs UpdateMusic twice



    this is where I put it in my hack.


    In the latest SVN disassembly:


    Find this in s1.sounddriver.asm:




    DoStartZ80:


    startZ80


    rts



    and change it to this:




    DoStartZ80:


    startZ80


    btst #6,(v_megadrive).w ; is Megadrive PAL?


    beq.s @end ; if not, branch


    cmpi.b #$5,(v_palmuscounter).w ; 5th frame?


    bne.s @end ; if not, branch


    move.b #$0,(v_palmuscounter).w ; reset counter


    bra.w UpdateMusic ; run sound driver again


    @end:


    addq.b #$1,(v_palmuscounter).w ; add 1 to frame count


    rts



    For older disassamblies:


    Find in sonic1.asm




    loc_71C44:


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


    rts



    and change it to this:




    loc_71C44:


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


    btst #6,($FFFFFFF8).w ; is Megadrive PAL?


    beq.s @end ; if not, branch


    cmpi.b #$5,(v_palmuscounter).w ; 5th frame?


    bne.s @end ; if not, branch


    move.b #$0,(v_palmuscounter).w ; reset counter


    bra.w sub_71B4C ; run sound driver again


    @end:


    addq.b #$1,(v_palmuscounter).w ; add 1 to frame count


    rts



    (Can somebody tell me if this last part is right? I don't actually use the old disassemblies)
     
    Last edited by a moderator: Feb 9, 2012
  2. Psycho RFG

    Psycho RFG Well-Known Member Member

    Joined:
    Feb 22, 2011
    Messages:
    229
    Good to see you found another way to fix this. I'm going to test it right now, thanks for sharing!

    Yeah, the code is right for the old disassembly too.
     
  3. Psycho RFG

    Psycho RFG Well-Known Member Member

    Joined:
    Feb 22, 2011
    Messages:
    229
    Sorry for doubel posting but I have to say, after test it, that now it works fine. Thanks for made this 2nd version of the fix :p


    Now we can play with good music in our PAL MegaDrives too.
     
  4. TheJeli

    TheJeli Umm... Member

    Joined:
    Jun 20, 2011
    Messages:
    245
    Location:
    West London
    I seem to get this:


    [​IMG]
     
  5. Crash

    Crash Well-Known Member Member

    Joined:
    Jul 15, 2010
    Messages:
    302
    Location:
    Australia
    loc_1DFA is a label in the palette fade in routine... I'm pretty sure it's something else you've done that is causing that.
     
  6. TheJeli

    TheJeli Umm... Member

    Joined:
    Jun 20, 2011
    Messages:
    245
    Location:
    West London
    To be honest I'm not 100% sure it was a clean disassembly. Ill try again with a clean one.
     
    Last edited by a moderator: Feb 11, 2012
  7. Psycho RFG

    Psycho RFG Well-Known Member Member

    Joined:
    Feb 22, 2011
    Messages:
    229
    I fully tested the code and it's working at 100%, although I modified it a little to optimize. Even tested in a real MegaDrive withe great results. I'm using an older Hiberbrain's disassembly.
     
    Last edited by a moderator: Feb 11, 2012
Thread Status:
Not open for further replies.