YM2612 Basics
This page is a browser-readable version of the early YM2612 notes in this repository. The focus is the minimum path from chip pins to a simple beep.
Pin Layout
+--()--+
GND | 1 24| 0M(CLK)
D0 | 2 23| Vcc
D1 | 3 22| A.Vcc
D2 | 4 21| MOL
D3 | 5 20| MOR
D4 | 6 19| A.GND
D5 | 7 18| A1
D6 | 8 17| A0
D7 | 9 16| /RD
? |10 15| /WR
/IC |11 14| /CS
GND |12 13| /IRQ
+------+
Pin Summary
GND: digital groundA.GND: analog ground for audio outputVcc: digital power supplyA.Vcc: analog power supply for audio outputMOL/MOR: left / right audio outputsD0-D7: 8-bit bidirectional data busA0/A1: port select pins/RD,/WR,/CS,/IRQ,/IC: control signals
A0 and A1
A0 and A1 select address/data access and port 0 / port 1.
A1=0, A0=0: address port 0A1=0, A0=1: data port 0A1=1, A0=0: address port 1A1=1, A0=1: data port 1
How chip.write() Maps to Pins
void ym2612::write(uint32_t offset, uint8_t data) is a simplified software interface.
offset = 0: address port 0offset = 1: data port 0offset = 2: address port 1offset = 3: data port 1
chip.write(0, 0x30); chip.write(1, 0x01);
This means: select register 0x30, then write 0x01 into it.
What We Do to Make a Beep
- Create a
ym2612object. - Reset the chip.
- Set operator parameters for channel 1.
- Set algorithm and stereo output.
- Set frequency.
- Send key on.
- Generate samples.
Key Register Groups
0x30-0x3c: detune and multiple0x40-0x4c: total level0x50-0x5c: attack rate0x80-0x8c: sustain level and release rate0xb0: algorithm and feedback0xb4: left/right output enable0xa4and0xa0: frequency0x28: key on / key off
Why Algorithm 7?
Algorithm 7 is a simple starting point because all 4 operators act as carriers. Every operator directly contributes to the output.