Sonic 1 "Mega PCM" driver

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

  1. vexatious

    vexatious

    Misfit
    44
    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. Alex Field

    Alex Field

    シュート! カオス・エメラルド・ザが消えようとしている! Member
    112
    64
    28
    Downunda, Mobius
    Sonic the Hedgehog 2+, Sonic the Hedgehog 3+
    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.
     
  3. Rrose80149

    Rrose80149

    Member
    51
    3
    8
    A problem with the Hivebrain Mega PCM. I was testing it in Sonic 1 but when getting a 1-Up in a Special Stage the FM 6 instrument went missing.
     
    Last edited: Apr 11, 2021
  4. Inferno

    Inferno

    Member
    28
    48
    13
    Sonic 1 Definitive
    That's not an issue with MegaPCM, that's a vanilla S1 sounddriver issue. (One of many)

    Which already has a wiki guide for fixing it, btw.
     
    Last edited: Apr 13, 2021