Codec Call Tables & BANK_06 Audio Format
Spoke of SPECIFICATIONS.md · Structural specification for
BANK_05transceiver frequencies and room call tables,BANK_06volume envelopes, note periods, and132sound/BGM descriptors, plusPRG_FIXED_07dmc[0]. Verified by decode_codec_and_audio.py.
1. BANK_05 Codec Frequencies & Room Call Tables ($B97C, $BB65/$BC65)
- Codec Frequency LUT (
$B97C..$B982,7bytes):7BCD-packed frequency channel bytes[0x0D, 0x10, 0x5B, 0x30, 0x4F, 0x55, 0x21]matched against ZP$46inBANK_05($B6F4,$B876), terminated by$FFat$B98A. - Room Call Pointer Tables (
$BB65..$BD62,255pointers): Split across$BB65(128entries for rooms0x00..0x7F) and$BC65(127entries for rooms0x80..0xFE), deduplicating to75unique call tables ($BD63..$BE69): - Call Table Record:
1-byteentryCount(0= no incoming/outgoing call triggers), followed byentryCount2-byte(headerByte, msgId)pairs (116total entries across255rooms, referencing72uniquemsgIds in0x02..0x9F). - Header Byte Bitfields: Bits
0..2(& 0x07) select the1-based contact slot (1..7->$B97Cindexslot - 1), while bits6..7(& 0xC0) select trigger/auto-ring mode (0x40manual,0x80/0xC0event/auto call). - Message Cross-Reference: Every
msgIdresolves cleanly intoBANK_00$BDFA/$BEFA(< 160) to an$FF-terminated byte span without extracting retail prose.
2. BANK_06 Volume Envelopes ($91EE, 5 Envelopes)
BANK_06 ($93EF) reads 5 little-endian u16 pointers from $91EE..$91F7, masking each frame sample with & 0x1F until hitting loop/end marker >= $FE ($FF terminator across all 5 envelopes):
| Envelope ID | Pointer | Sample Bytes | Terminator |
|---|---|---|---|
0 |
$B09B |
8 |
$FF |
1 |
$B5D6 |
10 |
$FF |
2 |
$B1EA |
63 |
$FF |
3 |
$AAC2 |
10 |
$FF |
4 |
$BA78 |
17 |
$FF |
3. BANK_06 APU Note Period LUT ($9923, 12 Chromatic Semitones)
BANK_06 ($961D) reads 12 little-endian u16 RP2A03 timer periods at $9923..$993A (base octave divided by right-shifting in $962D by octave index $03E0,X):
| Note Index | 0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Period (Hex) | $06AE |
$064E |
$05F4 |
$059E |
$054E |
$0501 |
$04B9 |
$0476 |
$0436 |
$03F9 |
$03C0 |
$038A |
| Period (Dec) | 1710 |
1614 |
1524 |
1438 |
1358 |
1281 |
1209 |
1142 |
1078 |
1017 |
960 |
906 |
4. BANK_06 Sound & BGM Descriptor Table ($BC15, 132 Active Slots)
BANK_06 ($99A8) dispatches 8-bit sound command IDs against the 3-byte descriptor array at $BC15 ($9954):
- Boundary Commands: ID
$00and$86mute/stop playback ($9956); ID$85enables the$ED = $40soft DMC DAC ramp ($99BB); IDs>= $87return immediately. - Active Descriptors (
$01..$84,132entries at$BC15 + id * 3): - Byte
0(headerByte): bits0..2select channel (0..3BGM Pulse1/Pulse2/Tri/Noise,4..5SFX overrides), bits3..4(>> 3 & 3) specify additional consecutive channel descriptors (0..3) loaded together. - Bytes
1..2(u16pointer): sequence bytecode address insideBANK_06($9ABE..$BBF4). - Priority vs. Unconditional Threshold (
$9A04: CMP #$41): IDs$01..$40(64entries, including$3D..$404-channel start jingle) check$0386,Xchannel priority; IDs$41..$84(68entries) clear$0389and start unconditionally.
5. PRG_FIXED_07 DMC Sample Descriptor ($FC80, dmc[0])
BANK_06 ($9A96) programs the RP2A03 Delta Modulation Channel from the 4-byte dmc[0] descriptor at $FC80..$FC83:
| Offset | Value | APU Register Mapping |
|---|---|---|
$FC80 |
$0E |
$4010 (DMC_FREQ: IRQ off, loop off, rate index 14) |
$FC81 |
$00 |
Padding / unused byte |
$FC82 |
$F0 |
$4012 (DMC_START: $C000 + ($F0 * 64) = $FC00) |
$FC83 |
$08 |
$4013 (DMC_LEN: ($08 * 16) + 1 = 129 sample bytes across $FC00..$FC80) |