# Contradictions between sources (C) and unknowns (U) Source names are those of [start-here.md](start-here.md). Each item says what a build session should do about it. Nothing here is settled by an emulator's vote. ## Contradictions **C1. What the long counter holds in initialisation mode.** [DS 17]: "the counter is set to all ones state, therefore the CPU will read $FF". [AHRM 5.5]: the generators "start zeroed" and RANDOM reads the register inverted. Both give `$FF` at the bus; they differ on the polarity inside, which decides the noise bit the audio side sees (constant 0 from the 4-bit and 9/17-bit counters, constant 1 from the 5-bit, per [AHRM]). *Do:* follow [AHRM]; the data sheet's sentence describes the read value. **C2. Channel outputs after STIMER.** [DS 17]: "logic high for channels 1 and 2, and logic low for channels 3 and 4". [AHRM 5.3]: the flip-flops are set to 1, which with the high-pass off "turns off the output of channels 1 and 2 and turns on the output of channels 3 and 4". Opposite. The difference is where one looks: before or after the inverting high-pass XOR. *Do:* settle at the pin with the VHDL (STIMER, all four channels pure tone at volume 15, read the audio sum before any divider fires); expected per [AHRM]: channels 3 and 4 on. **C3. SKSTAT bits 5 and 6.** [DS 22]: bit 6 keyboard overrun, bit 5 serial input overrun. [HM] III.18 has them the other way round ([AHRM] footnote 21, credit HiassofT). *Do:* [DS]. **C4. Serial mode chart.** Atari's chart ([DS 21], reproduced from [HM] II.27) shows channel 2 as the input rate for mode 110 and lists modes 011 and 101 as "not useful" with channel 4 asynchronous on every column. [AHRM 5.6] Table 10 (footnote 23): the input clock in mode 110 is channel 4, since only channel 4 or BCLK can reach the input shifter. *Do:* [AHRM]'s table, compared with the closed box's OCLK and BCLK pins on all eight modes in rung 7. **C5. Two-tone source selection.** [HM]'s block diagram draws a switch between channel 1 and channel 2 driven by the data bit. [AHRM] footnote 26: the logic is (channel 1 AND data) OR channel 2, so timer 2 always toggles the output and resyncs. *Do:* [AHRM]; it is what makes "timer 2 must be the slower" true. **C6. IRQST bit 3 and the /IRQ pin.** [DS 23]: bit 3 "is not a latch and does not get reset by interrupt disable". [AHRM 5.6]: it "will stay asserted even if it is disabled in IRQEN"; [AHRM 5.7]: "the interrupt status bit and corresponding interrupt will be set in that case even if bit 3 of IRQEN is cleared". Read literally the last says /IRQ is pulled with the enable clear. In the VHDL run here, with IRQEN = 0 and the transmitter idle, IRQST read with bit 3 low while the IRQ output stayed inactive. *Do:* status bit always visible, pin only when enabled, as the VHDL; confirm against [ACID] `pokey_seroc.s`. **C7. The quad POKEY's part number.** The task brief for this Phase 0 says C137290; Wikipedia's part list says 137324-1221 (citing a KLOV thread, not fetched) and gives 137430-001 as the arcade number of the single chip. No manufacturer document for the quad part was found. *Do:* nothing until an arcade board needs it; then take the number from that board's schematic. **C8. MAME against hardware, RANDOM after initialisation.** MAME 0.285 through `a5200` (17-bit mode, reads 4 cycles apart after SKCTL = 3): `FF FF FF 0F 00 00 F0 1F`. The VHDL at the same offsets: `1F 01 00 E0 ...`; hardware agrees with the VHDL at the one offset recorded (`$1F` at +4 in 9-bit mode). MAME's latencies are not usable in general (its timer latency did not follow AUDF1: U13, [mame-oracle.md](mame-oracle.md)). *Do:* treat as a detector difference, not a fact about the chip. **C10. The first derived-clock interrupt after leaving init mode.** [AHRM 5.2] "Clock reset timing": a period-0 timer's IRQ "is asserted in IRQST 83 and 24 cycles after the write to SKCTL". Acid800 `pokey_inittiming.s` (same author, expectations stated to pass on real machines) expects IRQST still clear when read 83 cycles after the write at 15 kHz and set at 84; at 64 kHz with AUDF1 = 2 clear at 80 and set at 81 (period 0: 25); its NOP-sled counts agree, on machines with a 2- and a 3-cycle IRQ delay alike (run in the AcidSAP harness, 2026-11-14). Read with the core's convention (B0.2: a write at T, a read at T+k), the manual is one cycle earlier than the test. *Do:* follow the test (B2.1b); the manual's sentence may count from the cycle after the write. The closed box gives 84 and 26 (U1 rows 2-3): it agrees with the test at 15 kHz and is one cycle late at 64 kHz. *Correction (2026-11-19):* the test's 64 kHz "too late" IRQST read (the one at T+81) does **not** follow a release from init mode: it is preceded by `and #$01` / `sta irqen` / `sta skctl` with A = 1, so SKCTL is written $01, init mode is never entered and the 64 kHz clock runs on from the previous release (seen in the harness trace: SKCTL 1, then 3). Only three of the four IRQST reads time a release (15 kHz at T+83 and T+84, 64 kHz at T+80). They fix the 15 kHz first interrupt at T+84 exactly but bound the 64 kHz one only from below (later than T+80 with AUDF1 = 2, i.e. +25 or later for period 0). The +25 rests on the NOP-sled counts: the core (+84/+25) reproduces the test's accepted pairs exactly, $1F/$20 on the 15 kHz even sled and $1D/$1E on the 64 kHz odd sled, one value on each machine; +84/+26 gives $1E on the 64 kHz odd sled on both machines and $1F on the 64 kHz even sled of the 3-cycle machine, which the test rejects (scratch run, 2026-11-19, below under U1). ## Unknowns **U1. Three latencies where the VHDL and the hardware numbers differ** ([timing.md](timing.md), the table): STIMER to IRQST at the machine clock (VHDL one cycle early), and the first timer interrupt after leaving init at 64 kHz (two late) and 15 kHz (one late). Candidates that can be tested through the pins: the testbench's placement of a write within the phi2 period, or a stimulus that is not the hardware test's. (ijor's prose in [RE] says the die's address decoder asserts its strobe in the cycle after the CPU's write; how the model treats that is not knowable without opening it, and it is not opened.) *Do first in rung 2:* replay [ACID] `pokey_inittiming.s` and `pokey_timertiming.s` cycle for cycle against the closed box. Until closed, hardware numbers judge absolute latency. *Rung 4 (2026-11-14):* run in the AcidSAP harness, `pokey_inittiming.s` puts the hardware at +84 and +25 (C10), so the box's 15 kHz row agrees with hardware and its 64 kHz row is one cycle late; the STIMER row (one early) stands. The referee's alignment (D1, D2) is now 1 cycle for STIMER, 0 for 15 kHz, 1 for 64 kHz. *The die (2026-11-19), the 64 kHz row.* What ijor's schematic shows, read for facts under the owner's ruling (restart.md, amendment): 1. **The write.** The clock generator makes two non-overlapping phases from O2: phase 1 while O2 is low, phase 2 while it is high [DIE: ijor PokeyReSchem-13, sheet 7, clock generator]. Data is sampled from the bus while O2 is high; each register's write strobe is gated off while O2 is high and so is active in the O2-low half after the write cycle, that is phase 1 of cycle T+1 [DIE: sheet 2, data input latches and the write address drivers, cell 22 on sheet 7]. This agrees with ijor's prose ([RE]). 2. **Init.** SKCTL bits 0-1 sit in transparent latches loaded by that strobe; the init signal is a plain (unclocked) NOR of the two bits [DIE: sheet 3, SKCTL latch row]. So init changes during phase 1 of T+1. 3. **The prescalers** [DIE: sheet 4, right half]. Each is a shift register of phase-2/phase-1 stage pairs with a wired-NOR decode of one state. The 15 kHz one: 7 stages, XNOR feedback, decode %1001001 forcing a 1, cleared to zeros by init. The 64 kHz one: 5 stages, XOR feedback, decode %00010 forcing a 1, set to ones by init. This matches AHRM 5.2 and B2.1 cell for cell, and the shift counts from the reset state to the decode are 78 and 19 (computed, matching AHRM's "78 and 19 cycles"). Each decode goes through one phase-2/phase-1 pair to its clock line, the two lines meet at the AUDCTL bit 0 selector, and one more pair gives the timers' clock [DIE: sheet 4, selector and audio clock]: the same delay on both rates. The one asymmetry: **init enters the 15 kHz register at its first stage's phase-1 gate, and the 64 kHz register at its first stage's phase-2 gate.** 4. **Consequence, as drawn.** With init falling inside phase 1 of T+1, the 15 kHz register's phase-1 gate catches it in that phase and the 64 kHz register's phase-2 gate half a cycle later: the 64 kHz register starts one cycle after the 15 kHz one, the two first ticks are 58 cycles apart (78 + 0 against 19 + 1) and, with 15 kHz at +84, the 64 kHz period-0 interrupt comes at **+26**, which is the closed box's value. (The absolute +84 needs the audio clock to IRQST pipeline, which was not traced on the die; it was taken as the machine-clock one implied by AHRM 5.3. Only the gap rests on the die alone.) 5. **The hardware says 59.** The 15 kHz +84 is fixed by IRQST reads, and the NOP-sled pairs (C10, correction) need the 64 kHz interrupt at +25: a gap of 59. If init settles only after phase 1 of T+1 closes (the latch is loaded in that phase and init must cross from sheet 3 to sheet 4), both registers start in the same cycle and the gap is 59 (both first ticks one cycle later than in item 4, so +84 would then need a pipeline one cycle shorter than the one assumed there); the drawing cannot say whether that race resolves in phase 1, and a redrawn phase label could also be off. *Decision (2026-11-19):* **no change to the core.** The die as drawn supports the closed box (+26); the test's verdicts on real machines support the core (+25). The die analysis here is a reading of one half-phase race in a redrawn schematic; the test is the observable itself on real units, so for this cycle count it is the stronger evidence. B2.1b stays `TEST ROM`, with the die mechanism noted; D2 stays a recorded closed-box difference, not "fixed" either way. What would close it: a capture on a real machine (a probe that releases init, then polls IRQST at 64 kHz for both period 0 and 1 with SKCTL really written 0 first), or a trace of the audio clock to IRQST path on the die to see whether +84/+26 or +84/+25 is the self-consistent pair. Scratch runs (core copy outside the repository, AcidSAP harness, 6502-python 741419a): core +84/+25: 2-cycle machine $1F $1F $1E $1D, 3-cycle $20 $1F $1E $1E, both pass; with one extra 64 kHz init tick (+84/+26, the die as drawn): 2-cycle $1F $1F $1E $1E pass, 3-cycle $20 $1F $1F $1E fail ("Incorrect 64KHz cycle count (even): $1F"). The STIMER row (D1, the box one cycle early) is not settled here (candidate list below). **U2.** What the 17 stages hold, and what RANDOM reads, across a change of AUDCTL bit 7 while running. **U3. Half-cycle pulses** from the high-pass path (1.5 cycles of delay). A core sampled once per cycle loses them. Whether that is audible after any real output filter is not known. The VHDL can be sampled on both clock edges. **U4.** Cycles from an AUDCx write to the change at the audio pin (volume-only sample playback). **U5.** The numeric values of [DS 25-30] (electrical and bus timing tables): scans without a text layer, not transcribed. Needed only by a pin-accurate serial peripheral model. **U6. The output's transfer curve.** [AHRM 5.3] describes it in words. No permitted source gives it as numbers (emulators' tables are in GPL files and are not opened). How much the curve varies between makers and boards is not known. **U7. Power-on.** [DS 20]: no defined state. [AHRM 5.2]: circuits are "biased toward particular states" but nothing is guaranteed; a pot scan of up to 256 counts may be running. No statistics exist. The core's constructor has to pick something (decision 8 in the brief). **U8. Revisions.** No source read measures a logic difference between makers or date codes of C012294. The data sheet is "rev B"; what changed from rev A is not stated. **U9. The quad POKEY's pins**: whether pots, keyboard and serial of any of the four are bonded out, and whether the four audio outputs are separate. **U10. A 7800 cartridge's POKEY**: whether /IRQ reaches the console on any cartridge, what the unconnected pot and keyboard-response pins read, and how the cartridge port's clock behaves when the 7800 stretches a TIA or RIOT access (does POKEY see a long cycle, or a missing edge). `a7800-python`'s Phase 0 owns this; the core only needs "one `tick()` per O2 period, whatever its length". **U11.** Whether the recordings in `ivop/pokey-explorer` (`sweeps/`, AUDCTL = `$64`, NTSC) came from a real machine. If they did they are the only pinned hardware audio. Not fetched until known. **U12.** `asap.sourceforge.net/pokeydoc.zip` (McFarlane and Fusik's "Pokeydocs", which [RE] recommends beside the schematics, "just note one wrong cell on each channel counter") is gone and unarchived. **U13.** What MAME's `a5200` POKEY did in the timer probe (IRQST bit 0 low at +11 cycles after STIMER for both AUDF1 = 1 and 5): not explained. ## Candidates the die schematic could settle (listed 2026-11-19, not acted on) Found while reading ijor's schematic for U1; each names where to look. None has been traced; each needs its own session, and each result is `DIE` and yields to a hardware measurement or a passing test ROM that disagrees. Sound need not be sample-exact (owner), so the audio items rank last. | Item | What the schematic shows to read | Where [DIE: ijor PokeyReSchem-13] | | --- | --- | --- | | U1 row 1 / D1 (STIMER to reload, the box one cycle early) | the STIMER strobe's path to the timers' reload (a "resync timers" pair of phase-2/phase-1 gates feeding both reload lines) and each counter's load and borrow cells; the same trace gives the audio clock to IRQST pipeline that U1's 64 kHz row lacks | sheet 5, bottom centre (STIMER logic) and the AUDF1 counter's control at its left; cells 20, 24 on sheet 7; sheet 3, IRQST latch row | | C6 (IRQST bit 3 against /IRQ) | whether the "output finished" status is gated by IRQEN bit 3 before the pin's NOR or only on the status read | sheet 3, IRQEN/IRQST rows and the /IRQ pad | | C3 (SKSTAT bits 5 and 6) | which overrun latch (keyboard or serial input) feeds the D6 and D5 read cells | sheet 3, SKSTAT row (the three latched bits at the left) | | D9, D10 (IRQEN clear and the bit 3 term, one cycle) | the phases of the IRQEN latches and of the gates between them and the status latches | sheet 3, IRQEN latch row (cell 12) and the gate pairs below it | | D12 (Shift and Break codes) | which scan state the /KR2 latches sample for Shift and for Break | sheet 3, keyboard control PLA and the two /KR2 latches (PLA rows on sheet 7) | | D13 (SKSTAT bits 2-3 in the step's own cycle) | the read path of the key-down and Shift latches against their load phase | sheet 3, SKSTAT row, inputs from the keyboard latches | | B2.1a, D5 (clocks part reset by a short init) | already visible: init forces the first stage only and the rest shift, as B2.1a models; a short stay leaves the registers part way | sheet 4, right half | | C1, D6 (the generators in init mode; 5-bit gate) | where init enters each polynomial register and its polarity there | sheet 5, top left (4-, 5- and 9/17-bit registers) | | U2, D3 (AUDCTL bit 7 switched while running) | how the 9-bit select reroutes the 17-bit register's feedback and from which phase | sheet 5, top left (9/17 register, "sel9bitPoly") | | C2, D7, D8 (STIMER and the output flip-flops; the 5-bit gate's load) | what STIMER's "reset audio phase" line does to each channel's output flip-flop and gate latch, and their phases | sheet 5, right (per-channel flip-flops, cell 2) and bottom centre | | U3 (half-cycle high-pass pulses) | the phases of the high-pass latch against the channel flip-flop | sheet 5, right, high-pass latch per channel | | U4 (AUDC write to the pin) | the AUDC latches feed the DAC cells with no clocked stage between them, if the drawing is read right | sheet 5, far right (AUDCx latch rows and cell 11) | | C5 (two-tone selection) | the two-tone resync and the channel 1/2 selection logic | sheet 6, "resync two tones" logic |