Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - FM / PSG mix - testing the audio control port

Reply to topic
Author Message
  • Joined: 01 Feb 2014
  • Posts: 851
Reply with quote
FM / PSG mix - testing the audio control port
Post Posted: Sun Dec 22, 2019 7:51 am
There still seems to be some confusion about how to mix PSG and FM on systems that have both available. The problem is that there's very few software that even tries to do this, basically just the japanese BIOS and ValleyBell's Sonic FM hack. I read through the thread regarding the latter and couldn't really make heads or tails of what was being reported, as it seems at least partially contradict the information on the development page.

I think a few more tests are in order to find out what's really going on.

Here's a little test ROM that I made. It plays a jolly little tune on both the SN76489 and the YM2413. With the d-pad of controller 1 you can choose which value gets sent to the audio control port. It also shows which value gets read back from there.

Please try out the attached ROM and report your findings. I'm especially interested in the results on the japanese SMS, the Mark III plus FM unit combo, and the PowerbaseFM.

Which sound output can you hear? If you deactivate one, does the sound cut off immediately or does the last note played linger?


I'll start with the systems I have access to. First value is the one that's written to the acp, the second one is the one that's read from there. The third one is read again, but with I/O interference switched back on.

European SMS with VileTim FM board:
----------------------------------------------------
00 00 00 both chips audible
01 01 01 only FM, PSG is muted immediately
02 00 00 both chips audible
03 01 01 both chips audible

European SMS, FM board switched off:
----------------------------------------------------
00 02 06 only PSG
01 02 05 only PSG
02 02 03 only PSG
03 02 07 only PSG

Analogue Mega SG:
----------------------------------------------------
00 00 00 both chips audible
01 01 01 both chips audible
02 00 00 both chips audible
03 01 01 both chips audible
acptest.zip (3.77 KB)
ACP Test

  View user's profile Send private message
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Sun Dec 22, 2019 5:46 pm
I've been testing with an european SMS wiith Viletim's Board, and with a PowerBase FM:

European SMS with VileTim FM board:
----------------------------------------------------
00 00 00 both chips audible
01 01 01 both chips audible !!
02 00 00 both chips audible
03 01 01 both chips audible

European SMS, FM board switched off:
----------------------------------------------------
00 02 06 only PSG
01 02 05 only PSG
02 02 03 only PSG
03 02 07 only PSG

PowerBase FM
----------------------------------------------------
00 00 00 both chips audible
01 01 01 both chips audible
02 00 00 both chips audible
03 01 01 both chips audible
  View user's profile Send private message
  • Joined: 30 Jan 2007
  • Posts: 313
  • Location: San Jose, CA
Reply with quote
Post Posted: Sun Dec 22, 2019 9:02 pm
I'll see if I can get you results for both the Mark III+FM Unit and JP SMS. My Master Everdrive's in another location right now so it might take a little bit. I'll edit this post again with my findings.

EDIT: Here's the results:

JP SMS
00 00 00 - PSG only
01 01 01 - FM only
02 02 02 - No audio
03 03 03 - Both audible

Mark III with FM Unit
00 00 00 - PSG only
01 01 01 - FM only
02 00 00 - PSG only
03 03 01 - FM only

Also, on all the results the audio cuts out immediately and doesn't linger.
  View user's profile Send private message Visit poster's website
  • Joined: 01 Feb 2014
  • Posts: 851
Reply with quote
Post Posted: Mon Dec 23, 2019 2:06 pm
Thanks for testing. Those results are certainly quite interesting. I have edited the development page with the new information.

@kusfo: It's very interesting that you get different results on input $01 than me, despite also using a VileTim FM board. I think it's possible that we have different revisions of the hardware in use. Or maybe it's dependent on the host system? Mine's an early model SMS 1 with snail maze BIOS.

@ApolloBoy: Your results pretty much confirm our assumptions on the functionality of the audio control port. It's good to finally have proof. However, it also confirms that it's impossible to have PSG and FM combined on a Mark III. Bummer.
By the way: Would you mind testing on your Mark III with the FM unit detached to confirm it acts the same as an SMS without FM hardware?
  View user's profile Send private message
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Mon Dec 23, 2019 2:56 pm
Yes, it was quite extrange to get these different results. I was thinking maybe I was not noticing the PSG going silent, but it was not the case at all (but I can do a video just in case)

My Master System is a 1 model with Safari hunt and Hang On included. The Viletim board is a V2 version, I think.
  View user's profile Send private message
  • Joined: 01 Feb 2014
  • Posts: 851
Reply with quote
Post Posted: Thu Dec 26, 2019 10:15 am
There's one strange effect that I'm experiencing when running the test ROM on the Mega SG: The FM seems to randomly drop notes.

I thought it might have to do with sending data to the port too fast, and indeed I found a few places in the code where that happened, but fixing these changed nothing.

Anyone experienced anything like this on any setup?

On my SMS with VileTim board it plays just fine. It did that before, too, though, even with accessing the FM port too fast.

Anyway, here's a new version of the test ROM with the FM access fixed. I also managed to synchronize the two chips a little better, so it sounds slightly better than the previous version. If you do any further testing, please use the new version.

EDIT: Apparently, this is a known issue and YM2413 support on the Mega SG is simply broken. Hopefully, a future firmware revision will take care of it.
ACPTest2.zip (3.78 KB)
New vesrion with fixed FM access times

  View user's profile Send private message
  • Joined: 01 Feb 2014
  • Posts: 851
