| 1 |
# Namco 163 |
| 2 |
|
| 3 |
## Summary |
| 4 |
|
| 5 |
- 1 to 8 voice wavetable |
| 6 |
- 4 bit unsigned |
| 7 |
- each waveforms are can be placed to anywhere in internal RAM, and its size is can be variable. |
| 8 |
- activated voice count can be changed any time, multiplexed output |
| 9 |
|
| 10 |
## Source code |
| 11 |
|
| 12 |
- n163.hpp: Base header |
| 13 |
- n163.cpp: Source emulation core |
| 14 |
|
| 15 |
## Description |
| 16 |
|
| 17 |
This chip is one of NES mapper with sound expansion, This one is by Namco. |
| 18 |
|
| 19 |
It has 1 to 8 wavetable channels, All channel registers and waveforms are stored to internal RAM. 4 bit Waveforms are freely allocatable, and its length is variables; its can be stores many short waveforms or few long waveforms in RAM. |
| 20 |
|
| 21 |
But waveforms are needs to squash, reallocate to avoid conflict with channel register area, each channel register size is 8 bytes per channels. |
| 22 |
|
| 23 |
Sound output is time division multiplexed, it's can be captured only single channels output at once. in reason, More activated channels are less sound quality. |
| 24 |
|
| 25 |
## Sound register layout |
| 26 |
|
| 27 |
``` |
| 28 |
Address Bit Description |
| 29 |
7654 3210 |
| 30 |
|
| 31 |
78-7f Channel 0 |
| 32 |
78 xxxx xxxx Channel 0 Pitch input bit 0-7 |
| 33 |
79 xxxx xxxx Channel 0 Accumulator bit 0-7 |
| 34 |
7a xxxx xxxx Channel 0 Pitch input bit 8-15 |
| 35 |
7b xxxx xxxx Channel 0 Accumulator bit 8-15 |
| 36 |
7c xxxx xx-- Channel 0 Waveform length, 256 - (x * 4) |
| 37 |
---- --xx Channel 0 Pitch input bit 16-17 |
| 38 |
7d xxxx xxxx Channel 0 Accumulator bit 16-23 |
| 39 |
7e xxxx xxxx Channel 0 Waveform base offset |
| 40 |
xxxx xxx- RAM byte (0 to 127) |
| 41 |
---- ---x RAM nibble |
| 42 |
---- ---0 Low nibble |
| 43 |
---- ---1 High nibble |
| 44 |
7f ---- xxxx Channel 0 Volume |
| 45 |
|
| 46 |
7f Number of active channels |
| 47 |
7f -xxx ---- Number of active channels |
| 48 |
-000 ---- Channel 0 activated |
| 49 |
-001 ---- Channel 1 activated |
| 50 |
-010 ---- Channel 2 activated |
| 51 |
... |
| 52 |
-110 ---- Channel 6 activated |
| 53 |
-111 ---- Channel 7 activated |
| 54 |
|
| 55 |
70-77 Channel 1 (Optional if activated) |
| 56 |
68-6f Channel 2 (Optional if activated) |
| 57 |
... |
| 58 |
48-4f Channel 6 (Optional if activated) |
| 59 |
40-47 Channel 7 (Optional if activated) |
| 60 |
``` |
| 61 |
|
| 62 |
Rest of RAM area are for 4 bit Waveform and/or scratchpad. |
| 63 |
|
| 64 |
## Waveform format |
| 65 |
|
| 66 |
Each waveform byte has 2 nibbles packed, fetches LSB first, MSB next. |
| 67 |
|
| 68 |
``` |
| 69 |
---- xxxx 4 bit waveform, LSB |
| 70 |
xxxx ---- Same as above, MSB |
| 71 |
``` |
| 72 |
|
| 73 |
Waveform address: Waveform base offset + Bit 16 to 23 of Accumulator, 1 LSB of result is nibble select, 7 MSB of result is Byte address in RAM. |
| 74 |
|
| 75 |
## Frequency calculation |
| 76 |
|
| 77 |
``` |
| 78 |
Frequency: Pitch input * ((Input clock * 15 * Number of activated voices) / 65536) |
| 79 |
``` |
| 80 |
|
| 81 |
## Technical notice |
| 82 |
|
| 83 |
This core only outputs raw output from chip (or accumulated output, see below); any kind of off-chip stuff needs to implemented outside core. |
| 84 |
|
| 85 |
There's to way for reduce N163 noises: reduce channel limit and demultiplex: |
| 86 |
|
| 87 |
- Channel limit is runtime changeable and it makes some usable effects. |
| 88 |
- Demultiplex is used for "non-ear destroyable" emulators, but less hardware accurate. (when LPF and RF filter is not considered) This core is support both, You can choose output behavior |