Metadata-Version: 2.5 Name: pokey-python Version: 0.1.0.dev0 Summary: Readable, pure-Python Atari POKEY (C012294) reference core: audio, timers, serial port, keyboard scan, pot scan, one phase-2 clock at a time Author: alewman License: MIT License Copyright (c) 2026 alewman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. License-File: LICENSE License-File: NOTICE Classifier: Development Status :: 2 - Pre-Alpha Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Multimedia :: Sound/Audio :: Sound Synthesis Classifier: Topic :: System :: Emulators Requires-Python: >=3.11 Provides-Extra: acid Requires-Dist: 6502-python @ git+https://github.com/alewman/6502-python@741419a33d1de400a63f7c24c7916bb600694ca2 ; extra == 'acid' Provides-Extra: dev Requires-Dist: pytest>=8; extra == 'dev' Requires-Dist: ruff==0.16.8; extra == 'dev' Description-Content-Type: text/markdown **Lineage:** pokey-python → (pokey-rust, planned) · fixes start in pokey-python and flow down by merges · [family charter](https://github.com/alewman/emulator-lineage/blob/main/docs/charter.md) # pokey-python A readable, pure-Python reference core for Atari's POKEY (C012294): four audio channels with polynomial counters and dividers, timers and interrupts, RANDOM, the pot scan, the keyboard scan, and the serial port's audio-affecting parts (two-tone, asynchronous hold of timers 3+4), advanced one O2 period at a time. It is a chip core of an emulator family: boards (Atari 5200, Atari 7800 cartridges, later the 8-bit computers and arcade boards) compose it and pin it by commit. **Modelling level: cycle.** This repository was restarted on 2026-11-14 ([docs/restart.md](docs/restart.md)): it is written only from documents (Atari's data sheet, the Altirra Hardware Reference Manual, Acid800, recordings) and from closed-box measurements of a VHDL model's pins. Where every fact comes from: [docs/provenance.md](docs/provenance.md); the behaviour rule by rule: [docs/behaviour.md](docs/behaviour.md). from pokey_python import POKEY, C012294 chip = POKEY(C012294) chip.write(0x0F, 0x03) # bus access first (SKCTL: leave initialisation mode)... chip.tick() # ...then the tick of the same cycle chip.levels() # (c1, c2, c3, c4): volume if the channel's output is 1, else 0 chip.mix() # the four codes through the fitted output curve, 0.0-1.0 **Status** (measured 2026-11-14 at the rung 10 commit; details, commands and commits in [docs/status.md](docs/status.md)): rungs 1-7 and 9-10 built. 123 tests pass on CPython 3.14 and PyPy 3.11, among them AcidSAP's POKEY tests run on 6502-python (9 of 10 on both IRQ-delay machines; two-tone needs the serial output shift register, which is not built). Against the closed box: 0 differences on RANDOM, fires, the four channel codes and /IRQ over 10 M cycles each; the keyboard's pins and status over 12.6 M cycles, 499 of 501 streams equal; pots cannot be judged by it. Seeded faults 64/64 caught. Speed: PyPy 9.5 M cycles/s (5.3x NTSC real time), CPython 0.61 M. Rung 8 (music excerpts) waits for the boards' register logs. How a board wires the chip: [docs/adoption.md](docs/adoption.md); where work resumes: [docs/build-progress.md](docs/build-progress.md). python -m pytest # the rungs' tests (CPython or PyPy); pip install -e .[acid] for AcidSAP python -I scripts/conformance.py # the conformance kit a transcription must reproduce python -I scripts/fetch_references.py # documents, Acid800, the closed box -> reference/ (ignored) OSS_CAD_SUITE=DIR python -I scripts/run_vhdl.py # the closed box under GHDL MAME_ROMPATH=DIR python -I scripts/mame_pokey.py # MAME 0.285 as a binary detector Nothing third-party is committed. Licence: MIT (LICENSE); credits in NOTICE.