The Konami VRC7 is a mapper (iNES 85) and also a six-channel, two-operator FM synthesiser.
It is a cut-down relative of the Yamaha YM2413 (OPLL), with its own fixed set of
instrument patches. Only one game, Lagrange Point, uses the audio. Tiny Toon
Adventures 2 has the chip but not the sound circuit. The audio ports
($E000, $9010, $9030) are on
expansion audio. This page gives the
registers of the chip and the patch data.
Internal registers
The chip has 26 internal registers. $00–$07 define a custom patch that any channel can use as instrument 0. $10–$15, $20–$25 and $30–$35 control the six channels. Other values are ignored, except $0F, a test register.
Custom patch
| Register | Bits | Meaning |
|---|---|---|
$00 | TVSK MMMM | Modulator: tremolo (T), vibrato (V), sustain (S), key rate scaling (K), multiplier (M) |
$01 | TVSK MMMM | Carrier: tremolo, vibrato, sustain, key rate scaling, multiplier |
$02 | KKOO OOOO | Modulator key level scaling (K), output level (O) |
$03 | KK-Q WFFF | Carrier key level scaling (K), unused, carrier waveform (Q), modulator waveform (W), feedback (F) |
$04 | AAAA DDDD | Modulator attack (A), decay (D) |
$05 | AAAA DDDD | Carrier attack, decay |
$06 | SSSS RRRR | Modulator sustain level (S), release (R) |
$07 | SSSS RRRR | Carrier sustain level, release |
The patch is a two-operator FM unit: the carrier makes the tone and the modulator’s output modulates its frequency.
- Tremolo (T): amplitude modulation at a fixed rate. Vibrato (V): pitch modulation at a fixed rate.
- Sustain (S): whether the operator uses the sustain part of its envelope.
- Key rate scaling (K): faster envelopes for high frequencies, slower for low.
- Multiplier (MMMM): multiplies the operator’s frequency; see the table below.
- Key level scaling (KK): attenuates the operator at higher frequencies; 0 is none, 3 the most.
- Modulator output level (
$02O): reduces the modulator volume in 0.75 dB steps. - Waveform (Q for carrier, W for modulator): 0 is a sine, 1 a half-wave rectified sine (values below 0 clipped to 0).
- Feedback (FFF): applied to the modulator, see the table below.
- Attack (A): speed of the fade-in after key on. 0 halts, 1 is slowest, F fastest. Decay (D): speed of the fade to the sustain level; same scale.
- Sustain level (S): attenuation after decay, in 3 dB steps. 0 is the highest volume, F the lowest. Release (R): speed of the fade to silence; 0 halts, 1 is slowest, F fastest.
If a note is released before attack or decay finish, release starts from the current level. If the operator’s sustain bit is not set, release starts right after decay. If the channel’s sustain bit ($2X S) is set, the patch’s release value is ignored and replaced by 5. The modulator’s sustain bit also turns off the release part of its envelope: with it set, the modulator keeps sustaining while the carrier releases. The carrier always releases on key off.
| MMMM | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Multiplier | 1/2 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 10 | 12 | 12 | 15 | 15 |
| FFF | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|---|
| Modulation index | 0 | π/16 | π/8 | π/4 | π/2 | π | 2π | 4π |
Channels
| Registers | Bits | Meaning |
|---|---|---|
$10–$15 | LLLL LLLL | Low 8 bits of the frequency |
$20–$25 | --ST OOOH | Sustain (S), trigger (T), octave (O), high bit of the frequency (H) |
$30–$35 | IIII VVVV | Instrument (I), volume (V) |
Channel X uses $1X, $2X and $3X. The 8 bits of $1X and bit 0 of $2X make a 9-bit freq; with the 3-bit octave the output frequency is
49716 Hz * freq
F = -------------------
2^(19 - octave)
The chip is clocked by an external 3.58 MHz ceramic oscillator (roughly twice the NTSC NES CPU clock, but not synchronised with it). It takes 72 internal clocks to update all channels, so each channel is updated at 49716 Hz (about 36 CPU clocks). The channels are output in turn, not mixed, but the rate is too high to hear the difference. A write to $2X with the trigger bit changing from 0 to 1 starts a note; from 1 to 0 starts the release. If the bit does not change, nothing new happens. The volume in $3X is inverted: F is the quietest and 0 the loudest; there is no silent value, and steps are 3 dB.
Test register $0F (low 4 bits)
- Bit 0: envelope generators are replaced by a constant 0 output (full volume) for both operators; they keep running.
- Bit 1: hold the LFO phase at zero (halts, disables and resets the tremolo and vibrato LFOs).
- Bit 2: hold and reset the waveform phase to zero; envelopes keep running, but the output is silent.
- Bit 3: update the tremolo and vibrato LFOs on every sample instead of once every several samples (tremolo 64 times faster, vibrato 1024 times faster).
The internal patch set
There are 16 instrument numbers. Number 0 is the custom patch above. The other fifteen are fixed in the chip and cannot be changed. Their values were dumped with a VRC7 rewired into its debug mode (siliconpr0n’s “VRC7 Instrument ROM Dump”). Each patch is eight bytes with the layout of registers $00 to $07:
| Instrument | 00 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | Name |
|---|---|---|---|---|---|---|---|---|---|
| 0 | (custom patch, registers $00–$07) | Custom patch | |||||||
| 1 | 03 | 21 | 05 | 06 | E8 | 81 | 42 | 27 | Buzzy Bell |
| 2 | 13 | 41 | 14 | 0D | D8 | F6 | 23 | 12 | Guitar |
| 3 | 11 | 11 | 08 | 08 | FA | B2 | 20 | 12 | Wurly |
| 4 | 31 | 61 | 0C | 07 | A8 | 64 | 61 | 27 | Flute |
| 5 | 32 | 21 | 1E | 06 | E1 | 76 | 01 | 28 | Clarinet |
| 6 | 02 | 01 | 06 | 00 | A3 | E2 | F4 | F4 | Synth |
| 7 | 21 | 61 | 1D | 07 | 82 | 81 | 11 | 07 | Trumpet |
| 8 | 23 | 21 | 22 | 17 | A2 | 72 | 01 | 17 | Organ |
| 9 | 35 | 11 | 25 | 00 | 40 | 73 | 72 | 01 | Bells |
| A | B5 | 01 | 0F | 0F | A8 | A5 | 51 | 02 | Vibes |
| B | 17 | C1 | 24 | 07 | F8 | F8 | 22 | 12 | Vibraphone |
| C | 71 | 23 | 11 | 06 | 65 | 74 | 18 | 16 | Tutti |
| D | 01 | 02 | D3 | 05 | C9 | 95 | 03 | 02 | Fretless |
| E | 61 | 63 | 0C | 00 | 94 | C0 | 33 | F6 | Synth Bass |
| F | 21 | 72 | 0D | 00 | C1 | D5 | 56 | 06 | Sweep |
Example: Buzzy Bell, byte $00 = 03: modulator tremolo 0, vibrato 0, sustain 0, key rate scaling 0, multiplier 3. Byte $01 = 21: carrier tremolo 0, vibrato 0, sustain 1, key rate scaling 0, multiplier 1.
The ROM dump also shows three drum patches. They are thought to be left over from the YM2413 and cannot be played on the VRC7. Byte $07 of the snare drum (68) differs from the YM2413’s (48):
| Patch | 00 | 01 | 02 | 03 | 04 | 05 | 06 | 07 |
|---|---|---|---|---|---|---|---|---|
| Bass drum | 01 | 01 | 18 | 0F | DF | F8 | 6A | 6D |
| Snare drum / hi-hat | 01 | 01 | 00 | 00 | C8 | D8 | A7 | 68 |
| Tom / top cymbal | 05 | 01 | 00 | 00 | F8 | AA | 59 | 55 |
Differences from the YM2413
- The register layout is the same.
- The VRC7 has 6 channels, the OPLL 9 (the last three are FM or rhythm on the OPLL).
- The VRC7 has no rhythm channels, and its built-in instruments differ from the OPLL’s. Rhythm mode (register
$0E) is treated as always enabled, so only six FM channels are heard; with no rhythm DAC, the five rhythm channels are silent. - The VRC7 has no easily reached status register (it is write-only); the OPLL has an undocumented 2-bit internal state register.
- The VRC7 has one DAC and one output pin for all six channels; the OPLL has two (FM and rhythm).
Debug mode
Pin 15 of the VRC7 is an active-low input that switches on a debug mode. It allows dumping the instrument ROM, reading and writing the DAC value and reading serial data like the YM2413. It uses the CPU data bus with a changed pin use that does not fit the normal Famicom cartridge connector, and the pin is tied high on a cartridge, so the mode needs a hardware modification. Pins 2 and 47 select a high-level mode; pins 4, 16 and 28 change meaning with it.
| Mode | Pin 15 | Pin 47 | Pin 2 | Pin 28 | Pin 4 | Pin 16 | Data bus |
|---|---|---|---|---|---|---|---|
| Normal use (names) | /DEBUG = 1 | CPU M2 | PPU A13 | CPU A13 | CPU R/W | CPU A5 | |
| YM2413 no operation | 0 | 1 | 0 | 1 | x | x | |
| YM2413 write address | 0 | 1 | 0 | 0 | 0 | 0 | |
| YM2413 write data | 0 | 1 | 0 | 0 | 0 | 1 | |
| YM2413 read serial | 0 | 1 | 0 | 0 | 1 | 0 | ---- --DF |
| DAC test, override DAC | 0 | 0 | 0 | 0 | 0 | x | lower 8 bits |
| DAC query, read DAC | 0 | 1 | 1 | x | x | x | upper 8 bits |
| Instrument query: read instrument ROM 0 | 0 | 0 | 1 | 1 (/A2) | 1 (/A1) | 1 (/A0) | SSSS RRRR |
| Read instrument ROM 1 | 0 | 0 | 1 | 1 | 1 | 0 | AAAA DDDD |
| Read instrument ROM 2 | 0 | 0 | 1 | 1 | 0 | 1 | MMMM --KK |
| Read instrument ROM 3 | 0 | 0 | 1 | 1 | 0 | 0 | -FFF TVSK |
| Read instrument ROM 4 | 0 | 0 | 1 | 0 | 1 | 1 | OOOO OOQW |
With /DEBUG low, CPU A12 (pin 27) is an active-low reset for the YM2413 (instead of the active-high bit of $E000), so it must be high for the audio to run. In “Read serial” mode, data bit D0 gives the lower 9 bits of phase and envelope amplitude (as in the YM2413 self-test), D1 the DAC value, D2 to D7 are 0. In “Override DAC” the lower 8 bits of the DAC are driven from the external data bus until the mode is left. In instrument ROM reads the bits use the custom-patch legend and unmarked bits read as 0. In debug mode the rhythm bit of $0E can be cleared, allowing nine OPLL channels. The remaining instrument-query rows of the wiki table read 0.
Sources
- NESdev Wiki: VRC7 audio, which cites siliconpr0n’s instrument ROM dump and a forum post on later patch-set revisions
The NESdev Wiki text is available under CC BY-SA 3.0. This page is written in our own words from the raw wikitext kept in samples/nes/sources/hardware. The wiki mentions revisions of the patch set made in 2012, 2017 and 2018 (a forum thread); only the dumped values above are given here.