20
V1.01 08/31/99 teeny fix
21
V1.00 08/31/99 Complete Version
25
VRCVI (VRC6) (48 pin standard 600mil wide DIP)
27
This chip is used in such games as Konami's CV3j and Madara. It's unique
28
because it has some extra sound channels on it that get piped through the
29
Famicom (note this is a fami-only chip and you will not find one in any
30
NES game). "VI" of "VRCVI" is "6" for the roman numeral challenged.
33
This chip generates its audio via a 6 bit R2R ladder. This is contained
34
inside a 9 pin resistor network like so:
38
/------*-\/\/-*-\/\/-*-\/\/-*-\/\/-*-\/\/-*------*-\/\/-\
42
\ 6K \ 6K \ 6K \ 6K \ 6K \ 6K \ 6K | |
47
GND D0 D1 D2 D3 D4 D5 Aud In Aud Out
53
(s) means this pin connects to the System
54
(r) this only connects to the ROM
55
(w) this is a SRAM/WRAM connection only
56
AUD : these pass to the resistor network
57
CHR : these connect to the CHR ROM and/or fami's CHR pins
58
PRG : these connect to the PRG ROM and/or fami's PRG pins
59
WRAM : this hooks to the WRAM
60
CIRAM : the RAM chip which is on the fami board
64
AUD D1 - |02 47| - AUD D0
65
AUD D3 - |03 46| - AUD D2
66
AUD D5 - |04 45| - AUD D4
67
(s) PRG A12 - |05 44| - PRG A16 (r)
68
(s) PRG A14 - |06 43| - PRG A13 (s)
69
(s) M2 - |07 42| - PRG A17 (r)
70
(r) PRG A14 - |08 41| - PRG A15 (r)
71
*1 (s) PRG A1 - |09 40| - PRG A13 (r)
72
*1 (s) PRG A0 - |10 39| - PRG D7 (s)
73
(s) PRG D0 - |11 38| - PRG D6 (s)
74
(s) PRG D1 - |12 37| - PRG D5 (s)
75
(s) PRG D2 - |13 36| - PRG D4 (s)
76
(r) PRG /CE - |14 35| - PRG D3 (s)
77
(s) R/W - |15 34| - PRG /CE (s)
78
*2 (w) WRAM /CE - |16 33| - /IRQ (s)
79
(r) CHR /CE - |17 32| - CIRAM /CE (s)
80
(s) CHR /RD - |18 31| - CHR A10 (s)
81
(s) CHR /A13 - |19 30| - CHR A11 (s)
82
(r) CHR A16 - |20 29| - CHR A12 (s)
83
(r) CHR A15 - |21 28| - CHR A17 (r)
84
(r) CHR A12 - |22 27| - CHR A14 (r)
85
(r) CHR A11 - |23 26| - CHR A13 (r)
86
GND - |24 25| - CHR A10 (r)
93
*1: On some VRCVI carts, these are reversed. This affects some registers.
95
*2: This passes through a small pulse shaping network consisting of a
96
resistor, diode, and cap.
99
Registers: (sound related only)
102
regs 9000-9002 are for pulse channel #1
103
regs a000-a002 are for pulse channel #2
104
regs b000-b002 are for the phase accumulator channel (sawtooth)
106
(bits listed 7 through 0)
112
000 - 1/16th ( 6.25%)
113
001 - 2/16ths (12.50%)
114
010 - 3/16ths (18.75%)
115
011 - 4/16ths (25.00%)
116
100 - 5/16ths (31.25%)
117
101 - 6/16ths (37.50%)
118
110 - 7/16ths (43.75%)
119
111 - 8/16ths (50.00%)
121
V - Volume bits. 0000b is silence, 1111b is loudest. Volume is
122
linear. When in "normal" mode (see G bit), this acts as a general
123
volume control register. When in "digitized" mode, these act as a
126
G - Gate bit. 0=normal operation, 1=digitized. In digi operation,
127
registers 9001h and 9002h are totally disabled. Only bits 0-3 of
128
9000h are used. Whatever binary word is present here is passed on
129
as a 4 bit digitized output.
134
F - Lower 8 bits of frequency data
139
X - Channel disable. 0=channel disabled, 1=channel enabled.
141
F - Upper 4 bits of frequency data
144
A000h-A002h are identical in operation to 9000h-9002h. One note: this chip
145
will mix both digitized outputs (if the G bits are both set) into one
146
added output. (see in-depth chip operation below)
150
P - Phase accumulator input bits
154
F - Lower 8 bits of frequency data
158
X - Channel disable. 0=channel disabled, 1=channel enabled.
160
F - Upper 4 bits of frequency data
164
How the sounds are formed:
165
--------------------------
167
This chip is pretty cool. It outputs a 6 bit binary word for the sound
168
which is passed through a DAC and finally to the NES/Fami. Because of this,
169
the sound can be emulated *very* close to the original.
172
I used my scope to figure all this out as well as my meter and logic probe
173
so it should be 100% accurate.
177
Block diagrams of the VRCVI: (as reverse engineered by me)
178
----------------------------
181
| F bits | | D bits| | V bits |
182
| (12) | | (3) | | (4) |
183
\___________/ \_______/ \________/
184
+-----+ +----------------+ +-----------+ +------------+
186
| OSC |-->|Divider (12 bit)|-->| Duty Cycle|-->| AND array |(4)> chan out
187
|(M2) | | | | Generator | | |--/
188
+-----+ +----------------+ +-----------+ +------------+
194
One Pulse channel (both are identical)
195
--------------------------------------
198
How it works: The oscillator (in the NES, the clock arrives on the M2 line
199
and is about 1.78Mhz) generates our starting frequency. This is passed
200
first into a divide by 1 to 4096 divider to generate a base frequency.
201
This is then passed to the duty cycle generator. The duty cycle generator
202
generates the desired duty cycle for the output waveform. The "D" input
203
controls the duty cycle generator's duty cycle. If the "G" bit is
204
a "1", it forces the output of the duty cycle generator to a "1" also. If
205
the "X" bit is "0", it forces the output of the duty cycle generator to "0",
206
which effectively disables the channel. Note that this input has precidence
209
The AND array is just that- an array of 4 AND gates. If the output of
210
the duty cycle generator is a "0", then the "chan out" outputs will all be
211
forced to "0". If the output of the duty cycle generator is a "1", then
212
the chan out outputs will follow the V bit inputs.
214
Note that the output of this generator is a 4 bit binary word.
222
\___________/ \_______/
223
+-----+ +----------------+ +-----------+
225
| OSC |-->|Divider (12 bit)|-->| Phase |(5)> chan out
226
|(M2) | | | |Accumulator|--/
227
+-----+ +----------------+ +-----------+
233
The Sawtooth (ramp) channel
234
---------------------------
237
This one is pretty similar to the above when it comes to frequency selection.
238
The output frequency will be the same relative to the square wave channels.
239
OK, the tough part will be explaining the phase accumulator. :-) What it is
240
is just an adder tied to a latch. Every clock it adds a constant to the
241
latch. In the case of the VRCVI, what you do is this:
243
The ramp is generated over the course of 7 evenly spaced cycles, generated
244
from the divider. Every clock from the divider causes the phase accumulator
245
to add once. So... let's say we have 03h in the P bits. Every 7 cycles
246
the phase accumulator (which is 8 bits) is reset to 00h.
249
cycle: accumulator: chan out: notes:
250
-----------------------------------------
251
0 00h 00h On the first cycle, the acc. is reset to 0
252
1 03h 00h We add 3 to 0 to get 3
253
2 06h 00h We add 3 to 3 to get 6
258
7 00h 00h Reset the acc. back to 0 and do it again
261
This will look like so: (as viewed on an oscilloscope)
269
012345601234560123456-+
273
Note: if you enter a value that is too large (i.e. 30h) the accumulator
274
*WILL WRAP*. Yes, this doesn't sound very good at all and you no longer
278
The upper 5 bits of said accumulator are run to the "chan out" outputs.
279
The lower 3 bits are not run anywhere.
281
"X" disables the phase accumulator and forces all outputs to "0".
282
Note that the output of this generator is a 5 bit word.
287
Now that the actual sound generation is out of the way, here's how the
288
channels are combined into the final 6 bit binary output:
298
+---------+ +---------+ +---------+
299
| 4 Bit |--\ | 5 Bit | /--|Sawtooth |
300
| Binary |(5)>| Binary |<(5)|Generator|
301
| Adder |--/ | Adder | \--| |
302
+---------+ +---------+ +---------+
315
The three channels are finally added together through a series of adders
316
to produce the final output word. The two pulse chans are most likely added
317
first since they are 4 bit words, and that 5 bit result is most likely
318
added to the sawtooth's output. (The actual adding order is not known,
319
but I can make a *very* good guess. The above illustrated way uses the least
320
amount of transistors). In the end it does not matter the order in which
321
the words are added; the final word will always be the same.
323
The final 6 bit output word is run through an "R2R" resistor ladder which
324
turns the digital bits into a 64 level analog representation. The ladder
325
is binarally weighted and works like the DAC on your soundcard. :-)
326
(so take heart emulator authours: just run the finished 6 bit word to
327
your soundcard and it will sound right ;-).
331
Frequency Generation:
332
---------------------
334
The chip generates all its output frequencies based on M2, which is
335
colourburst divided by two (1789772.7272Hz). This signal is passed
336
directly into the programmable dividers (the 12 bit frequency regs).
341
These take the output of the programmable divider and then run it through
342
the duty cycle generator, which in the process of generating the duty cycle,
343
divides the frequency by 16.
346
To calculate output frequency:
349
Fout = ----------------
353
This will tell you the exact frequency in Hz. (note that the * 16 is to
354
compensate for the divide by 16 duty cycle generator.)
359
This is similar to the above, however the duty cycle generator is replaced
360
with a phase accumulator which divides the output frequency by 14.
363
To calculate output frequency:
366
Fout = ----------------
370
This will tell you the exact frequency in Hz. (note that the * 14 is to
371
compensate for the phase accumulator.)
375
So how accurate is this info, anyways?
376
--------------------------------------
378
I believe the info to be 100% accurate. I have extensively tested the
379
output of the actual VRCVI chip to this spec and everything fits perfectly.
380
I did this by using a register dump and a QBASIC program I wrote which
381
takes the register dump and produces a WAV file. All frequency and
382
duty cycle measurements were taken with a Fluke 83 multimeter, and all
383
waveform data was culled from my oscilloscope measuring the real chip.