don't click here

SMPS z80 driver + SMPS Converter

Discussion in 'Technical Discussion' started by Smoke, Oct 11, 2011.

  1. Smoke

    Smoke

    Member
    8
    0
    0
    Russia
    Hi, guys! Some time ago I wrote small SMPS converter that converts music files between SMPS 68k to SMPS z80 and vice versa. A general purpose was to convert songs from S1 SMPS format to SMPS z80. Also, I ripped SMPS z80 driver from Sonic 3D Blast and gave to it more readable view, so you can freely put it to the other games. I think SMPS z80 is way more handy driver because of m68k is free of playing music. All this work lies on z80.



    Links:

    Converter

    Driver



    Sorry, I'm from Russia and site is on Russian language. Just click on "Скачать с сервера" link alongside with size value (672.6Kb for example). Readme files and manual are inside archives on English. Hope you enjoy this. Thanks.

    [​IMG] [​IMG]

    The instruction manuals you can find in archives.
    Putting songs in the driver and adding driver to your own source file (romhack for example):
    Usage of the converter:
     
  2. nineko

    nineko

    I am the Holy Cat Tech Member
    6,296
    475
    63
    italy
    YES!!! I'm so happy to see that finally someone else wants to do it right... Most people around here have the bad habit to use the Sonic 1 driver in Sonic 2 :(
     
  3. flamewing

    flamewing

    Emerald Hunter Tech Member
    1,161
    65
    28
    France
    Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
    That is weird; I am also making a modified driver based off the S&K one (which is essentially identical to 3D Blasts'), but I am putting songs in an ASM format derived from Cinossu's S1SMPS2ASM.

    Hrm. Both links go to the same page; and the download does not include the driver.

    Edit: And I agree with Nineko, I don't know why people like to use the S1 driver, or S2 clone driver for that matter.
     
  4. Smoke

    Smoke

    Member
    8
    0
    0
    Russia
    Oops, sorry. I edited 1st post. Now you can download it =)
    Converter

    Driver
     
  5. Sik

    Sik

    Sik is pronounced as "seek", not as "sick". Tech Member
    6,718
    1
    0
    being an asshole =P
    Sorry, but
    it's 32768 not 8000 :v: (missing the hex indicator makes a serious difference =P)
     
  6. flamewing

    flamewing

    Emerald Hunter Tech Member
    1,161
    65
    28
    France
    Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
    I have a few questions regarding your converter. What exactly does it do on conversion? It obviously converts pointers and rebases songs; does it do anything else (such as converting coordination flags)? Also, does it correctly convert/rebase all pointers in coordination flags (see previous link, plus the S3+ section just after)?

    General rant: Yeah, I was right: people do suffer because of their insistence on not using the SVN disassemblies. For some time now, there has been complete disassemblies of the S&K and S3D drivers on SVN that assemble correctly; the SVN S&K driver even has an optional collection of bug fixes. /rant
     
  7. Smoke

    Smoke

    Member
    8
    0
    0
    Russia
    It converts pointers in the header, pointers in coordination flags (jump, call and loop) and specially for S1 68k to z80 it changes coordination flags ($E3>$F9, $E9>$FB and terminates $F9 because in S1 it used not for rts). In standart 68k t0 z80 converting it converts just pointers in header and coordination flags and also terminates $E9 and $EB because in SMPS z80 I didn't find equal flags.
    Yes. All pointers are converted correctly=)
     
  8. flamewing

    flamewing

    Emerald Hunter Tech Member
    1,161
    65
    28
    France
    Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
    Yeah... sorry to say but mine will be better :-p You just beat me to release by a few days as I put on finishing touches.

    FYI, it converts almost all coordination flags (the sole exceptions being S1's $ED [not converted] and $EE [only partially converted], both of which can be done better another way), converts PSG notes to include a 12 semi-tone shift when converting to/from S3+ driver, converts FM voices to have bit 7 of TL set when appropriate for S&K driver, among a few other things. For any song (and almost all SFX) from S1 or S2, I can literally put the same file in S2 or S&K drivers and it will work.
     
  9. Smoke

    Smoke

    Member
    8
    0
    0
    Russia
    Well It is good news also! Is it converts correctly songs from other SMPS68k games (not Sonic1)? Because I tried to convert Idaten song from Shinobi 3 and wind up on a voices data. Here is the original file
     
  10. amphobius

    amphobius

    doing more important things with my life Member
    2,120
    0
    16
    life
    My reason is that it's easier to use, as well as sample quality. I can't help but notice that any game that uses an SMPS Z80 driver has a very large hit on PCM quality, whereas in the Sonic 1 driver it is much more clear and clean.
     
  11. flamewing

    flamewing

    Emerald Hunter Tech Member
    1,161
    65
    28
    France
    Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
    For now, it only converts the Sonic games (S1/S2/S3/S&K/S3D) as these are the only sound drivers I have fully disassembled and analyzed (technically, I also analyzed Ristar and Outrunners to the same level of detail, but the multiple DAC tracks these drivers have make matters difficult).

    The main requirements for supporting a sound driver are: PSG tones; frequency flutter (if any; S3+ have); DAC samples (they need to be converted; DAC samples from S2/S3/S&K/S3D are interchangeable as the main DAC playback loop takes [286+26*pitch] cycles in all of those drivers, but this isn't guaranteed to be true for all drivers); FM and PSG frequency tables (for example, S3/S&K/S3D have 12 PSG frequencies (an octave) more than S1/S2, and it occurs before the values it shares with those drivers); common voice banks, if any; detailed knowledge of the coordination flag.

    As the number of sound drivers disassembled increase, so will the number of supported drivers in my tool. I do have plans to disassemble several more; I will probably start with the z80 drivers first, as they are easier to locate -- just dump z80 RAM. But other than that, I don't have any preference as to which game I wish to look at first.
     
  12. Andlabs

    Andlabs

    「いっきまーす」 Wiki Sysop
    2,175
    1
    0
    Writing my own MD/Genesis sound driver :D
    @DalekSam - That's a problem with many Z80-only sound drivers: in SMPS's case, it does PCM processing between frames (which is when song/SFX processing is done). and its use of DPCM instead of regular LPCM makes it slower due to delta processing. GEMS sprinkles calls to the PCM processor every several lines of code and uses raw PCM, so it's going to have somewhat faster PCM. As long as you have to do other things on the Z80, the highest quality you're going to get is dependent on how much time you give to the PCM playback system. 68000-side sound drivers that dedicate the Z80 to PCM playback will have the most time, but there might be other problems with that setup.
     
  13. I did see some horrific SMPS into non-sonic-environment stuff lately, but this is actually pretty damn good.

    Nice to see some people actually do take the time to grasp the system they're working with :)

    Well done!

    By the way ! It occurs to me in that screenshot that you write FM Channels = 6 and PSG channels = 3. Are you sure you are reading the header right? $0603 does not equal 6 FM, 3 PSG, but rather 5FM, 2PSG, 1PCM and 1Noise :) I don't have the specific calculation at hand, but nineko should be able to explain how to get the real channel number.

    Cheers!
    Oerg866

    @Andlabs: yeah GEMS fails at everything else though :P
     
  14. flamewing

    flamewing

    Emerald Hunter Tech Member
    1,161
    65
    28
    France
    Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
    $0603 is 5 FM, 1 PCM/DAC and 3 PSG channels. The third PSG channel may or may not be a noise channel -- and, in fact, there are many cases in which it is not.
     
  15. Dang, yes, 3 PSG... I was thinking $0604.... I haven't done SMPS stuff in a looong time now, because what I work with now is so much better to deal with format-wise
     
  16. Andlabs

    Andlabs

    「いっきまーす」 Wiki Sysop
    2,175
    1
    0
    Writing my own MD/Genesis sound driver :D
    I still wonder why they treat the SN76489 more like an AY-3-8910 with the MD SMPS... testing computers using YM2608 (I think it's the "86 Sound Board" for PC-98)?
     
  17. nineko

    nineko

    I am the Holy Cat Tech Member
    6,296
    475
    63
    italy
    If you're referring to the fact that you can't use the 4 PSG channels at the same time, it's been explained several times that there are only 3 available frequencies on the noise channel if you're using the 3 melodic channels at the same time, but there are 1023 available frequencies on the noise channel if you're using only 2 melodic channels at the same time. SMPS is limited by design choice, not by hardware, in fact Puto even managed to hack a custom version of SMPS with support for $0604 songs, and there are other drivers (such as Cube) that support "$0604" songs natively. In those "unlimited" drivers it's up to the composer to decide how to use the channels, dynamically switching between 3+0, 3+1, and 2+1 on the fly simply by using or not using the relevant channels. With SMPS this doesn't happen because it already enforces this limit for you.
     
  18. Andlabs

    Andlabs

    「いっきまーす」 Wiki Sysop
    2,175
    1
    0
    Writing my own MD/Genesis sound driver :D
    That doesn't make much sense because Master System SMS isn't so hindered and because both PC-88 and PC-98 (which had the AY-3-8910 clone YM2149 chip cores in their FM expansions, and both are known to have been used by Sega for development)... There's probably some historical thing related to the earliest MD sound drivers but I'd have to check later.
     
  19. nineko

    nineko

    I am the Holy Cat Tech Member
    6,296
    475
    63
    italy
    Don't forget that the Genesis has the 2612 to back up the limited number of PSG channels, while the MS and the GG don't, so those 4 channels are all they've got, it would have been stupid to enforce the 2+1/3+0 limit on those consoles, while the Genesis can survive with one less PSG.
     
  20. Smoke

    Smoke

    Member
    8
    0
    0
    Russia
    Yep, 5FM and 1DAC. My mistake. Thank you=)