[YM2612] Double-checking latching FNUM MSB

For anything related to sound (YM2612, PSG, Z80, PCM...)

Moderator: BigEvilCorporation

Post Reply
neologix
Very interested
Posts: 122
Joined: Mon May 07, 2007 5:19 pm
Location: New York, NY, USA
Contact:

[YM2612] Double-checking latching FNUM MSB

Post by neologix » Sun Jul 06, 2014 12:15 am

The YM2612 registers $A4 through $A6 used for setting the MSB of a channel's FNUM currently store (at least in MAME/Genesis Plus GX-based implementations) in (YM2612_instance).OPN.ST.fn_h instead of in a per-channel fn_h.

On actual hardware, if one channel's MSB is latched but another channel latches its MSB before the first one can finish setting its FNUM, what is the resulting behavior? Does the original channel's subsequent FNUM LSB write use the new MSB (what seems to be currently implemented) or the old MSB (a per-channel state)?

I know that what devs should do is have their YM2612 code set the LSB immediately after the MSB is latched, but if someone happened to have programmed it badly what are the results? I'm not writing a Genesis sound engine but I am fixing the YM2612 in my web-based VGM player and am currently relying on existing software implementations for direction.

foobat
Very interested
Posts: 92
Joined: Fri Sep 14, 2012 1:06 pm

Post by foobat » Sun Jul 06, 2014 1:31 am

On actual hardware, if one channel's MSB is latched but another channel latches its MSB before the first one can finish setting its FNUM, what is the resulting behavior?
That question is a little off - there's no way to do two things at the same time with the ym2612, so it doesn't actually matter what you do after setting the MSB - doing anything besides setting the LSB of the same channel results in undefined behaviour according to the docs. The behaviour might depend on what operation you do after setting the MSB (or it might not). It might cause the LSB to be all 1s, all zeroes, random garbage, or not-so-random garbage. Someone will have to actually test it to find out.

It won't be easy to test exactly what happens to the LSB register since your only feedback from the chip is the audio output (almost all the registers are write-only)

User avatar
Nemesis
Very interested
Posts: 758
Joined: Wed Nov 07, 2007 1:09 am
Location: Sydney, Australia

Post by Nemesis » Sun Jul 06, 2014 11:14 pm

Just went back and had a look at my raw testing notes, and it looks like I confirmed from testing that there's a separate latch for each FNUM register, including the special operation mode of channel 3 where there's a separate FNUM for each operator. That's how I've implemented it in my emulation core.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests