Sonic 1 "Mega PCM" driver

Discussion in 'Engineering & Reverse Engineering' started by vladikcomper, Jun 11, 2012.

  1. vexatious

    vexatious

    Member
    34
    2
    8
    Hi MarkeyJester. I'm interested in using the core yamaha (including other hardware) in ways not imposed by Sega's SDKs (assuming they're real). E.g. the core yamaha can't play samplerates above 16khz according to Sega sdks, but if I can buffer two 8-bit channels at 22050khz each (or 44100khz stereo) then I can get some more flexibility from the yamaha. I'm guessing this MegaPCM has coincidence with my curiosity...

    I'm also looking for any genuine documents and/or datasheets for the core yamaha unrelated to Sega. Same request for other hardware in MarsCD.
     
  2. Advanced?

    Advanced?

    Member
    29
    1
    3
    Sonic 1 Hack
    I made an optimized version of "sub_7272E" and "sub_72764".

    Firstly though, at the waitYM macro, change it to this:
    Code (Text):
    1. waitYM macro
    2. @wait\@
    3.     btst    #7,(a0)
    4.     bne.s    @wait\@
    5.     endm
    Then at "sub_7272E", change all the code upto (but not including) "word_72790".
    Code (Text):
    1. sub_7272E:                ; XREF: loc_71E6
    2.         stopZ80
    3.         lea    ($A04000).l,a0
    4.         waitYM
    5.         move.b    d0,(a0)
    6.         waitYM
    7.         move.b    d1,1(a0)
    8.         move.b    #$2A,(a0)
    9.         startZ80
    10.         rts
    11. ; End of function sub_7272E
    12.  
    13. ; ===========================================================================
    14.  
    15. loc_7275A:                ; XREF: sub_72722
    16.         move.b    1(a5),d2
    17.         bclr    #2,d2
    18.         add.b    d2,d0
    19.  
    20. ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    21.  
    22.  
    23. sub_72764:                ; XREF: loc_71E6A; Sound_ChkValue; sub_7256A; sub_72764
    24.         stopZ80
    25.         lea    ($A04000).l,a0
    26.         waitYM
    27.         move.b    d0,2(a0)
    28.         waitYM
    29.         move.b    d1,3(a0)
    30.         move.b    #$2A,(a0)
    31.         startZ80
    32.         rts
    33.  
    34. ; End of function sub_72764
    If you're going to reuse an address, it's faster to set it to a0. Also, because the address was set, the bottom waitYMs were no longer needed.

    Also, I not sure but the "nops" in the stopZ80 macro don't seem to be necessary (as far as I know); so remove them.