Sonic and Sega Retro Message Board: SMPS z80 driver + SMPS Converter - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Loading News Feed...
 

SMPS z80 driver + SMPS Converter

#1 User is offline Smoke 

Posted 11 October 2011 - 07:07 AM

  • Posts: 8
  • Joined: 09-October 11
  • Gender:Male
  • Location: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.

Posted Image Posted Image

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

Quote

1)First you need to include macros.asm file to your main source file.
2)Include z80drv.asm file.
3)For new BGM put your music in 'Music' folder then write a path to it in 'Music Files' section in z80drv.asm file. Write a pointer to it in z80stuff.asm file.
4)For new SFX put your SFX in 'Sounds' folder then write a path to it in 'Sound Effects' section in z80drv.asm file. Write a pointer to it in z80stuff.asm file.
5)For new DAC sample put your PCM file in DACb1.asm following the applied example.
6)For new PSG tone put your PSG file in PSG folder and write a pointer to it in z80stuff.asm file.

>P.S. If your music/SFX or other related files lies far than 2-3 bank don't forget to change required
values following 'z80driver offsets.txt' file.<

Usage of the converter:

Quote

In the beginning you need to know the type of your music-source (z80 or 68k). According to this you
must choose Conversion Type. Next, press "Convert" button and save the file..
But before you will do it, you must type to "Old" and "New" fields all necessary data.
So, if you are converting a music in Sonic 1 SMPS type to SMPS z80 type, you should write start offset
of your new melody into "New" field relatively to current m68k bank. For example: in rom $29872, you should write $1872
and in rom $12591, you should write $2591.
If you do vice versa operation then you should write a start offset of your melody-source into "Old" field.
If you are converting from standart SMPS 68k to SMPS z80 you shoud do it similarly to point 1.
If you want to fix pointers in SMPS z80 melody file for using it in another location, you should choose
Conversion Type "z80 to z80" and in fields "Old" and "New" write old and new locations of music similar
to previous points above.

This post has been edited by Smoke: 12 October 2011 - 03:41 AM

#2 User is offline nineko 

Posted 11 October 2011 - 08:39 AM

  • I am the Holy Cat
  • Posts: 5238
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251

View PostSmoke, on 11 October 2011 - 07:07 AM, said:

I think SMPS z80 is way more handy driver because of m68k is free of playing music. All this work lies on z80.
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 User is offline flamewing 

Posted 11 October 2011 - 08:50 AM

  • Posts: 564
  • Joined: 11-October 10
  • Gender:Male
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12
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.
This post has been edited by flamewing: 11 October 2011 - 08:51 AM

#4 User is offline Smoke 

Posted 12 October 2011 - 03:42 AM

  • Posts: 8
  • Joined: 09-October 11
  • Gender:Male
  • Location:Russia
Oops, sorry. I edited 1st post. Now you can download it =)
Converter

Driver

#5 User is offline Sik 

Posted 12 October 2011 - 11:01 AM

  • Sik is pronounced as "seek", not as "sick".
  • Posts: 6719
  • Joined: 17-March 06
  • Gender:Male
  • Project:being an asshole =P
  • Wiki edits:11

View PostMarkeyJester, on 12 October 2011 - 10:02 AM, said:

just putting that out there before any technical nitwit comes in
Sorry, but

View PostMarkeyJester, on 12 October 2011 - 10:02 AM, said:

limit of a bank size of 8000 bytes
it's 32768 not 8000 :v: (missing the hex indicator makes a serious difference =P)

#6 User is offline flamewing 

Posted 12 October 2011 - 11:09 AM

  • Posts: 564
  • Joined: 11-October 10
  • Gender:Male
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12
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)?

Spoiler


#7 User is offline Smoke 

Posted 12 October 2011 - 11:36 AM

  • Posts: 8
  • Joined: 09-October 11
  • Gender:Male
  • Location: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.

Quote

Also, does it correctly convert/rebase all pointers in coordination flags (see previous link, plus the S3+ section just after)?

Yes. All pointers are converted correctly=)
This post has been edited by Smoke: 12 October 2011 - 11:56 AM

#8 User is offline flamewing 

Posted 12 October 2011 - 11:55 AM

  • Posts: 564
  • Joined: 11-October 10
  • Gender:Male
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12
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 User is offline Smoke 

Posted 12 October 2011 - 12:12 PM

  • Posts: 8
  • Joined: 09-October 11
  • Gender:Male
  • Location: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 User is offline DalekSam 

Posted 12 October 2011 - 12:15 PM

  • woop woop yo ass too fat
  • Posts: 1753
  • Joined: 19-February 08
  • Gender:Male
  • Location:Northern Ireland, Belfast
  • Project:nothing
  • Wiki edits:165

View Postflamewing, on 11 October 2011 - 08:50 AM, said:

I don't know why people like to use the S1 driver, or S2 clone driver for that matter.

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 User is offline flamewing 

Posted 12 October 2011 - 01:10 PM

  • Posts: 564
  • Joined: 11-October 10
  • Gender:Male
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12

View PostSmoke, on 12 October 2011 - 12:12 PM, said:

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

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 User is offline Andlabs 

Posted 12 October 2011 - 01:12 PM

  • 「いっきまーす」
  • Posts: 2081
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061
@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.
This post has been edited by Andlabs: 12 October 2011 - 01:15 PM

#13 User is offline Oerg866 

Posted 12 October 2011 - 06:39 PM

  • High fidelity since 1993
  • Posts: 1625
  • Joined: 07-September 06
  • Gender:Male
  • Location:Frankfurt East-side, Germany
  • Project:MDEM, demoscene stuff, music, coding ...
  • Wiki edits:3
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
This post has been edited by Oerg866: 12 October 2011 - 06:43 PM

#14 User is offline flamewing 

Posted 12 October 2011 - 06:47 PM

  • Posts: 564
  • Joined: 11-October 10
  • Gender:Male
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12
$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 User is offline Oerg866 

Posted 12 October 2011 - 07:28 PM

  • High fidelity since 1993
  • Posts: 1625
  • Joined: 07-September 06
  • Gender:Male
  • Location:Frankfurt East-side, Germany
  • Project:MDEM, demoscene stuff, music, coding ...
  • Wiki edits:3
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

  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users