Sega Genesis Technical Manual - YM2612 section

Many years ago, there was a file called SEGA2.DOC which was a Mega Drive technical manual with a bunch of errors and some file corruption. A bit less long ago, a bunch of scans surfaced which seemed to exactly match, including a lot of hand-written parts corresponding to the more extreme errors; I transcribed and corrected the errors on this page.

More recently, some better scans of the same manual, but in better quality without all the errors and some slightly different wording, appeared. I’ve updated this page with those scans and their pagination. Pages are numbered and hyperlinked for your convenience. Shading indicates additions/corrections/comments.

An 8-bit Digitized Audio channel (as replacement for one of the FM channels)

Stereo output capability

One LFO (low frequency oscillator) to distort the FM sounds

2 timers, for use by software

To define these terms more carefully: an FM channel is capable of expressing, with a high degree of realism, a single note in almost any instrument’s voice. Chords are generally created by using multiple FM channels.

The standard FM channels each have a single overall frequency and data for how to turn this frequency into the complex final wave form (the voice). This conversion process uses four dedicated channel components called ‘operators’, each possessing a frequency (a variant of the overall frequency), an envelope, and the capability to modulate its input using the frequency and envelope. The operator frequencies are offsets of integral multiples of the overall frequency.

There are two sets of three FM channels, named channels 1 to 3 and 4 to 6 respectively. Channels 3 and 6, the last in each set, have the capability to use a totally separate frequency for each operator rather than offsets of integral multiples. This works well (l believe) for percussion instruments, which have harmonics at odd multiples such as 1.4 or 1.7 of the fundamental.

The 8-bit Digitized Audio exists as a replacement of FM channel 6, meaning that turning on the DAC turns off FM channel 6. Unfortunately, all timing must be done by software -- meaning that unless the software has been very cleverly constructed, it is impossible to use any of the FM channels at the same time as the DAC. As you probably know, loads of games actually do this.

Stereo output capability means that any of the sounds, FM or DAC, may be directed to the left, the right, or both outputs. The stereo is output only through the headphone jack.

The LFO, or Low Frequency Oscillator, allows for amplitude and/or frequency distortions of the FM sounds. Each channel elects the degree to which it will be distorted by the LFO, if at all. This could be used, for example, in a guitar solo.

Finally, the system has two software timers, which may be used as an alternative to the Z80 VBLANK interrupt. Unfortunately, these timers do not cause interrupts - they must be read by the software to determine if they have finished counting.

Register overview

The system is controlled by means of a large number of registers. General system registers are:

timer values and status, software use

LFO enable and frequency, to distort the FM channels

DAC enable and amplitude

output enables for each of the 6 FM channels

number of frequencies to be used in FM channels 3 and 6 Usually, an FM channel has only one overall frequency, but if so elected, FM channels 3 and 6 use four separate frequencies, one for each operator.

The remainder of the registers apply to a single FM channel, or to an operator in that channel. Registers that refer to the channel as a whole are:

frequency number (in the standard case)

algorithm number

extent of self-feedback in operator 1

output type, to L, R, or both speakers. This can only be heard if headphones are used.

the extent to which the channel is distorted by the LFO.

Registers that refer to each operator make up the remainder. The four operator’s connections are determined by the algorithm used, but the envelope is always specified individually for each operator. In the case of FM channels 3 and 6, the frequency may be specified individually for each operator.

Envelope specification

The sound starts when the key is depressed, a process called ‘key on’. The sound has an attack, a strong primary decay, followed by a slow secondary decay. The sound continues this secondary decay until the key is released, a process called ‘key off’. The sound then begins a rapid final decay, representing for example a piano note after the key has been released and the damper has come down on the strings.

The envelope is represented by the above amplitudes and angles, and a few supplementary registers. Used in the above diagram are:

TL

Total level, the highest amplitude of the waveform.

AR

Attack rate, the angle of initial amplitude increase. This can be made very steep if desired. The problem with slow attack rates is that if the notes are short, the release (called ‘key off’) occurs before the note has reached a reasonable level.

Rate scaling, the degree to which envelopes become shorter as frequencies become higher. For example, high notes on a piano fade much more quickly than low notes.

AM

Amplitude Modulation enable, whether or not this operator will allow itself to be modified by the LFO. Changing the amplitude of the slots (those colored gray in the diagram on page 3) changes the loudness of the note; changing the amplitude of the other operators changes its flavor.

SSG-EG

A proprietary register whose usage is unknown. It should be set to 0.

The YM-2612 may be accessed from either the 68000 or the Z80. In both cases, however, the bus is only 8 bits wide.

The YM-2612 is accessed through memory locations 4000H - 4003H in the Z80 case, or A04000H - A04003H in the 68000 case. These will be referred to as 4000 to 4003.

The internal registers of the FM-2612 are divided as follows:

To write to Part I, write the 8 bit address to 4000 and the data to 4001. To write to Part II, write the 8-bit address to 4002 and the data to 4003.

CAUTION: Before writing, read from any address to determine if the YM-2612 I/O is still busy from the last write. Delay until bit 7 returns to 0.

CAUTION: in the case of registers that are “ganged together” to form a longer number, for example the 10-bit Timer A value or the 14-bit frequencies, write the high register first.

A sensitivity enable on a channel by channel basis, in registers B4H-B6H.

An amplitude enable on an operation by operation basis, in registers 60H-6EH.

