Sega Master System / Mark III / Game Gear
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.
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.
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 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:
|$16||$20||F-Num LSB for channel 7 (slots 13,16)|
|$17||$50||F-Num LSB for channel 8 (slots 14,17)|
|$18||$C0||F-Num LSB for channel 9 (slots 15,19)|
|$26||$05||Block/F-Num MSB for channel 7|
|$27||$05||Block/F-Num MSB for channel 8|
|$28||$01||Block/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.
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:
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.