# SPDX-License-Identifier: MIT """The machine rows: every difference between the 5200 models is a field with its source. Source keys are those of docs/start-here.md. A field nobody documents carries "unknown: default" in its source and the value the board uses meanwhile. Evidence tags (family methodology): MEASURED, DIE, TEST ROM, DOC, OBSERVED, FITTED, HYPOTHESIS. Acid5200 is tagged TEST ROM with the caveat that its author states hardware passes but no recorded 5200 run exists (U7). """ from __future__ import annotations from dataclasses import dataclass, field # MEASURED (SHA-1 of the dumps held here); DOC [AHRM] F.2 lists the same hashes. BIOS_4PORT_SHA1 = "6ad7a1e8c9fad486fbec9498cb48bf5bc3adc530" # CO19156 BIOS_REVA_SHA1 = "1d2a3f00109d75d2d79fecb565775eb95b7d04d5" # CO19156A BIOS_NAMES = {BIOS_4PORT_SHA1: "CO19156 (4-port)", BIOS_REVA_SHA1: "CO19156A (revision A)"} @dataclass(frozen=True) class PowerOn: """Power-on parameters (U8): nothing documents them; each is a labelled default. HYPOTHESIS for every field: a probe ROM on a real console reading RAM, VCOUNT and POKEY's RANDOM at the first instruction would settle them. """ ram_fill: int = 0x00 # HYPOTHESIS: [AHRM] 2.3 says RAM contents are undefined; default 0 line: int = 0 # HYPOTHESIS: ANTIC's vertical counter ([AHRM] 4.1 fn 11: varies); default 0 cycle: int = 0 # HYPOTHESIS: ANTIC's horizontal counter, undocumented; default 0 pokey_seed: int | None = None # None = pokey-python's all-zero power-on (its B1.8, a choice) @dataclass(frozen=True) class Machine: name: str description: str bios_sha1: str ports: int # DOC: controller ports ([FSM]; [FAQ] 4.8) pots_upper_grounded: bool # DOC: POT4-POT7 tied to ground ([FAQ] 4.10 item 2) trig3_wired_to_trig1: bool # DOC: early 2-port boards ([FAQ] 4.10 item 1) consol_bit1_selects_ports_34: bool # DOC: CONSOL bit 1 needs ports 3-4 ([AHRM] 13.3) crystal_hz: float = 3_579_575.0 # DOC: [FSM] parts list Y1 (C2, open decision 6) cpu_divider: int = ( 2 # DOC: crystal / 2 ([FSM] Figure 1-6); HYPOTHESIS until the oscillator sheet is read (U1) ) lines: int = 262 # DOC: NTSC ANTIC ([AHRM] 4.2 Table 6); TEST ROM antic_* timing cycles_per_line: int = 114 # DOC: [AHRM] 4.2; [HM] II; TEST ROM cpu_timing pal_gtia: bool = False # DOC: no PAL 5200 was made ([FAQ] 4.8); a chip field only f000_mirror: bool = True # HYPOTHESIS (C8): $F000-$F7FF reads the 2K BIOS again; a probe # ROM reading $F000 on a console settles it power_on: PowerOn = field(default_factory=PowerOn) sources: tuple[str, ...] = () @property def cycle_hz(self) -> float: return self.crystal_hz / self.cpu_divider @property def cycles_per_frame(self) -> int: return self.lines * self.cycles_per_line @property def frame_hz(self) -> float: return self.cycle_hz / self.cycles_per_frame A5200 = Machine( name="a5200", description="Atari 5200 SuperSystem, 4-port board (1982), BIOS CO19156", bios_sha1=BIOS_4PORT_SHA1, ports=4, pots_upper_grounded=False, trig3_wired_to_trig1=False, consol_bit1_selects_ports_34=True, sources=("[FSM] 4-port parts list", "[AHRM] 13", "[BUCH]"), ) A5200_2PORT = Machine( name="a5200_2port", description="Atari 5200 SuperSystem, 2-port board (1983), BIOS CO19156A", bios_sha1=BIOS_REVA_SHA1, ports=2, pots_upper_grounded=True, trig3_wired_to_trig1=False, # after the factory modification ([FAQ] 4.10 item 1) consol_bit1_selects_ports_34=False, sources=("[FSM] 2-port parts list", "[FAQ] 4.8, 4.10", "[AHRM] F.2"), ) MACHINES = {m.name: m for m in (A5200, A5200_2PORT)}