Reply with quote
Post Posted: Fri Dec 27, 2019 3:55 pm
kusfo wrote
The Viletim board is a V2 version, I think.

I just checked, and my FM board is a V2.2. If you have a 2.1 or 2.0, that might explain the difference.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3769
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Fri Dec 27, 2019 5:34 pm
SMSFM Info wrote
Sega Master System FM Sound Expansion Board
The Japanese Sega Master System included a Yamaha YM2413 FM synthesis chip along with the standard PSG sound. Many games, some of which were never even released in Japan, contain extra FM sound and music. Installing this board will add FM sound capability to any Master System or Mark III game console. The first post in this thread contains a list of games with FM sound. A switch is provided with the board to disable the FM chip and revert to the PSG sound whenever desired.

New in version 2.0
One of the most popular games with extra FM sound is Monster World III: The Dragon's Trap. This game is programmed to use the FM sound hardware only if it detects that is is running on a Japanese SMS (or Mark III). Hardware version 2.0 and above has a region switch feature. Instead of a two position switch, a three position switch is now supplied which can be used to select between off position (PSG), FM, or Japanese/FM.

New in version 2.2
The method for region switching (disable the I/O chip with KILLG# upon receiving a write to port 0x3F) is not totally reliable. Approximately 5-10% of consoles do not respond. Hardware version 2.2 fixes this problem with the addition of one extra wire to the installation. In late 2014 there was some extra details discovered about the Japanese SMS sound hardware on detailed in this thread. The benefit is there are no longer 'extra' sound effects playing in Outrun at the start of a race.

Version 2.2 is compatible with all known games with functioning FM sound support. Some of these games were released only in Japan.
  View user's profile Send private message Visit poster's website
  • Joined: 01 Feb 2014
  • Posts: 851
Reply with quote
Post Posted: Sat Dec 28, 2019 9:04 am
ApolloBoy wrote
Mark III with FM Unit
00 00 00 - PSG only
01 01 01 - FM only
02 00 00 - PSG only
03 03 01 - FM only.

I must admit that the last line puzzles me. The way the test is set up, it shouldn’t actually be possible that the third number is lower than the second one. I think the line should read either 03 01 01 or 03 03 03. Could you double-check, maybe?
  View user's profile Send private message
  • Joined: 29 Mar 2012
  • Posts: 879
  • Location: Spain
Reply with quote
Post Posted: Sat Dec 28, 2019 9:36 am
Kagesan wrote
kusfo wrote
The Viletim board is a V2 version, I think.

I just checked, and my FM board is a V2.2. If you have a 2.1 or 2.0, that might explain the difference.


I bought it in 2013, so it should be 2.0
  View user's profile Send private message
  • Joined: 30 Jan 2007
  • Posts: 313
  • Location: San Jose, CA
Reply with quote
Post Posted: Wed Mar 25, 2020 5:24 am
Kagesan wrote
ApolloBoy wrote
Mark III with FM Unit
00 00 00 - PSG only
01 01 01 - FM only
02 00 00 - PSG only
03 03 01 - FM only.

I must admit that the last line puzzles me. The way the test is set up, it shouldn’t actually be possible that the third number is lower than the second one. I think the line should read either 03 01 01 or 03 03 03. Could you double-check, maybe?


I pulled out my Mark III again and here's the second take:

00 00 00 - PSG only
01 01 01 - FM only
02 00 00 - PSG only
03 01 01 - FM only
  View user's profile Send private message Visit poster's website
  • Joined: 01 Feb 2014
  • Posts: 851
Reply with quote
Post Posted: Wed Mar 25, 2020 5:04 pm
Brilliant. Thanks for confirming.
  View user's profile Send private message
  • Joined: 30 Jan 2007
  • Posts: 313
  • Location: San Jose, CA
Reply with quote
Post Posted: Thu Mar 26, 2020 1:30 am
Oh and I also saw that you wanted me to do the test without the FM Unit attached, so here are the results from that:

00 06 06 - PSG
01 05 05 - PSG
02 03 03 - PSG
03 07 07 - PSG
  View user's profile Send private message Visit poster's website
  • Joined: 01 Feb 2014
  • Posts: 851
Reply with quote
Post Posted: Thu Mar 26, 2020 6:35 am
Very interesting, thanks.
  View user's profile Send private message
  • Joined: 19 Feb 2019
  • Posts: 8
Reply with quote
Post Posted: Sat May 14, 2022 1:04 am
I encountered this issue with Sydney Hunter and the Sacred Tribe, it would only play FM Music and no sound effects with my SMSFM Mod unless the switch was set to the disable FM position (where it would play PSG sound effects and music).

I fired up the ROM in Emulicious, set a breakpoint on writes to port F2 and saw several writes to the port at the beginning of the ROM. The last write wrote an 01, which I used the ACPTest2 program to confirm that a 01 write disables PSG while allowing FM on my system. My system is a US SMS with a v2.4 BIOS and a v2.2 SMSFM mod. When I changed the last write from 01 to 03, the game played with FM Music and PSG sound on my hardware. In the ROM the location to change is address $29.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3769
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Tue Jun 07, 2022 12:18 pm
@Great Hierophant: I wonder if they ever expected to have FM and PSG at the same time...
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!