Overview

The YM2413, also known as OPLL, is a FM sound generator produced by Yamaha. It was used in the FM Sound Unit add-on to the Sega Mark III and later built into the japanese Sega Master System. It was also featured in some MSX2 systems and the NES mapper VRC7 from Konami uses a derivative of the YM2413 for extended sound.

List of SMS games with FM sound support

YM3812 / OPL-2 comparisons

The YM3812 has 9 channels each with its own set of registers for defining the type of sound coming from it. The YM2413 simplifies the design: each channel has a 4-bit instrument number, the instrument being a group of predefined register settings stored in an internal ROM.

Of the 16 available instrument types the first one is a user defined instrument that is controlled by a set of programmable registers. There is no limit on the allocation of instruments; the user instrument or any of the fixed ones can be used by multiple channels.

Sound generation

A slot (also known as 'operator') generates a waveform that has several attributes:

The YM2413 allocates two slots per channel, called the carrier and modulator. The output of the carrier is combined with the modulator, and the resulting sound is output on a given channel.

Each channel has its own attributes as well:

Rhythm mode

Rhythm mode is used to create percussion type sounds which cannot be made normally by FM sound generation. Several slots are used for this purpose, which changes the distribution of slots per channel:

The allocation of slots for the rhythm instruments are:

The rhythm channels have their own dedicated volume control and key-on bits. The normally used frequency and volume settings for the channels that share these operators need to be set up in a fixed way as advised by Yamaha:

Reg.SettingPurpose
$16$20F-Num LSB for channel 7 (slots 13,16)
$17$50F-Num LSB for channel 8 (slots 14,17)
$18$C0F-Num LSB for channel 9 (slots 15,19)
$26$05Block/F-Num MSB for channel 7
$27$05Block/F-Num MSB for channel 8
$28$01Block/F-Num MSB for channel 9

Notice that the key-on bits are reset so that the dedicated ones in register $0E can be used.

Because of the way rhythm mode works, it isn't possible to disable some rhythm channels to "free up" the operators so the channel can be used in melodic mode.

Reverse engineering of the YM2413

Extensive reverse engineering of the chip has been performed by andete and is available on GitHub: https://github.com/andete/ym2413. The notes are also linked below chronologically with embedded images:

  1. YM2413 Reverse Engineering Notes 2015-02-09 - initial tests
  2. YM2413 Reverse Engineering Notes 2015-03-05 - more tests
  3. YM2413 Reverse Engineering Notes 2015-03-11 - volume levels
  4. YM2413 Reverse Engineering Notes 2015-03-16 - phase counter
  5. YM2413 Reverse Engineering Notes 2015-03-20 - envelope generator, decay/release rates
  6. YM2413 Reverse Engineering Notes 2015-03-27 - envelope generator, attack rate
  7. YM2413 Reverse Engineering Notes 2015-04-09 - sine and exp tables
  8. YM2413 Reverse Engineering Notes 2015-11-28 - amplitude modulation
  9. YM2413 Reverse Engineering Notes 2015-12-01 - vibrato
  10. YM2413 Reverse Engineering Notes 2015-12-03 - operators and frequency modulation
  11. YM2413 Reverse Engineering Notes 2015-12-12 - feedback
  12. YM2413 Reverse Engineering Notes 2015-12-16 - registers + KSL + waveforms
  13. YM2413 Reverse Engineering Notes 2015-12-24 - sustain level + KSR
  14. YM2413 Reverse Engineering Notes 2015-12-31 - envelope
  15. YM2413 Reverse Engineering Notes 2016-02-10 - ADSR transitions
  16. YM2413 Reverse Engineering Notes 2016-07-16 - small signals / initial model
  17. YM2413 Reverse Engineering Notes 2017-01-26 - Attack rate / improved model
  18. YM2413 Reverse Engineering Notes 2018-05-13 - Rhythm, noise, LFSR

Note that the die shots referred to in the above notes are actually from a FHB013 which is a YM2413 derivative with a different instrument set. There are no actual YM2413 die shots available.




Return to top
0.328s