Skip to content

YMW258F research

Technical discussion which is not directly related to VGM files. Talk about Hardware and Software.

Moderator: Staff

  • Triton Offline
  • Posts: 6
  • Joined: 2023-05-19, 21:33:58
  • Location: The Netherlands
  • Contact:

YMW258F research

Post by Triton »

I wanted to share a bit of information I discovered while working on my YMW258F core. Most of the arcade systems that use this IC (which is also known as the Sega MultiPCM) only use the "documented" features of this chip. I say "documented" because as far as I know there is no official Yamaha information available, except from pin descriptions from various music systems (TG100, PSR510 etc etc). Most of the available information is coming from the OPL4 manual, as the PCM part of the OPL4 shares a lot of similarities with the YMW. The only game that uses some of the undocumented features of the YMW is Virtua Racing, but I will come back that this game later.

First of all, lets start with the address map. As we know, there are 4 address lines (A0 - A3) giving 16 unique addresses. The following 3 address locations are known:
0x0: PCM data write address
0x1: PCM channel latch
0x2: PCM register latch

What is undocumented is the following address:
0xD: LDSP command register

You write 4 bytes of data to address 0xD, which will form a 32-bit command which gets send to the LDSP (YM3413). LSB first. More on the YM3413 can be found here:
viewtopic.php?t=5745

Out of the 16 addresses, only the function of 4 are known. Here is some speculation about the possible use of other addresses:
- You can read/write from/to the sample ROM/RAM. This will require 3 bytes to form a 22-bit address, and a single byte to read or write data. The address is most likely an auto increment address. All of this will probably require 4 addresses.
- The TG100 MIDI implementation mentions a global or master volume level. While this feature could have been fully implemented in software, it could also be a hardware feature similar to Total Level but instead applied to all 28 channels. This could require 1 address.
- I have seen some writes to address 0x3 by Virtua Racing, with the data being 0x00. I couldn't make any sense of this.
- Stadium Cross, Title Fight and the TG100 startup code write to address 0x9 with the data being 0x03. This could be the earlier mentioned master volume, could be a memory configuration register or it can be something else.
- The YMW258 has a /DSPIC pin (DSP Initial Clear) directly connected to both /CRS and /IC pins on the YM3413 (in the case of at least the PSR510). It's possible this pin is software controlled.

We should also consider some addresses are simply not used, but Yamaha must have had a good reason to provide a 4-bit address space.

Now more on the PCM register writes, new discoveries will be marked with an *:

PCM Register 0x00: Pan / DSP send level*
b7-4: Pan pot level. Works as documented in the OPL4 manual
b3-0: DSP send level. I believe the range to be 0 - 8 (as per TG100 MIDI documentation),with 0 = not sending data to the LDSP, and 8 = maximum send level.
I'm not entirely sure how to apply this send level to the PCM sample data, but my implementation looks like this:

Code: Select all

DspAccmL += Channel.OutputL >> (16 - (Channel.DspSendLvl << 1));
DspAccmR += Channel.OutputR >> (16 - (Channel.DspSendLvl << 1));
Basically the YMW accumulates the send level converted data for each PCM channel (both L and R channels), before sending the 16-bit data to the LDSP.

PCM Register 0x01: Wave table number [7:0]

PCM Register 0x02: Frequency [5:0] / Wave table number [8]

PCM Register 0x03: Octave / Frequency [9:6]

PCM Register 0x04: Channel control*
b7: Key on/off. As documented in the OPL4 manual.
b6: LFO reset or LFO hold. 1 = LFO hold/reset, 0 = LFO active
The TG100 sets this bit during startup and clears it once done. It's either to hold or reset the LFO (I'm assuming hold, as this is hinted at by the TG100 MIDI implementation)
b3: This control flag is related to the envelope generator. It could be pseudo-reverb, damp, hold or something other. Most interestingly it is only set by the TG100 for ALL drum channels. If this bit turns out to control pseudo-reverb or damp, I will assume both features to exist in the YMW as this will match the OPL4 PCM features.

PCM Register 0x05: Total level / Level direct

PCM Register 0x06: LFO Frequency / Vibrato (PM) depth

PCM Register 0x07: Attack rate* / Tremolo (AM) depth
b7-4: Attack rate. Yes, you can manually control the attack rate, overwriting the wave preset value.
b2-0: Tremolo depth. Works as documented in the OPL4 manual

PCM Register 0x08: Decay level* / Decay rate*
b7-4: Decay level
b3-0: Decay rate
Both are educated guesses, as I have never seen a write to this register. I've just filled in the blanks.

PCM Register 0x09: Rate correction* / Release rate*
b7-4: Rate correction
b3-0: Release rate

PCM Register 0x0A: Sustain rate*
b3-0: Sustain rate.
This is another guess, but based on writes done by both Virtua Racing and the TG100.
Virtua Racing writes 0x07 for some channel.
The TG100 writes 0x01 and 0x02 for some channels

Based on the above PCM register information, we can conclude that you can overwrite all envelope generator related parameters just like the OPL4 can... not relying on the preset values from the wave bank. I might have some registers wrong/swapped, but I'm 100% sure about the attack and release rates as those are MIDI controllable parameters of the TG100.

With the new details implemented in my core, the TG100 demo sounds like this:
https://github.com/michelgerritse/YM-re ... 20DSP).mp3

But more interestingly, the Course Select track from Virtua Racing also uses some of those features. It sounds like this:
https://github.com/michelgerritse/YM-re ... Select.mp3

The YMW258F has more secrets to discover, but without any real hardware testing this is as much as I could find.