If the LFO is desired, enable it by register 22H. Next, select which channels will be affected by the LFO, to what degree, and whether their amplitude or frequency is
affected, by setting registers B4-B6H. Finally. if a channel’s amplitude is affected, make sure that it is only the “slots” that are affected by setting registers 60H - 6EH.

A normal channel’s operators use offsets of integral multiples of a single frequency. In special mode, each operator has an entirely separate frequency. Channel 3 operator 1′s frequency is in registers A2 and A6. Operators 2 to 4 are in registers A8 and AC, A9 and AD, and AA and AE respectively.

No one at Sega has used the timer feature, but the Japanese manual says:

Load

1 starts the timer, 0 stops it.

Enable

1 causes timer overflow to set the read register flag. 0 means the timer keeps cycling without setting the flag.

Register 28H - Key on/off

D7

D6

D5

D4

D3

D2

D1

D0

28H

Operator

Channel

4

3

2

1

This register is used for “Key on” and “Key off”. “Key on” is the depression of the synthesizer key, “Key off” is its release. The sequence of operations is: set parameters, Key on, wait, key off. When key off occurs, the FM channel stops its slow decline and starts the rapid decline specified by “RR”, the release rate.

In a single write to register 28H, one sets the status of all operators for a single channel. Sega always sets them to the same value, on (1) or off (0). Using a special channel 3, I believe it is possible to have each operator be a separate note, so there is possible justification for turning then on and off separately.

D2

D1

D0

Channel

0

0

0

1

0

0

1

2

0

1

0

3

1

0

0

4

1

0

1

5

1

1

0

6

Registers 2AH & 2BH - DAC

D7

D6

D5

D4

D3

D2

D1

D0

2AH

DAC

2BH

DAC en

Register 2AH contains 8 bit DAC data.

If the DAC enable is 1, the DAC data is output as a replacement for channel 6. The only Channel 6 register that affects the DAC is the stereo output portion of register B4H.

Registers 30H - 90H are all single-operator registers. Please see page 8 for how the twelve channel-operator combinations are arranged.

Register 30H+ - detune & multiple

D7

D6

D5

D4

D3

D2

D1

D0

30H+

DT1

MUL

Both DT1 (detune) and MUL (multiple) relate the operator’s frequency to the overall frequency.

MUL ranges from 0 to 15 (decimal), and multiplies the overall frequency, with the exception that 0 results in multiplication by 1/2. That is, MUL=0 to 15 gives ×1/2, ×1, ×2, ... ×15.

DT1 gives small variations from the overall frequency × MUL. The MSB of DT1 is a primitive sign bit, and the two LSB’s are magnitude bits. See the next page for a diagram.

The frequency’s top five bits (3 octave bits and 2 note bits) are called KC (Key code) in the following rate formulae:

RS

Final rate

0

2×Rate+(KC/8)

1

2×Rate+(KC/4)

2

2×Rate+(KC/2)

3

2×Rate+(KC/1)

(KC/n) is always rounded down

As Rate ranges from 0-31, this means that the RS influence ranges from small (at 0-3) to very large (at 0-31).

Register 60H+ - first decay rate; amplitude modulation

D7

D6

D5

D4

D3

D2

D1

D0

60H+

AM

D1R

D1R (first decay rate) is the initial steep amplitude decay rate (see page 4). It is, like all rates, 0-31 in value and affected by RS.

AM is the amplitude modulation enable, whether of not this operator will be subject to amplitude modulation by the LFO. This bit is not relevant unless both the LFO is enabled and register B4′s AMS (amplitude modulation sensitivity) is non-zero.

Register 70H+ - secondary decay rate

D7

D6

D5

D4

D3

D2

D1

D0

70H+

D2R

D2R (secondary decay rate) is the long tail off of the sound that continues as long as the key is depressed.

This section not found in the linked scans

Register 80H+ - secondary amplitude; release rate

D7

D6

D5

D4

D3

D2

D1

D0

80H+

D1L

RR

D1L is the secondary amplitude reached after the first period of rapid decay. It should be multiplied by 8 if one wishes to compare it to TL. Again as TL, the higher the number, the more attenuated the sound.

RR is the release rate, the final sharp decrease in volume after the key is released. All rates are 5 bit numbers, but there are only four bits available in the register. Thus, for comparison and calculation purposes, these four bits are the MSBs and the LSB is always 1. In other words, double it and add one.

Back to the scans...

Register 90H+ - proprietary

D7

D6

D5

D4

D3

D2

D1

D0

90H+

SSG-EG

This register is proprietary and should be set to zero.

The final registers relate mostly to a single channel. Each register is tripled; please see the diagram on page 9.

Registers A0H-AFH - frequency

Channel 1′s frequency is in A0 and A4H.Channel 2′s frequency is in A1 and A5H.Channel 3′s frequency, if it is in normal mode (please see page 12), is in A2 and A6H.

If Channel 3 is in special mode:Operator 1′s frequency is in A2 and A6HOperator 2′s frequency is in A8 and ACHOperator 3′s frequency is in A9 and ADHOperator 4′s frequency is in AA and AEH

The frequency is a 14-bit number that should be set high byte, low byte (e.g. A4H then A0H). The highest 3 bits, called the “block”, give the octave. The next 10 bits give the position in the octave, and a possible 12-tone sequence is:

AMS (amplitude modulation sensitivity) and FMS (frequency modulation sensitivity) are the degree to which the channel is affected by the LFO. If the LFO is disabled. this register need not be set. Additionally, amplitude modulation is also enabled on an operator-by-operator level.