The Famicom cartridge connector has an audio return loop. A cartridge can send extra sound out through it and the console mixes it with the 2A03’s own output. (The NES connector has no such pins.) Six chips did this. Each sits on a mapper, so its registers are the mapper’s registers. Bit patterns have bit 7 on the left. This page follows the NESdev Wiki pages named under Sources.
| Chip | Mapper | Extra sound |
|---|---|---|
| Konami VRC6 | 24 and 26 | 2 pulse, 1 sawtooth |
| Konami VRC7 | 85 | 6 channels of 2-operator FM |
| Famicom Disk System | 20 (disk drive, not a cartridge) | 1 wavetable channel with modulation |
| Nintendo MMC5 | 5 | 2 pulse, 1 PCM |
| Namco 163 | 19 (the related chips 175 and 340 have no sound) | up to 8 wavetable channels |
| Sunsoft 5B | 69 | 3 square tone channels, noise, envelope |
Konami VRC6
Two pulse channels and a sawtooth. They work much like the APU pulse channels. On some boards the address lines A0 and A1 are swapped, so for mapper 26 (Madara, Esper Dream 2) the registers $x001 and $x002 change places. The addresses below are those of mapper 24 (Akumajou Densetsu).
| Base | +0 | +1 | +2 | +3 |
|---|---|---|---|---|
$9000 | Pulse 1 duty and volume | Pulse 1 period low | Pulse 1 period high | Frequency scaling |
$A000 | Pulse 2 duty and volume | Pulse 2 period low | Pulse 2 period high | |
$B000 | Saw rate | Saw period low | Saw period high | (the mirroring register) |
| Register | Bits | Meaning |
|---|---|---|
$9003 | .... .ABH | Frequency control. H halts all oscillators. B is 16 times the frequency (a 4-bit right shift of the period). A is 256 times (an 8-bit shift). H beats the others and A beats B. Write $00 once at start-up; the three original games do. |
$9000, $A000 | MDDD VVVV | Pulse: M ignores the duty (always on), DDD duty, VVVV volume. |
$B000 | ..AA AAAA | Sawtooth accumulator rate (acts as the volume). |
$9001, $A001, $B001 | FFFF FFFF | Period, low 8 bits. |
$9002, $A002, $B002 | E... FFFF | E enables the channel. FFFF is the period, high 4 bits. |
The pulse duty is 16 steps counting from 15 to 0. The volume is output while the step is at most D, so D = 0 is 1/16 and D = 7 is 8/16 (50%); M gives 100%. The pulse frequency is CPU ÷ (16 × (t + 1)) with the 12-bit period t. The saw adds A to an 8-bit accumulator every second clock and outputs its top 5 bits. The accumulator resets on the seventh clock after six adds, so A above 42 wraps and distorts. Its frequency is CPU ÷ (14 × (t + 1)). Clearing E silences the channel, resets the pulse duty and zeroes the saw. The output is a linear 6-bit DAC sum of the two 4-bit pulses and the 5-bit saw. VRC6 pulses sound inverted compared with APU pulses of the same duty. (NESdev Wiki, “VRC6 audio”.)
Konami VRC7
Six channels of two-operator FM synthesis, a cut-down Yamaha YM2413 (OPLL) with a fixed set of patches. Only Lagrange Point uses it. Tiny Toon Adventures 2 has the chip but not the audio circuit.
| Address | Meaning |
|---|---|
$E000 | Bit 6 (S) resets the expansion sound: it is silenced and its registers are cleared (the vibrato LFO is not). Writes to $9010 and $9030 are ignored while it is set. The other bits are the mirroring and WRAM controls. |
$9010 (write) | Selects an internal register. Wait at least 6 CPU cycles before the next write to $9030 or $9010. |
$9030 (write) | Writes the selected register. Wait at least 42 CPU cycles before the next write to either port. |
| Internal register | Bits | Meaning |
|---|---|---|
$00 | TVSK MMMM | Custom patch, modulator: tremolo, vibrato, sustain, key rate scaling, frequency multiplier. |
$01 | TVSK MMMM | Custom patch, carrier: the same fields. |
$02 | KKOO OOOO | Modulator key level scaling and output level (0.75 dB steps). |
$03 | KK-Q WFFF | Carrier key level scaling, carrier waveform (Q), modulator waveform (W): 0 sine, 1 half-wave; feedback (F). |
$04, $05 | AAAA DDDD | Modulator, carrier: attack and decay rates (0 halts, F is fastest). |
$06, $07 | SSSS RRRR | Modulator, carrier: sustain level (3 dB steps) and release rate. |
$0F | low 4 bits | Test register: bit 0 forces both envelopes to full volume, bit 1 holds both LFOs at zero, bit 2 holds the wave phase at zero, bit 3 updates the LFOs every sample. |
$10–$15 | LLLL LLLL | Channel frequency, low 8 bits. |
$20–$25 | --ST OOOH | Channel: sustain (S), trigger (T, 0 to 1 is key-on, 1 to 0 is key-off), octave (OOO), frequency bit 8 (H). |
$30–$35 | IIII VVVV | Channel instrument (0 is the custom patch) and volume (F is the quietest, 0 the loudest, 3 dB steps). |
Frequency multiplier M: 0 gives ½, 1 to 9 give 1 to 9, A and B give 10, C and D give 12, E and F give 15. Feedback F gives a modulation index of 0, π/16, π/8, π/4, π/2, π, 2π, 4π. The pitch is 49,716 Hz × freq ÷ 2(19 − octave). The chip runs from its own 3.58 MHz oscillator and updates all channels every 72 clocks. When the sustain bit in $2X is set, the patch release value is replaced by 5. Other register numbers are ignored. The fixed instrument patches are listed on the wiki page and are not copied here. (NESdev Wiki, “VRC7 audio”.)
Famicom Disk System
The 2C33 chip on the disk drive’s RAM adapter makes one wavetable channel with a modulator, in the style of the Game Boy’s channel 3 but with more modulation. The registers are in the CPU’s $4020–$40FF space.
| Address | Bits | Meaning |
|---|---|---|
$4023 | Wxxx xxSD | Master I/O enable. D enables the disk I/O registers. S enables the sound registers (0 resets the audio). W enables DRAM refresh watchdog interrupts. The BIOS writes $00 then $83. |
$4040–$407F | OOSS SSSS | Wavetable RAM: 64 steps of 6 bits. Writable only when $4089 bit 7 is set. When not writable a read returns the sample at the current wave position. The top two bits read as 01. |
$4080 | MDVV VVVV | Volume envelope: M is 0 for envelope mode on (VV VVVV is the speed) and 1 for off (the value is the gain and speed); D is the direction (0 down, 1 up). Gain runs 0–63, values above 32 count as 32. The BIOS writes $80. |
$4082 | FFFF FFFF | Wave frequency, low 8 bits. |
$4083 | MExx FFFF | Frequency bits 8–11. E disables the volume and modulator envelopes. M halts the wave and the mod table accumulator and makes the envelopes four times faster. |
$4084 | MDSS SSSS | Modulator envelope, in the same form as $4080. |
$4085 | xBBB BBBB | The 7-bit signed modulator counter ($40 to $3F). Writing it while the modulator runs detunes the note. |
$4086 | FFFF FFFF | Modulation frequency, low 8 bits. A frequency of 0 stops the mod table counter. |
$4087 | HFxx FFFF | Modulation frequency bits 8–11. F forces a carry every clock. H (bit 7) resets the mod accumulator and permits writes to the mod table. |
$4088 | xxxx xMMM | Mod table write: a ring of 32 entries, advanced by each write. Only works while the modulator is disabled by $4087 bit 7. Write all 32 entries at once. |
$4089 | Wxxx xxVV | W enables wavetable writes and holds the output. VV is the master volume: 0 full, 1 2/3, 2 2/4, 3 2/5. |
$408A | SSSS SSSS | Envelope speed multiplier (0 disables the envelopes). The BIOS writes $E8. |
$4090 (read) | OOVV VVVV | Current volume gain. |
$4091 (read) | AAAA AAAA | Wave accumulator bits 12–19. |
$4092 (read) | OOVV VVVV | Current modulator gain. |
$4093 (read) | OAAA AAAA | Mod table address accumulator bits 5–11. |
$4094 (read) | MMMM MMMM | Bits 4–11 of the intermediate result of mod counter times gain. |
$4095 (read) | ???? MMMM | The next mod counter increment, from the table 0, 1, 2, 3, 4, 5, 6, 7 mapped to 0, 1, 2, 4, $C, $C, $E, $F. |
$4096 (read) | OOVV VVVV | The wavetable value at the current position, after the volume PWM. |
$4097 (read) | OCCC CCCC | The current mod counter value. |
Registers $4040–$407F, $4082–$4084, $4086, $4087, $4089, $408A and $4090–$4097 stay accessible even when the audio is reset. The wiki marks several details of the audio reset and the unit timing as still unknown; they are not repeated here. (NESdev Wiki, “FDS audio”.)
Nintendo MMC5
Two pulse channels and an 8-bit PCM channel. The pulse channels work like the APU’s with these differences: there is no $5001/$5005 sweep register, periods below 8 are not muted (they can reach ultrasonic pitches), the length counter runs twice as fast, and the envelope and length counter use a fixed rate of about 240 Hz (the M2 clock divided by 7,424 gives 241.079 Hz; not confirmed on a bench). The polarity of all MMC5 channels is the opposite of the APU’s.
| Address | Meaning |
|---|---|
$5000–$5003 | Pulse 1, laid out like $4000–$4003 without a sweep. Write only. |
$5004–$5007 | Pulse 2, the same. |
$5010 | PCM mode and IRQ. Write: bit 0 mode (0 write mode, 1 read mode), bit 7 enables the PCM IRQ. Read: bit 0 is the revision (0 for the letterless MMC5, 1 for the MMC5A) and bit 7 is the IRQ flag. A read acknowledges the IRQ. |
$5011 | Raw PCM, 8 bits, write only (in write mode). Writing 0 leaves the output unchanged and sets the IRQ trip instead. Only Shin 4 Nin Uchi Mahjong uses it. |
$5015 | Status, like $4015 but only the low two bits (the two pulse channels). |
In read mode the DAC takes a byte read from $8000–$BFFF instead, which makes a tighter unrolled loop; reading a 0 sets the IRQ trip. The chip’s length counter table has seven bits, with the lowest always 0, and otherwise equals the NTSC APU table. The PCM channel is as loud as the APU for the same input and can be twice as loud using the high bit. (NESdev Wiki, “MMC5 audio”.)
Namco 163
Up to eight wavetable channels. The chip has $80 bytes of sound RAM shared by the channel registers and the waveforms. Mappers 175 and 340 do not have the sound. The chip updates one channel every 15 CPU cycles, so with more channels each one is updated less often: lower pitch for the same frequency value, and a whine at the switching rate. Most games use 4 channels. Only King of Kings and Erika to Satoru no Yume Bouken use all eight.
| Address | Bits | Meaning |
|---|---|---|
$E000–$E7FF | .SPP PPPP | PRG bank at $8000–$9FFF (PPPPPP) and S, which disables sound when set. |
$F800–$FFFF (write) | IAAA AAAA | Sound RAM address. I turns on auto-increment after each data port access (it stops at $7F). |
$4800–$4FFF | DDDD DDDD | Data port: reads and writes the sound RAM byte at the address. Do not read with auto-increment while the DMC plays, or bytes are lost to the DMA double-read bug; writing is fine. |
Each channel uses 8 bytes of sound RAM. Channel 8 is at $78–$7F, channel 7 at $70, and so on down to channel 1 at $40. Unused channel registers can hold waveform data.
| Offset (channel 8) | Bits | Meaning |
|---|---|---|
+0 ($78) | FFFF FFFF | Frequency, bits 0–7. |
+1 ($79) | PPPP PPPP | Phase, bits 0–7. |
+2 ($7A) | FFFF FFFF | Frequency, bits 8–15. |
+3 ($7B) | PPPP PPPP | Phase, bits 8–15. |
+4 ($7C) | LLLL LLFF | Waveform length (256 − LLLLLL00 samples, that is (64 − L) × 4) and frequency bits 16–17. The Namco 129 never had a game with sound; on it this register is only the length, any number of samples. |
+5 ($7D) | PPPP PPPP | Phase, bits 16–23: the current sample position. |
+6 ($7E) | AAAA AAAA | Waveform address in 4-bit samples (two per byte, low nibble first). |
+7 ($7F) | .CCC VVVV | Linear volume. CCC (at $7F only) gives the number of enabled channels minus one: 0 enables channel 8 only, 1 enables 8 and 7, and so on. |
Every 15 CPU cycles one channel adds its 18-bit frequency to its 24-bit phase, modulo length × 65,536. The output is (sample at ((phase ÷ 65,536 + offset) AND $FF) − 8) × volume, held until that channel’s next turn. The pitch is (CPU × freq) ÷ (15 × 65,536 × length × channels). With 1 to 8 channels each channel updates at 119.318, 59.659, 39.773, 29.830, 23.864, 19.886, 17.045 or 14.915 kHz on NTSC. The relative loudness varies between games, from about 11 to 19.5 dB louder than the APU; submappers of mapper 19 record this. (NESdev Wiki, “Namco 163 audio”.)
Sunsoft 5B
The 5B is the Sunsoft FME-7 (mapper 69) plus a sound unit. The sound is a Yamaha YM2149F (a variant of the General Instrument AY-3-8910) and was used in one game, Gimmick!, which did not use the noise or envelope, so emulators often implement them only partly. Two registers reach the sound chip, in the style of the VRC7: first select, then write.
| Address | Bits | Meaning |
|---|---|---|
$C000–$DFFF | DDDD RRRR | Audio register select: RRRR is the internal register for the next write to $E000. If DDDD is not 0, writes to $E000 are disabled (as on the YM2149F). |
$E000–$FFFF | VVVV VVVV | Audio register write: the 8-bit value for the selected register. |
| Register | Bits | Meaning |
|---|---|---|
$00, $02, $04 | LLLL LLLL | Channel A, B, C period, low 8 bits. |
$01, $03, $05 | ---- HHHH | Channel A, B, C period, high 4 bits. |
$06 | ---P PPPP | Noise period. |
$07 | --CB Acba | Mixer: C, B, A disable noise on that channel; c, b, a disable tone on that channel (0 enables, 1 disables). |
$08, $09, $0A | ---E VVVV | Channel A, B, C: E selects envelope volume, VVVV is the volume. |
$0B | LLLL LLLL | Envelope period, low byte. |
$0C | HHHH HHHH | Envelope period, high byte. |
$0D | ---- CAaH | Envelope reset and shape: continue, attack, alternate, hold. |
$0E, $0F | I/O ports A and B (unused). |
The sound runs from the CPU clock (1.789773 MHz) like a YM2149F with its SEL pin low, so tone and noise run at half the speed of an AY-3-8910 on the same clock. Unlike the APU pulse channels, the period is not increased by 1; a period of 0 acts as 1. A counter counts up every 16th clock until it reaches the period, then the output flips. Shortening the period can therefore flip the output at once. None of the generators can be halted.
- Tone: frequency = clock ÷ (32 × period). The output toggles every 16 clocks. With both the noise and tone bits of a channel in
$07set to 1, the channel gives a constant level; with both 0, the result is the AND of noise and tone. The tone volume 0 is silent. - Noise: frequency = clock ÷ (32 × period), a new random bit every 32 clocks, from a 17-bit linear feedback shift register with taps at bits 16 and 13.
- Envelope: a 5-bit ramp. Step frequency = clock ÷ (16 × period). The ramp has 32 steps, so a continued sawtooth sounds at 1/32 of the step frequency and a continued triangle at 1/64. Level 31 equals volume 15. Each 2 steps down is one volume step (levels 0 and 1 are both silent), 1.5 dB per step.
| Shape value | Continue | Attack | Alternate | Hold | Result |
|---|---|---|---|---|---|
$00–$03 | 0 | 0 | x | x | Falls once, then silent |
$04–$07 | 0 | 1 | x | x | Rises once, then silent |
$08 | 1 | 0 | 0 | 0 | Falling sawtooth, repeating |
$09 | 1 | 0 | 0 | 1 | Falls once, then silent |
$0A | 1 | 0 | 1 | 0 | Triangle, starting down |
$0B | 1 | 0 | 1 | 1 | Falls once, then holds at the top |
$0C | 1 | 1 | 0 | 0 | Rising sawtooth, repeating |
$0D | 1 | 1 | 0 | 1 | Rises once, then holds at the top |
$0E | 1 | 1 | 1 | 0 | Triangle, starting up |
$0F | 1 | 1 | 1 | 1 | Rises once, then silent |
Writing register $0D resets the envelope. The three tone channels each give a 5-bit signal, converted by a logarithmic DAC at 1.5 dB per step of the 5-bit value (the lowest bit cannot be set by the 4-bit volume). Some emulators treat it as 4 bits at 3 dB per step, which does not matter for Gimmick!. The channels are mixed linearly and added to the 2A03 output. The sound is loud compared with other expansion chips. The amplifier is non-linear at high amplitudes and filters the sound a little. (NESdev Wiki, “Sunsoft 5B audio”, which backs the $C000 and $E000 register rows of mapper 69 in the viewer.)
Sources
- NESdev Wiki: VRC6 audio
- NESdev Wiki: VRC7 audio
- NESdev Wiki: FDS audio
- NESdev Wiki: MMC5 audio
- NESdev Wiki: Namco 163 audio
- NESdev Wiki: Sunsoft 5B audio
The NESdev Wiki text is available under CC BY-SA 3.0. This page is written in our own words. The VRC7 fixed patch set and the FDS unit-tick, frequency and mixing sections are only on the wiki pages.