YM2413 reverse engineering in progress

van Meits op 31-01-2015, 18:24
Onderwerp: Nijmegen 2015

Onbreken er foto's? Stuur die van jou ook in!Voeg foto toe

Reacties (9)

Van Grauw

Ascended (10066)

afbeelding van Grauw

01-02-2015, 03:29

Looking very much forward to the results Smile.

Van WORP3

Paladin (828)

afbeelding van WORP3

01-02-2015, 14:37

the big question is what would they like to know about that chip ?

Van Meits

Scribe (6446)

afbeelding van Meits

01-02-2015, 17:39

I bet they try to make it sound correct in their emulator Smile

Van Grauw

Ascended (10066)

afbeelding van Grauw

01-02-2015, 19:59

For one, the precise preset instrument settings. This will not only be useful for emulators but also has several MSX applications.

Van sd_snatcher

Prophet (3472)

afbeelding van sd_snatcher

03-02-2015, 13:35

It would be fantastic if they could publish detailed information on the MO and RO pins output format. The datasheet only mention it superficially, without any real specs. We don't know the real sample rate of the output, nor the multiplexing rate.

Van wouter_

Champion (467)

afbeelding van wouter_

03-02-2015, 19:54

The goal is indeed to improve the YM2413 emulation in openMSX.
I do plan to publish all results. Though after the fair I didn't have much time yet to continue this project, thus I don't have much info yet.
Here is a little info we did already manage to gather. Some of it can also be found in the YM2413 application manual, but it's nice to have it confirmed:
- The MO and RO pins are analog output pins. Internally in the YM2413 these signals are created from a 9-bit digital signal (the DA-conversion uses a linear scale). Only 511 different values seem to be used (-255 .. +255).
- The different music channels are time-multiplexed on the output pins (as described in the application manual). It takes 72 clock cycles to cycle through all the channels. This confirms the YM2413 has a per-channel sample rate of 3.57MHz/72 = 49.7kHz.
- The output of each channel remains active for 3 cycles before the MO/RO pin goes back to the neutral position. (There are 9 channels, so the MO pins is non-'zero' for max 27 out of 72 cycles).

Van sd_snatcher

Prophet (3472)

afbeelding van sd_snatcher

05-02-2015, 14:44

Thanks! This precious information is very welcome.

I curious about some other details:

1) When the rhythm mode is enable, does Mo has gaps for the unused time slots of channels 7~9, or does it cycle only through channels 1~6 then?

2) For the Ro output, does it cycle through 6 time slots (3 drumkit channels repeated two times), or it cycle through 9 time slots like Mo?

Will openMSX emulate the low-pass filter used to analog mix the channels? If so, this filter should be configurable in the xml file, since many machines have different filters than one on the datasheet.

Van wouter_

Champion (467)

afbeelding van wouter_

05-02-2015, 16:33

sd_snatcher wrote:

1) When the rhythm mode is enable, does Mo has gaps for the unused time slots of channels 7~9, or does it cycle only through channels 1~6 then?
2) For the Ro output, does it cycle through 6 time slots (3 drumkit channels repeated two times), or it cycle through 9 time slots like Mo?

Both MO and RO have gaps. So in both rhythm and non-rhythm mode the per-channel output frequency is 49.7kHz.
The YM2413 has 9 music channels, each channel uses 2 operators. In rhythm mode, 3 music channels are replaced with 5 rhythm sounds, one of those takes 2 operators, the other 4 take only one operator each. The YM2413 only has the circuitry to perform the calculations for one such operator at a time, and that circuit is time-multiplexed among the 18 different logical operators. (Apparently) one such operator-calculation takes 4 cycles. Thus to update all channels (in either mode) we need 2x9x4=72 cycles.

sd_snatcher wrote:

Will openMSX emulate the low-pass filter used to analog mix the channels? If so, this filter should be configurable in the xml file, since many machines have different filters than one on the datasheet.

In a first step I'd like to get the digital part correct. Later we can maybe think about the (analog) low-pass filtering. (There already is such a filter in openMSX, but it's not (yet) configurable per machine).

Van Grauw

Ascended (10066)

afbeelding van Grauw

05-02-2015, 19:04

FM Stereo Pak outputs only drums on one side so it follows that RO does not fill the gaps with melody channels.

However, the application manual says that it does output each drum value twice, to ensure the volume doesn't get too low.