# Dave: sound, memory paging, interrupts, wait states and decoding Dave (Intelligent Software's "DPC sound chip", document DPC/Dave/1 issue 5, 1984) is more than a sound chip: it maps the Z80's 64K onto a 4 MB space, raises the interrupts, resets the machine, divides the clock, inserts wait states and decodes the I/O strobes for the keyboard and other ports. It stays inside the board (chip rule: no other family machine uses it). Keys: DAVE (Bouman's HTML of DPC/Dave/1 issue 5, "Confidential, Copyright (c) 1984 Intelligent Software Ltd"), ETI20 section 11 (the same document, dated 24-2-84, scanned). DOC, tier 2. LGB-PORTS for the external latches on B5-B7 (tier 3). ## Memory paging (B0-B3, read/write) - The Z80's A14-A15 select one of four page registers; the register's eight bits go out on A14-A21: **256 segments of 16K, 4 MB** (DAVE R16-R19). B0 maps 0000-3FFF, B1 4000-7FFF, B2 8000-BFFF, B3 C000-FFFF (LGB-PORTS). - Decoded selects (DAVE "Select outputs"): ROM for segments 0-3 (0-FFFFh), cartridge for 4-7, video RAM for FC-FF when BF b0 = 0 (64K machine), or for everything that is not ROM or cartridge when b0 = 1 (16K machine). On the EP128 the extra 64K is decoded outside Dave (U3). - Reset clears all 22 registers, so every page register starts at segment 0: the system ROM appears in all four quarters until EXOS pages (DAVE: "Reset clears all 22 internal registers"; that the ROM's first instructions then run from segment 0 at 0000h is the consequence, HYPOTHESIS until R0 shows it). ## Wait states and clocks (BF, write-only, R31) | Bits | Meaning | | --- | --- | | b0 | on-board RAM: 0 = 64K, 1 = 16K | | b1 | input clock: 0 = 8 MHz, 1 = 12 MHz | | b3-b2 | 00 wait on all memory accesses except video RAM; 01 wait on M1 only, except video RAM; 10 and 11 no waits | Dave also outputs a 1 MHz system clock and generates the reset pulse (1 ms, synchronised to M1's falling edge). The length of one Dave wait state (one Z80 T-state is the natural guess) is not stated (U6). The Z80 runs at 4 MHz (OBSERVED: MAME's `u1` Z80 @ 4.00 MHz; the board crystal and divider: U2). EXOS writes `04` to BF first thing (OBSERVED, MAME at 9 us): 64K, 8 MHz, wait on M1 only. ## Interrupts (B4) Four latched sources, each with an enable and a reset bit in the write register; the read register returns the latches, the two input pins and two toggling divider flip-flops (DAVE R20): | Write bit | Read bit | Source | | --- | --- | --- | | b0 enable, b1 reset | b0 divider (square wave at half the rate), b1 latch | 1 kHz / 50 Hz / tone generator 0 / tone generator 1, chosen by A7 b5-b6 | | b2 enable, b3 reset | b2 1 Hz divider (0.5 Hz square), b3 latch | 1 Hz | | b4 enable, b5 reset | b4 INT1 pin, b5 latch | INT1, negative edge | | b6 enable, b7 reset | b6 INT2 pin, b7 latch | INT2, negative edge | Any set latch pulls /IRQ low (open drain). Nick's VIRQ arrives on one of the external inputs (U5). In tone-generator mode the interrupt rate is 250,000 / (n + 1) Hz (DAVE, A7). ## Sound (A0-AF, write-only) - Three tone generators, 12-bit counters: f = 125,000 / (n + 1) Hz (30 Hz to 125 kHz); per channel distortion by sampling a 4-, 5- or 7-bit polynomial counter, a high-pass filter clocked by another channel and a ring modulator with another channel (A1, A3, A5). - Noise: a 17-bit polynomial counter clocked at 31.25 kHz or by a tone channel, length 17/15/11/9 bits, swappable with the 7-bit counter, with low-pass, high-pass and ring modulation by tone channels (A6). - A7: sync (hold) bits for the three tone channels; left and right D/A mode (the channel 0 amplitude registers become direct 6-bit outputs: sampled sound); the interrupt rate select. - A8-AF: 6-bit amplitudes, left (A8-AB) and right (AC-AF), for tones 0-2 and noise. The four channels share one external 6-bit resistor D/A per side, time-multiplexed ("in its own time slot each channel outputs the value in its amplitude register if the tone is high"), so the mixing is a sum over time slots, not an analogue sum. The exact clock divisions from 8 MHz to the 125 kHz and 31.25 kHz rates, the polynomial counters' taps and the filters' behaviour are not specified beyond these words (U7). "Sound: good enough" (Aubrey, 2026-11-13) applies: register behaviour from DAVE, then listening. Detectors: MAME's `enterprise/dave.cpp` (BSD-3-Clause by its `license:` line, not read: open decision 6), ep128emu (GPL-2.0, closed box). ## I/O strobes (B5-B7) Dave produces active-low read and write strobes for three external ports (DAVE R21-R23); the board wires them to latches (LGB-PORTS): B5 write = keyboard row select (and other bits on the same latch), B5 read = keyboard column data; B6 and B7 = printer, cassette, serial/net and joystick lines. The bit maps come from LGB-PORTS and ETI20's pin-out section (scanned, not yet read: U8). ## MAME's view (OBSERVED, a detector) ep128 boot (mame-oracle.md): BF `04` at 9 us; B0 `04` at 13.5 us; B2 and B1 `FF` at 34-37 us; then 5,424 writes to B1 (mostly `FF`, `00`, `04`) and 1,083 to B2 during the memory test; B3 from 4.83 s; B4 125 writes, mostly `16` and `34` (both enable the 1 Hz latch and INT1; `16` resets the timer latch, `34` the INT1 latch; the 1 kHz/50 Hz/tone source is never enabled in this window, which fits EXOS taking its frame tick from Nick's VINT on INT1: HYPOTHESIS); B5 612 (values 00-09, ten keyboard rows in turn, 55 scans each plus extra 00s); B6 once; sound registers A0-AF zeroed about every 19 ms.