The YM2612 gives the Mega Drive six channels of FM synthesis, each built from four operators that shape a voice. Sega’s public hardware history lists six FM voices and explains that one can instead play sampled sound. The PSG supplies its own tones and noise alongside them.
That replacement has a cost: samples take over FM channel 6, and software must feed the bytes to the chip at the right times. Sega’s Genesis Sound Software Manual, dated 21 February 1992, describes that scheduling problem and compares the YM2612 with the YM2151 used in its arcade machines. Its details need checking against the hardware: the overview incorrectly assigns one of channel 3’s features to channel 6 as well.
Fast facts
- Maker: Yamaha. The chip belongs to Yamaha’s OPN family and is also known as OPN2.
- FM channels: six, in two sets of three (channels 1-3 and 4-6).
- Operators: four per channel, connected in one of eight arrangements (“algorithms”); operator 1 can feed back into itself.
- Channel 3: can give each of its operators its own frequency.
- DAC: 8-bit samples, replacing FM channel 6 while enabled, timed entirely by software.
- LFO: one low-frequency oscillator for vibrato and tremolo, with a depth set per channel.
- Timers: two, which set flags but do not interrupt the processor on the Mega Drive.
- Stereo: each channel can go left, right or both; on the original Mega Drive only the headphone socket carries it.
- Clock: the 68000’s clock, 7.67 MHz on an NTSC console and 7.60 MHz on PAL.
- Access: the Z80 reaches it at
4000h-4003h, the 68000 at$A04000-$A04003.
Four operators to a voice
Each channel combines four operators. An operator generates a waveform at a selected frequency and shapes its level over time with an envelope; its output can modulate another operator or contribute to the audible signal. An operator’s frequency is the channel’s multiplied by a whole number from 1 to 15, or by ½, and nudged by a small detune.
The algorithm decides which operators modulate which, and which ones are heard. Each operator has its own envelope, with an attack, two decay stages and a release, and a total level that sets its loudness in steps of about 0.75 dB. To make a note softer while preserving its tone, change the level of the audible operators. Changing a modulating operator’s level changes the timbre instead, as Sega’s February 1992 sound manual explains. The envelope of a modulating operator changes the tone over the length of a note, which is how one channel can sound like a plucked bass that starts bright and dulls as it fades. The FM synthesis entry explains the method.
Talking to the chip
The YM2612 has two banks of registers. Part I holds the global registers and channels 1-3, Part II holds channels 4-6. A program writes a register number to the first address of a pair and the value to the second: 4000h and 4001h for Part I, 4002h and 4003h for Part II, as the Z80 sees them.
The chip needs time to take each value, and bit 7 of its status byte is set while it is busy. Sega’s manual tells programmers to wait until it clears. In September 1991 Sega of America sent developers Technical Bulletin #11 about games whose sound stopped: they had read the status at 4001h, where the YM2612 does not reliably report it, so it seemed never busy and writes were lost. The fix was to read status only from 4000h.
This Z80 routine follows those rules for a Part I register:
; A = register number, C = value (global registers and channels 1-3)
fm_write1:
push af
wait: ld a,(4000h) ; status: bit 7 set while busy
rla ; bit 7 into carry
jr c,wait
pop af
ld (4000h),a ; register number
ld a,c
ld (4001h),a ; value
retA few registers matter in every sound driver. Register 28h keys notes on and off: the low three bits pick the channel (0-2 for channels 1-3, 4-6 for channels 4-6) and the top four switch its operators on, so writing F0h starts channel 1 and 00h releases it. A channel’s frequency is 14 bits long, a 3-bit octave (“block”) and an 11-bit frequency number, split across two registers, and Sega’s manual warns that multi-byte values must be written high byte first.
The February 1992 manual leaves the per-operator SSG-EG function unexplained and recommends disabling it. The public Plutiedev register reference describes its envelope shapes. SSG-EG controls an envelope mode left over from the SSG, the square-wave sound generator built into Yamaha’s earlier OPN chips, which the YM2612 otherwise leaves out.
Channel 3, not channel 6
Only channel 3 has the mode that gives each operator an independent frequency. The public Plutiedev register reference distinguishes it from channel 6.
Sega’s February 1992 overview attributes the feature to both channels, but its register descriptions identify channel 3 alone. Register 27h selects the mode, and the extra frequency registers, A8h–AEh, exist only in Part I. Independent frequencies allow inharmonic sounds such as bells and metallic percussion, or separate pitches within one channel.
The DAC and its cost
The DAC is not a seventh voice. Setting bit 7 of register 2Bh turns FM channel 6 off and sends whatever byte was last written to register 2Ah out in its place; of channel 6’s own settings, only its left and right switches still apply. The chip does no timing of its own. To play a sample at a steady rate, the program must write each byte at exactly the right moment, while leaving time for FM register updates. This is the scheduling difficulty described in Sega’s February 1992 manual.
Sega’s technical overview gives the Z80 the job of controlling the sound chips, which makes it the natural place for sample playback: a driver there can feed the DAC in a tight loop and fit FM register writes between samples, leaving the 68000 to run the game. Every sampled drum over FM music was paid for twice, once with channel 6 and once with the Z80’s time.
Timers that only set a flag
The two timers were meant for software timing. Timer A is 10 bits long and Timer B 8 bits, and Sega gives their periods as 18 × (1024 − A) microseconds and 288 × (256 − B) microseconds, up to about 18.4 ms and 73.7 ms. Those figures assume an 8 MHz clock; on an NTSC Mega Drive the chip runs at 7.67 MHz, so the real periods are about 4 per cent longer. Register 27h loads, enables and resets them.
A timer can set a status flag when it expires, but it does not interrupt the Mega Drive’s processor. Sega’s February 1992 manual tells software to poll those flags. The manual offers the timers as an alternative to the Z80’s vertical-blank interrupt, so a driver that takes its tempo from them has to keep checking the status byte between its other work.
The ladder effect and the YM3438
The YM2612 converts its own output to an analogue signal, which many of Yamaha’s FM chips left to a separate converter. It does so with a 9-bit converter shared between the channels in turn. Its quiet output is distorted: low-level signals are quantised much more coarsely than they should be. The effect is known as the “ladder effect”, and it can be heard in fades and quiet notes.
Yamaha also made the chip in CMOS as the YM3438 (OPN2C), with a cleaner converter. Sega used it in arcade boards such as System C, and in later Mega Drive models the YM3438 design moved inside a single custom chip that combined it with the video processor. Those consoles play the same music with less of the distortion, so the same game can sound different on an early and a late Mega Drive.
Sources
- Sega, Sega Hard Encyclopedia, “Mega Drive”: publicly available hardware specifications, including six FM voices and the use of one for PCM. https://www.sega.jp/history/hard/megadrive/
- Plutiedev, “YM2612 registers”: public programming reference for operator controls, channel 3 mode, DAC use and timers, including the chip clock and the 8 MHz assumption in Sega’s timer figures. https://plutiedev.com/ym2612-registers
- Sega, Genesis Software Manual (© 1989 Sega of Japan, revised February 1992): the Genesis Sound Software Manual section, dated 21 February 1992. Overview, p. 4: chip comparison, capabilities, operator frequencies, DAC use, stereo and timers. Register overview, p. 6. Access, Parts I and II, the busy bit, write order and the undocumented SSG-EG function, pp. 7–9. Timers A and B and register 27H, p. 11. Key on/off, the special channel 3 and the DAC registers, p. 12. MUL and detune, p. 12; TL in 0.75 dB steps, p. 13. The channel 3 frequency registers, pp. 14-15.
- Sega, Genesis Software Manual: the Technical Overview dated 28 February 1990 (the Z80 controls the PSG and FM chips); the register section (NTSC and PAL CPU clocks of 7.67 MHz and 7.60 MHz).
- Sega of America, Genesis Technical Bulletin #11, “Problems during sound access”, 9 September 1991: reading the busy flag only from 4000h.
- Wikipedia, “Yamaha YM2612” (web, secondary): the OPN family and OPN2 name; the SSG section of earlier OPN chips left out, with its envelope generator vestigial; the built-in time-multiplexed 9-bit DAC and its low-volume distortion, called the “ladder effect”; the YM3438 (OPN2C) in CMOS with an improved DAC; the YM3438 core in the custom chips of later Mega Drive models. https://en.wikipedia.org/wiki/Yamaha_YM2612
- Sega Retro, “Sega System C” (web, secondary): the YM3438 as System C’s FM chip. https://segaretro.org/Sega_System_C