// SPDX-License-Identifier: MIT // Generated by scripts/gen_machine.py from sega32x-python's src/sega32x_python/machine.py: // edit the reference and regenerate, never this file. //! The 32X as data: each model, and every quirk with its source and tier. //! //! The family's rule (docs/validation.md, "The tier rule"): **hardware-captured > //! die-derived > specification > research > emulator-derived**, with hardware-corrected test //! programs just under hardware captures. For the 32X nothing above "hardware-corrected" //! exists, so the strongest source a quirk can name is notaz's testpico (run on his own //! console) or, by Aubrey's decision 5, Sega's Mars Check Program. Every behaviour the board //! chooses where a source is silent or sources disagree is a :class:`Quirk` here, carrying //! that choice, where it came from and how far to trust it, so a later finding changes one //! field and the test that pins it (tests/test_machine.py, tests/test_slot.py). //! //! Sources, short names as docs/start-here.md uses them: **Manual** = Sega's *32X Hardware //! Manual* MAR-32-R4-072294 (1994, provisional), cited by section; **testpico** = notaz's //! ``testpico/main.c`` (30a5783, public domain), by test function; **ares** (ISC, 9408cb4) //! and MAME's BSD-3-Clause files = emulator sources that may be read, cited as OBSERVED //! emulator facts (NOTICE keeps their notices). PicoDrive, jgenesis, BlastEm, the MiSTer //! core and Nuked-MD are run as closed boxes only, never read (wave-2 provenance rewrite, //! 2026-11-19: docs/provenance.md); their earlier source citations were struck from these //! records. //! //! Models: the Genesis 32X (VA0 and VA1 boards; service manual No. 012 shows parts fitted on //! VA1 only, and no source compares their behaviour) and the Mega Drive 32X. Nothing is //! known to differ between them on the 68000 side, so the two records differ in name only; //! NTSC/PAL is not the 32X's to choose: its VDP reads the Mega Drive's NTSC/PAL line off the //! slot (service manual ``A408a``, IC6 pin 69), and its SH-2 clock is the Mega Drive's MCLK x //! 3/7 in either region (Manual 3.3), so the region comes from megadrive-python's machine. //! //! What Rust forced: each record's value is typed (a dict is a struct with the same //! keys, a tuple a slice, bytes an array); `Quirks::default()` is the dataclass's //! defaults; `table` names each record's value only by its field name and source. /// Oracle tiers (docs/validation.md), strongest first. pub const HARDWARE_CORRECTED: &str = "hardware-corrected"; pub const SPECIFICATION: &str = "specification"; pub const RESEARCH: &str = "research"; pub const EMULATOR: &str = "emulator-derived"; /// The board's own choice where no source decides: the open items of /// docs/undocumented-behavior.md. pub const ASSUMPTION: &str = "assumption"; /// One behaviour, kept as three separate records (docs/validation.md, "Three records, /// kept apart"): ``documents`` -- what the specifications and research say; /// ``hardware`` -- what testing on hardware has shown (hardware-corrected programs); and /// ``value`` with ``source`` -- what the board implements and why. ``unresolved`` names /// any disagreement between them, or between detectors, which stays visible instead of /// being settled toward the easiest implementation. ``tier`` is the strongest tier behind /// the implemented choice; ``milestone`` is the first milestone whose code reads it /// (later ones are recorded now so the list is whole). /// /// Quirks written before the rule (2026-10-23) carry all of it in ``source``; the four the /// rule was first applied to, and every new one, fill the three fields. #[derive(Clone, Copy, Debug, PartialEq)] pub struct Quirk { pub value: T, pub source: &'static str, pub tier: &'static str, pub milestone: u32, pub documents: &'static str, pub hardware: &'static str, pub unresolved: &'static str, } /// The value of `Quirks::sh2_waits` (a dict in the reference, with these keys). #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct Sh2Waits { pub boot_rom: i64, pub system_register: i64, pub vdp: i64, pub palette: i64, pub framebuffer_read: i64, pub framebuffer_write: i64, pub cartridge: i64, } /// The value of `Quirks::sh2_framebuffer_fifo` (a dict in the reference, with these keys). #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct FramebufferFifo { pub depth: i64, pub drain: i64, } /// The value of `Quirks::m68k_waits` (a dict in the reference, with these keys). #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct M68kWaits { pub framebuffer_read: i64, pub vdp_read: i64, pub vdp_write: i64, pub palette_read: i64, pub palette_write: i64, } /// The value of `Quirks::sh2_bus_arbitration` (a dict in the reference, with these keys). #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct BusArbitration { pub slave_request: i64, pub master_return: i64, } /// The value of `Quirks::hblank_timing` (a dict in the reference, with these keys). #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct HblankTiming { pub pen: i64, pub latch: i64, pub blank: i64, } /// The value of `Quirks::composite_alignment` (a dict in the reference, with these keys). #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct CompositeAlignment { pub h40: i64, pub h32: i64, } /// Every 68000-side behaviour the slot device chooses (milestone 1), and the quirks /// of docs/undocumented-behavior.md the later milestones will read. #[derive(Clone, Copy, Debug, PartialEq)] pub struct Quirks { // -- the 68000's map ------------------------------------------------------------ pub mars_id: Quirk<[u8; 4]>, pub vector_rom_with_rv: Quirk, pub hint_vector_power_on: Quirk, pub low_map_without_rv: Quirk<&'static str>, pub windows_with_rv: Quirk<&'static str>, pub vdp_side_with_fm: Quirk<&'static str>, pub area_without_aden: Quirk<&'static str>, pub reset_with_rv: Quirk<&'static str>, pub vdp_without_aden: Quirk<&'static str>, // -- the SH-2 side (milestone 2) ---------------------------------------------------- pub sh2_clock_needs_aden: Quirk, pub sh2_waits: Quirk, pub sh2_wait_overlap: Quirk<&'static str>, pub sh2_area0_width: Quirk, pub sh2_framebuffer_fifo: Quirk, pub sh2_sdram: Quirk<&'static str>, pub m68k_waits: Quirk, pub cartridge_contention: Quirk<&'static str>, pub sh2_bus_arbitration: Quirk, pub ftoa_to_irl0: Quirk<&'static str>, pub cmd_interrupt: Quirk<&'static str>, pub vint_latch: Quirk<&'static str>, pub vint_at: Quirk<&'static str>, pub hint_counter: Quirk<&'static str>, pub sci_link: Quirk<&'static str>, pub rv_stall: Quirk<&'static str>, pub dreq_fifo: Quirk<&'static str>, pub sh2_vdp_without_fm: Quirk<&'static str>, pub sh2_dreq_view: Quirk<&'static str>, pub framebuffer_mirror: Quirk<&'static str>, pub pwm_registers: Quirk<&'static str>, pub bitmap_bits: Quirk, pub auto_fill: Quirk<&'static str>, pub hblank_phase: Quirk, pub edclk_h32: Quirk, pub hblank_timing: Quirk, pub fen_refresh: Quirk, pub palette_wait: Quirk<&'static str>, pub fs_swap: Quirk<&'static str>, pub screen_shift_modes: Quirk<&'static str>, pub blank_row: Quirk<&'static str>, pub rgb_levels: Quirk<&'static str>, pub unused_registers: Quirk<&'static str>, // -- the system registers ----------------------------------------------------------- pub adapter_power_on: Quirk, pub adapter_writable: Quirk, pub dreq_control_writable: Quirk, pub dreq_source_mask: Quirk, pub dreq_destination_mask: Quirk, pub dreq_length_mask: Quirk, pub dreq_length_power_on: Quirk, pub dreq_address_power_on: Quirk, pub fifo_read: Quirk, pub reads_zero: Quirk<&'static [u32]>, pub sega_tv_writable: Quirk, pub interrupt_control_writable: Quirk, pub bank_writable: Quirk, pub comm_both_write: Quirk<&'static str>, pub registers_survive_button: Quirk, pub framebuffer_zero_bytes: Quirk<&'static str>, pub z80_writes_lock_68000: Quirk, // -- later milestones (recorded now; not read yet) ------------------------------- pub pwm_period: Quirk<&'static str>, pub pwm_fifo: Quirk<&'static str>, pub pwm_routing: Quirk<&'static str>, pub pwm_byte_writes: Quirk<&'static str>, pub pwm_timer_restart: Quirk<&'static str>, pub pwm_cycle_write: Quirk<&'static str>, pub pwm_dreq1: Quirk<&'static str>, pub pwm_needs_aden: Quirk, pub pwm_output_level: Quirk<&'static str>, pub pwm_gain: Quirk, pub vblank_after_hblank: Quirk, pub screen_shift_ff_exception: Quirk, pub hcount_read: Quirk<&'static str>, // -- the composite (milestone 4): detectors only, docs/claims.md -------------------- pub composite_rule: Quirk<&'static str>, pub composite_md_transparent: Quirk<&'static str>, pub composite_ys_shadow: Quirk<&'static str>, pub composite_alignment: Quirk, pub composite_dot: Quirk, pub composite_border: Quirk<&'static str>, pub composite_levels: Quirk<&'static str>, pub cartridge_boards: Quirk<&'static [(&'static str, &'static str)]>, pub sh2_cartridge_priority: Quirk, } impl Default for Quirks { fn default() -> Self { Quirks { // -- the 68000's map ------------------------------------------------------------ mars_id: Quirk { value: *b"MARS", source: r#"Manual 3.1 (both maps: "A1 30ECh Super 32X ID"); testpico main() reads it as a long to detect a 32X (`read32(0xa130ec) == MKLONG('M','A','R','S')`); readable with ADEN = 0, since that is how the initial program finds the 32X"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, vector_rom_with_rv: Quirk { value: true, source: r#"$000000-$0000FF stays the 32X's vector ROM with ADEN = 1 whatever RV is: Manual 3.1 ("The 68000 vector area (00 0000h - 00 00FFh) is assigned by the custom built-in ROM"; "Only when the RV ... bit is 1 is 100h - 3F FFFFh assigned by the cartridge ROM"); testpico t_32x_md_rom runs with RV = 1 and reads the boot ROM's $880200 at $000004 and the cartridge's "SEGA" at $000100"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, hint_vector_power_on: Quirk { value: 0, source: r#"the level-4 vector at $000070 is a register, writable, reading 0 after power-on: testpico t_32x_md_rom (`expect(ok, rl[0x70/4], 0)`, then writes and reads back $A5123456, while a write to $000078 does not stick)"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, low_map_without_rv: Quirk { value: r#"open bus"#, source: r#"chosen: CMD gen-hw.txt note 1's open bus as megadrive-python defines it for its own unused $400000-$7FFFFF -- a word reads the next opcode's MSB with LSB 0; a byte reads that MSB at an even address and 0 at an odd one; writes do nothing"#, tier: ASSUMPTION, milestone: 1, documents: r#"known: no cartridge is mapped at $000100-$3FFFFF with ADEN = 1 and RV = 0 (Manual 3.1: "Only when the RV (ROM to VRAM DMA) bit is 1 is 100h - 3F FFFFh assigned by the cartridge ROM"); nothing says what is there instead"#, hardware: r#"none: no hardware-corrected program reads it"#, unresolved: r#"what the hardware drives there (docs/undocumented-behavior.md, open item 2). Detectors disagree: ares returns the bus's value (`Mega32X::read`, `return data`), as the board does"#, }, windows_with_rv: Quirk { value: r#"lockup"#, source: r#"$880000-$9FFFFF with RV = 1 hangs the console: testpico t_32x_md_rom, "with RV 0x880000/0x900000 hangs, can't test"; Manual 3.1 maps the cartridge there only "When RV bit is 0""#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, vdp_side_with_fm: Quirk { value: r#"reads open bus, writes ignored"#, source: r#"the board follows the Manual for all three blocks (frame buffer and overwrite image, VDP registers, palette): a write is dropped, and a read, undefined there, returns the board's open bus (CMD gen-hw.txt note 1 as megadrive-python defines it) -- that value is chosen, not documented. No hang"#, tier: SPECIFICATION, milestone: 1, documents: r#"Manual 3.1, "Access to the 32X VDP": with FM = 1 a 68000 access to the frame buffer, overwrite image, VDP register or palette: "reads are undefined and writes are ignored""#, hardware: r#"no hardware-corrected program tests a 68000 access with FM = 1. testpico t_32x_irq_cmd's `write8(r, 0x00); // FM=0 (hangs without)` (main.c:2185) is an unexplained observation: it says the test hangs without that write, and the reads that follow it are system registers, not the frame buffer; it is not evidence that a 68000 frame-buffer access hangs, and nothing is generalised from it"#, unresolved: r#"what an undefined read returns; why testpico hangs without the FM write"#, }, area_without_aden: Quirk { value: r#"lockup (inherited)"#, source: r#"the 32X claims nothing in $800000-$9FFFFF while ADEN = 0, so megadrive-python's own lock-up for that range applies unchanged: inherited, unverified for a console with a 32X attached"#, tier: ASSUMPTION, milestone: 1, documents: r#"two states. No 32X at all: CMD gen-hw.txt note 2 for $800000-$9FFFFF, "Reading or writing any address will lock up the machine. This area is used for the 32X adapter." (research tier; megadrive-python's existing lock-up). A 32X attached with ADEN = 0: no document says what the range does"#, hardware: r#"none for either state"#, unresolved: r#"what a console with a 32X attached and ADEN = 0 does there. Reached by Devi to Pii (Japan) (Mega Drive Mini 2) at $9FFFFE and The Killing Game Show (Japan) (En) at $800000 in megadrive-python's mini sweep"#, }, reset_with_rv: Quirk { value: r#"lockup (placeholder)"#, source: r#"a placeholder, explicitly not a hardware claim: the reset button pressed with ADEN = 1 and RV = 1 sends the 68000 to the vector ROM's $880200, a window that hangs with RV = 1, and the board raises `ResetLanding` (a `Lockup`) there. The landing is one method, `Sega32X._reset_landing`, so a finding replaces it without touching the reset path"#, tier: ASSUMPTION, milestone: 1, documents: r#"none"#, hardware: r#"testpico's `sega_gcc.s` fills $2C8-$304 of its cartridge with `illegal` under "mystery landing area for reset with 32X on and RV=1 / 2c8 - 304 in multiples of 4": notaz observed the 68000 land within that range; the exact address is unknown. testpico clears RV before it asks for the button"#, unresolved: r#"where the 68000 lands, and why (docs/undocumented-behavior.md, open item 10). Plan: run testpico's reset test on the board and on the other emulators as soon as milestone 2 allows; there is no hardware to run it on"#, }, vdp_without_aden: Quirk { value: r#"lockup"#, source: r#"$A15180-$A153FF with ADEN = 0 hangs: testpico t_32x_init, `//expect(ok, r8 [0x81], 0); // VDP; hangs without ADEN`"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, // -- the SH-2 side (milestone 2) ---------------------------------------------------- sh2_clock_needs_aden: Quirk { value: true, source: r#"the SH-2s are held while ADEN = 0 or RES = 0 and reset (power-on) when both are set"#, tier: SPECIFICATION, milestone: 2, documents: r#"service manual block diagram (A406a): "CPU clock runs only when the software selectable MARS bit is set"; Manual 3.2.1: RES "0: Reset""#, hardware: r#"testpico x32x_disable's comment "nRES - sh2s should see no ADEN and sleep" implies they run with ADEN = 0 and the boot ROM sleeps (notaz, unexplained)"#, unresolved: r#"whether the SH-2s run with ADEN = 0 and RES = 1"#, }, sh2_waits: Quirk { value: Sh2Waits { boot_rom: 1, system_register: 1, vdp: 5, palette: 5, framebuffer_read: 5, framebuffer_write: 1, cartridge: 6, }, source: r#"an SH-2 cycle's waits, as Manual 4.1 counts them (a cycle of 2 + n states): the low end of each range, the rest of each range coming from contention the board models (sh2_framebuffer_fifo, cartridge_contention, palette_wait); the board drives WAIT for the part the BSC's own programmed waits do not cover (sh2_wait_overlap). The SDRAM is not here: WAIT does not reach it (sh2_sdram)"#, tier: SPECIFICATION, milestone: 2, documents: r#"Manual 4.1: "1 Wait means that the minimum bus cycle + 1 Clock", the minimum SH-2 cycle 2 clocks; boot ROM 1, system register 1, VDP register 5 (const), palette 5 to a line, frame buffer read 5-12, write 1-3 (3 clocks, 5 when the 4-word FIFO is full), cartridge 6-15"#, hardware: r#"none on a 32X here. The 32xspd benchmark's photograph of a hardware run (bakemono, sega-16 forum; jgenesis issue 493; sh2-python reference/docs/32xspd-hardware.jpg; research tier, one console) gives 75 SH-2 clocks per four uncached cartridge longwords and 41 per eight frame-buffer words, loop included (docs/validation.md, 'Milestone 5b')"#, unresolved: r#"where in each range a cycle falls when nothing the board models contends: the frame buffer's reads against the VDP's own display fetches (5-12), the cartridge's 6-15 beyond the 68000's share"#, }, sh2_wait_overlap: Quirk { value: r#"WAIT covers what WCR does not"#, source: r#"the board's WAIT states for a cycle are the Manual's waits less the BSC's programmed waits for that area (WCR; the boot ROMs set one per area, $0055), never below 0"#, tier: SPECIFICATION, milestone: 5, documents: r#"HM 7.4.2: WAIT is sampled only as the last software Tw turns into T2 (it has no effect in T1 or the first Tw), so a device's waits overlap the programmed ones; HM 7.2.3: Wn = 01 is 'external wait input enabled with one wait' and 00 disables WAIT, so one programmed wait is the least that lets the 32X's WAIT act; Manual 4.1's note: 'after implementing boot ROM only external Wait is set'. The 32X's boot ROMs leave WCR = $0055 (read off the board's chips after boot)"#, hardware: r#"the 32xspd photograph: 75 clocks per four uncached cartridge longwords (eight word cycles) fits 8 clocks a word (2 + 6) with the loop's own few, not 9"#, unresolved: r#"none known; before milestone 5b the board added the whole of each wait on top of WCR's (one state too many on every 32X-space cycle)"#, }, sh2_area0_width: Quirk { value: 16, source: r#"CS0 (the boot ROMs, the system and VDP registers) is 16 bits wide on both SH-2s"#, tier: ASSUMPTION, milestone: 2, documents: r#"SH7604 hardware manual 7.2: area 0's width is not programmable, it is set by a mode pin at reset. Manual 4.1 counts every 32X block in 16-bit cycles (a minimum SH-2 cycle of 2 clocks plus waits), and the 32X's data bus to the SH-2s is the I/F chip's 16 bits. OBSERVED (ares 9408cb4, M32X::readInternal): ares models the whole SH-2 side as a 16-bit bus. The service manual's schematic would show the mode pin's tie and settles it; it has not been read for this"#, hardware: r#"none directly; with 16 the boot ROMs, testpico's 32X tests and the Mars Check Program run (TEST ROM), which an 8-bit CS0 reading a 16-bit ROM could not"#, unresolved: r#"the mode pin's tie on the board (service manual schematic, unread). Re-established 2026-11-19 without the earlier record, which rested on a GPL HDL core's pin ties (docs/provenance.md, wave 2)"#, }, sh2_framebuffer_fifo: Quirk { value: FramebufferFifo { depth: 4, drain: 5 }, source: r#"SH-2 frame-buffer (and overwrite image) writes go through a 4-word FIFO shared by both SH-2s; each word leaves it 5 SH-2 clocks after the one before (or after it was taken). A write finds room at once (the cycle's 3 clocks) or waits for the oldest word to leave; a read waits for the word leaving now, and the next word leaves after the read. $20004006 FULL and EMPTY read the FIFO at the access's time"#, tier: SPECIFICATION, milestone: 5, documents: r#"Manual 3.1: "4-word write FIFO available for Frame Buffer and Overwrite Image", "can write in 3 clock cycles. Five clock cycles are required when continuously writing 4 words or more"; 4.1: "5 Clock is required if FIFO is FULL and 3 Clock is required if FIFO is not FULL", writes "assume continuous accessing without an Idle Cycle ... the next access time is shortened only by the number entered by the Idle Cycle (... cannot be shorter than a minimum cycle of 3 clock)"; 3.2.2: $4006 FULL/EMPTY of the 'Frame Buffer, Write Cache'. Five clocks a word leaving is the only drain rate that makes a full FIFO's writes take 5. Sega's 32X H/W Information (MAR-25-R5/R6-060694, '32X I/F Implementation Time', Target Ver. 2.0; the 32XDK transcription): 1st-4th write 3 clocks, 5th and after 5"#, hardware: r#"the 32xspd photograph: 8,752 KB/s of frame-buffer writes, 41.1 clocks per eight words with the loop, 5.1 a word. Its copy loops (8 words and one line fill an iteration) take about 9 (cartridge) and 5 (SDRAM, at the documents' fill) states more than this FIFO gives; unexplained (docs/validation.md, 'The ROM-VRAM copy, investigated')"#, unresolved: r#"whether a read waits for the whole FIFO (the Manual's read range 5-12 says it cannot: four words would be 20); whether a read sees a word still in the FIFO (the board writes the DRAM at once); auto fill against the FIFO (the VDP's display fetches read the other DRAM, Manual 1.1); what costs the copy loops their missing time (the FIFO drains here whatever else the bus does); the 68000's frame-buffer path (FM gives it to one side at a time). jgenesis (issue 493) adds that the VDP takes at most one write per 4 clocks"#, }, sh2_sdram: Quirk { value: r#"the core's synchronous DRAM cycles (HM 7.5)"#, source: r#"the board adds nothing to an SDRAM cycle; its length is sh2-python's (pin 8755c3a, PR #1: with the boot ROMs' registers a burst of 8 words is 10 same row, 11 bank idle, 12 other row; a cache-through or DMA read is the same burst; a word write 1, 2 or 3 by row state; a refresh of 7 states every 356, master only)"#, tier: SPECIFICATION, milestone: 5, documents: r#"HM 7.2.3: 'With synchronous DRAM, external wait input is ignored regardless of any setting' -- the cycle's shape is the BSC's alone (HM 7.5). The boot ROMs set CS3 to SDRAM (BCR1 = $0001), 16 bits, CAS latency 2 (WCR W31/W30 = 01), bank-active mode with refresh (MCR = $0AB8): by HM 7.5.3-7.5.6 an 8-beat burst is 10 (same row), 11 or 12 (other row) states, a cache-through read bursts all 8 (HM 7.5.4), a write 1-3. Manual 4.1: 'Read 12 Clock / 8 Word, Write 2 Clock / 1 Word', 'fixed'"#, hardware: r#"jgenesis issue 493 fitted 10-12 per burst and 1-3 per write to the 32xspd photograph; the photograph: 22 clocks per 16-byte line read, loop included"#, unresolved: r#"the 32xspd SDRAM reads run about 1 clock a fill fast against the photograph (20.91 against 22.08): the size of the cache-through read's extra cycle and a fill's tag-check state, which sh2-python does not model yet (its PR #1)"#, }, m68k_waits: Quirk { value: M68kWaits { framebuffer_read: 2, vdp_read: 2, vdp_write: 0, palette_read: 2, palette_write: 3 }, source: r#"68000 waits (in 68000 clocks, through Board.hold) on 32X space: the low end of Manual 4.1's ranges; system registers and the cartridge windows 0 unless an SH-2 holds the cartridge (cartridge_contention)"#, tier: SPECIFICATION, milestone: 2, documents: r#"Manual 4.1: cartridge 0-5, frame buffer read 2-4 / write 0, palette read 2 / write 3 to a line, VDP register read 2 / write 0, system register 0"#, hardware: r#"none"#, unresolved: r#"the frame buffer's 2-4 against the VDP's display fetches"#, }, cartridge_contention: Quirk { value: r#"the second to arrive waits for the first"#, source: r#"an SH-2 cartridge cycle that starts while the 68000's cartridge access (through $880000-$9FFFFF; 4 68000 clocks plus its holds) is on the cartridge waits for its end, and a 68000 cartridge access that starts during an SH-2's cartridge cycle is held (Board.hold) to that cycle's end. The VDP's DMA from the windows is not held"#, tier: SPECIFICATION, milestone: 5, documents: r#"Manual 3.4, "ROM Access Competition": "SH2 has priority when 68000 and SH2 access the cartridge ROM at the same time. When this happens, the second CPU to be accessed waits until access of the first CPU is finished"; 4.1: SH-2 6-15 waits, 68000 0-5 (an SH-2 cartridge cycle is 8-17 SH-2 clocks, 19-40 MCLK: about 5 68000 clocks at most; a 68000 access is 4 68000 clocks, 12 SH-2 clocks: 6 + 9 = 15)"#, hardware: r#"none"#, unresolved: r#"'at the same time' (a tie goes to the SH-2: the board's 68000 runs first and the SH-2s catch up to it, so a tie is decided by the order the board runs them, within one SH-2 instruction); the Z80, which the Manual forbids there"#, }, sh2_bus_arbitration: Quirk { value: BusArbitration { slave_request: 2, master_return: 1 }, source: r#"one bus between the two SH-2s: a cycle that starts while the other chip's access is on the bus waits for its end (an access's port cycles and a line fill's four longwords are one); the slave pays slave_request states for each access it starts (it asks for the bus every time), and the master master_return states when it takes the bus back from a slave access that ended less than that ago"#, tier: RESEARCH, milestone: 5, documents: r#"HM 7.10: the master holds the bus and releases it on request after its current cycle; 'In slave mode, the bus is usually released', BREQ and BACK sampled on clock falls, the slave drives from the next rise, and releases 'as soon as the bus access cycle ends'; the master takes it back at the clock fall that sees BRLS negated and drives from the next rise; 'The bus cannot be released during burst transfers for cache fills', nor 'between multiple bus cycles produced by a data width smaller than the access size'. Manual 2.2: the master owns the bus, the slave asks. 32XDK wiki 'Optimizations': handing the bus between the SH-2s 'costs 2-3 clock cycles'"#, hardware: r#"none"#, unresolved: r#"the costs (2 and 1 from HM's edges, the wiki's low end); an access that starts within one instruction before the other chip's access the board ran first waits for it (the chips are run an instruction at a time); a word access right after a longword's first half is taken as its second half; simultaneous SDRAM writes 'will most likely lock up the system' (32XDK wiki), not modelled"#, }, ftoa_to_irl0: Quirk { value: r#"level | (1 - FTOA)"#, source: r#"the IRL level the core sees is the 32X's source level on /IRL3-/IRL1 with /IRL0 driven by FTOA: FTOA low asserts it"#, tier: RESEARCH, milestone: 2, documents: r#"32XDK wiki "FRT Bumping", from the schematic: "FTOA ... is connected directly to /IRL0 (on both CPUs)"; Morita's FAQ: SR = 0 lets FTOA "generate interrupt 0 and interrupt 1 requests continuously"; Bulletin #27: CMD taken at level 8, then 9"#, hardware: r#"testpico sets SR to $10 at start: "0 causes endless irq""#, unresolved: r#"none known"#, }, cmd_interrupt: Quirk { value: r#"INTM/INTS read/write; CMD follows them"#, source: r#"$A15102's INTM/INTS hold what is written (a 0 clears) and request CMD on the master/slave while set; an SH-2's write to $2000401A clears its own bit; a masked CMD waits and is taken when the mask opens"#, tier: HARDWARE_CORRECTED, milestone: 2, documents: r#"Manual 3.2.1: INTM/INTS "0: NO OPERATION", "1: Interrupt command", and "Both are automatically cleared if SH2 does not interrupt clear" (garbled); 3.2.2 point 1: CMD is asserted again when enabled"#, hardware: r#"the Mars Check Program's test 3, INTERRUPT REGISTER R/W (decision 5: hardware-corrected), writes INTS and expects to read back exactly that; testpico t_32x_irq_cmd reads 1 after $FFFD and 0 once the master's handler has cleared, and t_32x_init writes 0 before x32x_enable and reads 0 after"#, unresolved: r#"the Manual's "0: NO OPERATION" against the read-back the programs need"#, }, vint_latch: Quirk { value: r#"VINT for the rest of VBlank"#, source: r#"VINT asserts on both CPUs at VBlank whatever their masks and stays until that CPU clears it or VBlank ends; the mask only gates whether it is taken. HINT latches for a CPU whose H mask is set and stays until cleared"#, tier: HARDWARE_CORRECTED, milestone: 2, documents: r#"Manual 3.2.2: "Interrupt continues indefinitely until cleared""#, hardware: r#"testpico t_32x_irq_vint (2025; PicoDrive fails it): a slave whose V mask was clear across the start of VBlank takes VINT when it unmasks shortly after, and a master unmasked after line 0 takes none. The VBlank-end rule is this board's inference from that test, not a documented behaviour"#, unresolved: r#"whether VINT is a level of VBLK or a latch that VBlank's end clears; HINT's rule (no test seen)"#, }, vint_at: Quirk { value: r#"VBLANK's rise"#, source: r#"VINT is raised at the 32X VDP's VBLANK rise (vblank_after_hblank dots after the HBLANK that follows the last display row) and taken away at its fall, as events in order with the SH-2s' instructions (vdp.py)"#, tier: SPECIFICATION, milestone: 3, documents: r#"Manual 3.2.2: V interrupt factor "V Blank"; Manual 3.3 figure 3.15: VBLANK's edges 27 dots (224 MCLK) after HBLANK's rise"#, hardware: r#"testpico t_32x_irq_vint passes with it (milestone 3 run); the Mars Check Program's tests 51-52 count VINTs (any phase passes)"#, unresolved: r#"the 27 dots against other readings of figure 3.15; milestone 2 raised VINT at the first border line's start, about 50 dots earlier, and testpico passed either way"#, }, hint_counter: Quirk { value: r#"fire at 0 at HBLANK, reload at its fall"#, source: r#"at each HBLANK rise: HINT if the internal counter is 0 (then reloaded from the H count register when that HBLANK falls), else count down; inside VBLANK only with HEN -- without it nothing fires and the counter is reloaded at each fall"#, tier: SPECIFICATION, milestone: 3, documents: r#"Manual 3.2.2 point 3 and its two worked examples: the H count register is loaded into the internal counter when HBlank is negated; a value written outside HBlank takes effect at the second HBLANK after the next; HEN allows HINT in VBlank"#, hardware: r#"the Mars Check Program's tests 53-58 count HINTs over 30 frames: mode 0 (count 0, no HEN) 6,496-6,943 (the board: 224 a frame), mode 1 (HEN) 7,424-7,935 NTSC (262 a frame), mode 2 (count 5, HEN) 1,238-1,321"#, unresolved: r#"what the counter does in VBLANK without HEN; the board reloads, so the first HINT of a frame comes after row H count"#, }, sci_link: Quirk { value: r#"byte at once"#, source: r#"the two SCIs are crossed (one's TxD the other's RxD), each byte delivered when sent"#, tier: SPECIFICATION, milestone: 2, documents: r#"Manual 5.3 (the two SH-2s' serial lines); sh2-python's SCI is byte-level"#, hardware: r#"none"#, unresolved: r#"frame time from SMR/BRR; the shared SCK"#, }, rv_stall: Quirk { value: r#"made now, held until RV = 0"#, source: r#"an SH-2 cartridge access while RV = 1 is made at once and the chip is held (its time skewed) until a catch-up finds RV = 0"#, tier: SPECIFICATION, milestone: 2, documents: r#"Manual 3.2.1: "The SH2 side cannot access the ROM when RV = 1. Waits until value becomes 0""#, hardware: r#"none"#, unresolved: r#"a mapper or SRAM read during the stall sees the value from the access's start; RV = 1 with the SH-2s running from the cartridge can hang them (32XDK wiki)"#, }, dreq_fifo: Quirk { value: r#"8 words, DREQ0 while not empty"#, source: r#"68000 writes to $A15112 with 68S = 1 queue (8 words, FULL at 8); DREQ0 is held to both SH-2s while a word is queued; any SH-2 read of $20004012 takes one, the length counts down and 68S clears at 0"#, tier: ASSUMPTION, milestone: 2, documents: r#"Manual 3.2.1 (length, 68S, FULL), figure 3.28 (two 4-word FIFOs); 32XDK wiki: edge-triggered DREQ"#, hardware: r#"none"#, unresolved: r#"the DREQ edge and 4-word grouping; which SH-2 gets DREQ0; whether a CPU read of the FIFO works"#, }, sh2_vdp_without_fm: Quirk { value: r#"read 0, write ignored"#, source: r#"an SH-2 access to the VDP registers, palette or frame buffer with FM = 0"#, tier: SPECIFICATION, milestone: 2, documents: r#"Manual 3.1: "When the FM bit is 0, read is undefined and write is ignored"; Manual 3.4 says instead that the SH-2 "waits until the FM bit is 1""#, hardware: r#"none"#, unresolved: r#"the Manual's two accounts disagree; the undefined value"#, }, sh2_dreq_view: Quirk { value: r#"the FIFO's FULL and EMPTY; bits 2-0 as written"#, source: r#"$20004006 bits 15/14 read FULL and EMPTY of the frame buffer's write FIFO at the access's time (sh2_framebuffer_fifo; before milestone 5b always EMPTY); bits 2-0 are the 68000's 68S, bit 1 and RV"#, tier: HARDWARE_CORRECTED, milestone: 2, documents: r#"Manual 3.2.2: FULL/EMPTY of the "Frame Buffer, Write Cache""#, hardware: r#"testpico t_32x_sh_defaults reads $00004001 at $20004004 (EMPTY and RV); the Mars Check Program's tests 43-44 (MD & SH DREQ CTL R/W) write 7..0 at $A15107 and expect the SH-2 to read the same three bits back, bit 1 included (the Manual draws it as a fixed 0)"#, unresolved: r#"the FIFO's timing (sh2_framebuffer_fifo)"#, }, framebuffer_mirror: Quirk { value: r#"$04000000-$0403FFFF repeats every $40000 up to $05FFFFFF"#, source: r#"an SH-2 access above the overwrite image ($04040000 on, cache-through $24040000) reaches the same frame buffer and overwrite image again"#, tier: RESEARCH, milestone: 3, documents: r#"Manual 3.1 maps the frame buffer at $04000000 and its overwrite image at $04020000 and says nothing above. The 32XDK wiki (Video.md, 'The Frame Buffer'): 'an undocumented mirror for the framebuffer at address range 0x24040000 - 0x24060000 used by the prototype game "Soulstar X"' (community document, citing ares issue 744). OBSERVED (ares 9408cb4, M32X::readInternal and writeInternal): reads fold $04000000-$05FFFFFF onto the 128 KB buffer, writes fold it every $40000"#, hardware: r#"none here; the wiki's statement rests on a prototype written for real hardware, not on a measurement"#, unresolved: r#"how far the mirror runs. Re-established 2026-11-19 from the wiki and ares only (docs/provenance.md, wave 2)"#, }, pwm_registers: Quirk { value: r#"registers and three-deep FIFOs; mono status reads L"#, source: r#"control (the 68000 writes the routing bits, the SH-2s all of TM, RTP and the routing), cycle (12 bits), and three-deep pulse-width FIFOs reporting FULL/EMPTY; a write to a full FIFO drops the oldest; $38 (mono) writes both FIFOs and reads the left one's FULL/EMPTY"#, tier: HARDWARE_CORRECTED, milestone: 2, documents: r#"Manual 3.2.1 (registers, three-deep FIFOs, the oldest discarded when full, the counter stopped with both channels off, the off side draining; bits 11-0 of the width registers "write only. When read is performed, undefined data is read": the board reads 0 there, a choice); bit 4 (ares 9408cb4 calls it MONO) is not in the Manual and not kept. 32X Technical Information: 'Ver. 1.0 cannot read the PWM register; Ver 2.0 can' (the board reads as 2.0)"#, hardware: r#"the Mars Check Program's tests 11-15 and 24-35 (register R/W, cycle $800, one channel on): EMPTY within 5 frames, not EMPTY after two writes, FULL within 2 s of writing; its sound tests 137-139 wait for EMPTY on $38"#, unresolved: r#"what $38 reads (the board: the L FIFO's FULL/EMPTY, a choice): ares 9408cb4 FULL if either FIFO is full and EMPTY if both are empty; MAME's mega32x.cpp (BSD-3-Clause, f379cd0) the AND of the two; all agree whenever both FIFOs were written through $38"#, }, bitmap_bits: Quirk { value: 195, source: r#"the bitmap mode register's writable bits: M1-M0, 240 at bit 6, PRI at bit 7"#, tier: SPECIFICATION, milestone: 2, documents: r#"the Manual's scan (PDF page 36, "Bitmap Mode Register"): PAL bit 15 read only, PRI bit 7, 240 bit 6, M1-M0 bits 1-0, the rest unused; the 32XDK markdown transcription garbles it (PRI 13, 240 7)"#, hardware: r#"the Mars Check Program's test 59 writes 3..0 and $C0..$00 and reads back under the mask $C3"#, unresolved: r#"none"#, }, auto_fill: Quirk { value: r#"written at once; FEN for 7 + 3 x (length + 1) Sclk"#, source: r#"the fill's words are written when its data register is written; FEN reads 1 for 7 + 3 x words SH-2 clocks; a CPU's frame-buffer access meanwhile is not held, and a second fill while busy runs too (its time added after the first's)"#, tier: SPECIFICATION, milestone: 3, documents: r#"Manual 3.3 "FILL Function": "Fill execution time = 7 + 3 x length (cycle)"; 3.2.3: FEN "1: Access denied (FILL in progress)"; "do not access from SH2" while it runs. The cycle is taken as Sclk (ares reads it so: OBSERVED, ares 9408cb4, M32X::VDP::fill)"#, hardware: r#"the Mars Check Program's tests 101-112 poll FEN to 0 after each fill and check the words; nothing times it"#, unresolved: r#"the cycle's unit; what a CPU access during a fill does (waits or corrupts); ares ignores a fill started while one runs"#, }, hblank_phase: Quirk { value: 12, source: r#"the 32X VDP's HBLANK rises this many dots (Mega Drive pixels, slow ones counted as one) before the Mega Drive's HBlank flag sets: H40 H $15A (external $AD), so its 320-dot display runs H $01A-$159 of the Mega Drive's H counter. The same place is 23 EDCLK dots before EDCLK's first slow dot, HSYNC's fall (184 MCLK); in H32 the board places it so (edclk_h32)"#, tier: SPECIFICATION, milestone: 3, documents: r#"Manual 3.3 figures 3.15 and 3.17 give four spans in both dots and MCLK: HBLANK to PEN 3 dots = 24 MCLK, to VBLANK 27 = 224, to the latch 76 = 668, blank 100 = 860. Counted on the Mega Drive's H40 line as megadrive-python's socket 6 hands it over (8 MCLK pixels, 10 around HSYNC), all four hold at once only for an HBLANK 12 dots before the HBlank flag (11 gives 226 for VBLANK, 13 gives 222; the board's scan of the phase, docs/worklog.md Session 4); the 32X takes HSYNC and EDCLK off the slot (service manual A408a). Sega's 32X H/W Information (MAR-25, item 4) says production units put the 32X's picture on the Mega Drive's within half a dot"#, hardware: r#"none: no hardware-corrected program times HBLANK within a line"#, unresolved: r#"XHDISP (figure 3.15, 3 dots after HBLANK both ways) bounds the 100 and 320 dots in the figure; it is not modelled. (Statements resting on other emulators' source and on a source-read die-model probe were struck 2026-11-19, docs/provenance.md, wave 2)"#, }, edclk_h32: Quirk { value: 368, source: r#"in H32, EDCLK on the slot keeps H40's 8-MCLK dots and its slow run around HSYNC; the slow run starts 368 MCLK into the H32 line (provisional), so the 32X's line spans come out in the Manual's MCLK figures as in H40"#, tier: ASSUMPTION, milestone: 3, documents: r#"RESEARCH: Jorge Nuno (spritesmind t=519, a scope on a real console): EDCLK is the bus arbiter's (315-5433) MCLK/4, switched to MCLK/5 while HSYNC is held low; Nemesis (spritesmind t=851, t=1291, logic analyser): RS0 makes the VDP take EDCLK for its serial clock, and in H32 the VDP runs on its own MCLK/5, so EDCLK is made outside the VDP whatever the H mode. OBSERVED (ares 9408cb4): ares draws the 32X's 320 pixels at the H40 rate in H32 too (composite_dot). The 368: HYPOTHESIS, the slow run as far after the H32 HBlank flag ($126) as megadrive-python's H40 line puts it after the H40 flag ($166): 88 MCLK"#, hardware: r#"none for where HSYNC falls in an H32 line"#, unresolved: r#"where HSYNC falls in H32 (a scope on HSYNC against the V counter's increment would settle it). Before 2026-11-19 the value was 374, measured on a GPL die model by a probe written against its source; that measurement is out as evidence and the value was re-derived as above (docs/provenance.md, wave 2)"#, }, hblank_timing: Quirk { value: HblankTiming { pen: 3, latch: 76, blank: 100 }, source: r#"dots after HBLANK's rise: PEN rises (and falls with HBLANK), the registers latch, HBLANK falls and the row's display starts"#, tier: SPECIFICATION, milestone: 3, documents: r#"Manual 3.3 figures 3.15 and 3.17: blank period 100 dots (860 MCLK), display 320 dots (2,560 MCLK), H Blank to PEN 3 dots (24 MCLK), H Blank to latch 76 dots (668 MCLK); figure 3.17 draws PEN falling with HBLANK; registers written before the latch apply to this line, after it to the next"#, hardware: r#"the Mars Check Program's tests 63-65 and 75-80 need HBLK and PEN to rise and fall within two Mega Drive H interrupts"#, unresolved: r#"PEN's fall (figure 3.17 draws it with HBLANK's; XHDISP, figure 3.15, falls 3 dots after); Manual 5.3 point 5's 1-us window before PEN falls, where a palette access is undefined, is not modelled"#, }, fen_refresh: Quirk { value: 40, source: r#"FEN reads 1 for this many SH-2 clocks from each HBLANK rise, VBLANK included (the VDP-side DRAM refresh)"#, tier: SPECIFICATION, milestone: 3, documents: r#"Manual 3.3 figure 3.17: "B: FEN Width 40 Sclk (VDP side refresh)"; "When the DRAM is being refreshed FEN is 1, but access of the DRAM is possible". The figure also draws narrower FEN pulses through the line, unmeasured"#, hardware: r#"none"#, unresolved: r#"the narrow pulses (not modelled); whether a CPU access waits for them"#, }, palette_wait: Quirk { value: r#"held until PEN"#, source: r#"a CPU's palette access while PEN = 0 is held until PEN = 1 (the 68000 through Board.hold, an SH-2 through its WAIT states); the access itself is made at once"#, tier: SPECIFICATION, milestone: 3, documents: r#"Manual 3.3: "If accessing when PEN = 0, wait is held until PEN = 1"; 4.1: palette 5 to 64 us (SH-2), to 64 us (68000); 3.2.3: PEN is 1 in H and V blank, in direct colour mode and in blank mode"#, hardware: r#"the Mars Check Program's tests 114 and 118-119 write the palette during display (it waits for HBLK = 0 first) and read it back"#, unresolved: r#"the latched or the written mode decides PEN (the board: latched); ares never holds (OBSERVED, M32X::VDP::paletteEngaged)"#, }, fs_swap: Quirk { value: r#"at once in VBLANK or blank mode, else at VBLANK"#, source: r#"an FS write swaps at once when VBLK = 1 or the bitmap mode register (as written) is blank; otherwise at the next VBLANK, or at a register latch that finds blank mode, reading the displayed buffer until then"#, tier: SPECIFICATION, milestone: 3, documents: r#"Manual 3.2.3: "Swapping ... is allowed during V Blank (VBLK = 1) or when in blank mode ... when written during display, swapping is done at the next V Blank. With respect to read, the value which indicates DRAM during display until the next V Blank is returned""#, hardware: r#"the Mars Check Program's test 66 writes FS and reads it back a frame later; its frame-buffer tests swap in blank mode and use the buffer at once"#, unresolved: r#"'blank mode' as written or as latched (provisional: the board does both)"#, }, screen_shift_modes: Quirk { value: r#"packed pixel only"#, source: r#"the screen shift register's SFT moves packed-pixel rows by one pixel; direct colour and run-length rows ignore it (provisional; changed 2026-11-19)"#, tier: EMULATOR, milestone: 3, documents: r#"the 32XDK wiki (Video.md): 'When LSB is set to 1, the screen is shifted by 1 pixel to the left', and its reason: the line table's word offsets move 256-colour pixels two at a time, 'Because of that, the SuperVDP has a one pixel scroll setting'. A word a pixel (direct colour, run length) needs no such setting; the Manual's scan does not say which modes it acts in. OBSERVED (ares 9408cb4, M32X::VDP::scanlineMode1): ares shifts packed pixel only"#, hardware: r#"none"#, unresolved: r#"whether direct colour and run length shift on hardware (a test ROM written for it would settle it). The board shifted all three modes before 2026-11-19; that choice rested on non-permissive emulators' source and was replaced (docs/provenance.md, wave 2)"#, }, blank_row: Quirk { value: r#"transparent"#, source: r#"a row in blank mode is no 32X pixel at all (None in the 32X-only frame, black in its PNG)"#, tier: SPECIFICATION, milestone: 3, documents: r#"Manual 3.3 "Priority": "when the 32X designates blank by the VDP register, [it] becomes transparent and the MD background is displayed""#, hardware: r#"none"#, unresolved: r#"none for the 32X alone; the composite is milestone 4"#, }, rgb_levels: Quirk { value: r#"v << 3 | v >> 2"#, source: r#"each 5-bit level as 8 bits for the 32X-only PNG"#, tier: ASSUMPTION, milestone: 3, documents: r#"Manual 3.3 "Color Palette": BGR555 + through bit; the RAMDAC's levels are not given"#, hardware: r#"none (no capture; decision 6)"#, unresolved: r#"the RAMDAC's levels against the Mega Drive's DAC (spritesmind t=1160)"#, }, unused_registers: Quirk { value: r#"open bus"#, source: r#"$A15140-$A1517F: no register in Manual 3.2.1 and no test reads it; read as the board reads an undecoded $A1 address (its next opcode's MSB), writes ignored"#, tier: ASSUMPTION, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, // -- the system registers ----------------------------------------------------------- adapter_power_on: Quirk { value: 130, source: r#"$A15100 = REN | RES after power-on: testpico t_32x_init (`expect(ok, r16[0x00/2], 0x82)`, after waiting for REN). Manual 3.2.1 gives FM, RES and ADEN initial values of 0 (RES "0: Reset") and REN as R/W; testpico wins"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, adapter_writable: Quirk { value: 32771, source: r#"FM (bit 15), RES (bit 1) and ADEN (bit 0) are writable; REN (bit 7) reads 1 whatever is written: testpico t_32x_init writes 0 and reads $0080, writes $FFFE and reads $8082. The Manual's REN 'R/W' is not what the hardware does"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, dreq_control_writable: Quirk { value: 7, source: r#"$A15106: RV (bit 0), bit 1 and 68S (bit 2) hold what is written; testpico t_32x_init writes $FFFF and reads 7. The Manual draws bit 1 as a fixed 0; ares keeps a 'dma' bit there. FULL (bit 7) is read-only (Manual)"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, dreq_source_mask: Quirk { value: 16777214, source: r#"the DREQ source address is 24 bits with bit 0 fixed 0: testpico t_32x_reg_w writes $FFFFFFFF and reads $00FFFFFE (Manual 3.2.1: high order at $A15108, low at $A1510A, "bit 0")"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, dreq_destination_mask: Quirk { value: 16777215, source: r#"the DREQ destination address is 24 bits, bit 0 kept: testpico t_32x_reg_w reads $00FFFFFF after writing $FFFFFFFF"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, dreq_length_mask: Quirk { value: 65532, source: r#"the DREQ length ignores its low two bits ("00 fixed", Manual 3.2.1); testpico t_32x_reg_w reads $FFFC after writing $FFFF"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, dreq_length_power_on: Quirk { value: 65535, source: r#"the DREQ length reads $FFFF after a cold power-on, a value no write can make: testpico t_32x_init (`if (r16[0x10/2] != 0x1234) expect(ok, r16[0x10/2], 0xffff)`, 0x1234 being its warm-reset marker)"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, dreq_address_power_on: Quirk { value: 0, source: r#"the DREQ addresses' power-on value: testpico t_32x_init checks only that their high bytes read 0 ("08,0c have garbage or old values (survive MD's power cycle)"); the board starts them at 0"#, tier: ASSUMPTION, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, fifo_read: Quirk { value: 0, source: r#"$A15112 (the FIFO, write-only in Manual 3.2.1) reads 0: testpico t_32x_init expects 0 after power-on; what it reads after writes is not tested"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, reads_zero: Quirk { value: &[20, 22, 24, 28, 30], source: r#"$A15114-$A15119 and $A1511C-$A1511F read 0 whatever is written: testpico t_32x_init writes $FFFFFFFF to $14, $18 and $1C and reads 0 at $14, $16, $18, $1C"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, sega_tv_writable: Quirk { value: 257, source: r#"SEGA TV ($A1511A): bits 0 and 8 hold what is written; testpico t_32x_init reads $0101 after $FFFF. The Manual names bit 0 (CM) only"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, interrupt_control_writable: Quirk { value: 3, source: r#"INTS (bit 1) and INTM (bit 0) of $A15102: testpico t_32x_init reads 3 after $FFFF and t_32x_irq_cmd reads 1 after $FFFD. They clear when an SH-2 clears its CMD interrupt (Manual 3.2.1); with no SH-2s (milestone 1) they hold"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, bank_writable: Quirk { value: 3, source: r#"BK1:BK0 of $A15104 (Manual 3.2.1); testpico t_32x_init reads 3 after $FFFF"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, comm_both_write: Quirk { value: r#"last writer"#, source: r#"a communication port written by both sides at once "becomes undefined" (Manual 3.2.1); games avoid it; the board keeps the last write"#, tier: ASSUMPTION, milestone: 2, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, registers_survive_button: Quirk { value: true, source: r#"the reset button leaves the 68000-side registers as they were (ADEN, RV, the bank, the DREQ registers, the communication ports): testpico t_32x_reset_btn reads $A15100 = $8083 and the values t_32x_reset_prep wrote, after the press. What the 68000's RESET instruction does to them: no source; the board does nothing"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, framebuffer_zero_bytes: Quirk { value: r#"byte $00 to the frame buffer, any $00 byte to the overwrite image, is dropped"#, source: r#"Manual 3.3 and 3.6 ("data 0 byte write is ignored"); testpico t_32x_md_fb pins it for byte and word writes to both images"#, tier: HARDWARE_CORRECTED, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, z80_writes_lock_68000: Quirk { value: false, source: r#"32X Technical Note 15 (as quoted in the 32XDK wiki): Z80 writes to $840000-$9FFFFF and $A15100-$A153FF lock the 68000, "supposedly fixed"; which revision fixed it is unknown. Not modelled: the Z80 reaches the 32X through the same decode as the 68000's byte accesses (Manual 3.4 access table, the 'V' column)"#, tier: RESEARCH, milestone: 1, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, // -- later milestones (recorded now; not read yet) ------------------------------- pwm_period: Quirk { value: r#"cycle - 1"#, source: r#"a period is (cycle - 1) & $FFF SH-2 states: cycle 1 stops the counter, cycle 0 gives 4,095. DOC (Manual 3.4)"#, tier: SPECIFICATION, milestone: 5, documents: r#"Manual 3.4, "Cycle and Pulse Width Settings": "The cycle register obtains the required sampling rate with the set value - 1 as a multiple of the base clock cycle. When the set value = 0 the cycle is at a maximum (4095 times the base clock cycle). When the set value = 1 (0 times the base clock cycle) PWM will no longer operate and should not be set"; its example: 1047 gives 23.01 MHz / 1046 = 22 kHz. 3.2.1 says only "set value x Scyc becomes the cycle" (Scyc one SH-2 clock, 23.01 MHz NTSC, 22.8 MHz PAL)"#, hardware: r#"none: the Mars Check Program's tests time nothing finer than a frame"#, unresolved: r#"none between the documents (3.4 refines 3.2.1); ares 9408cb4 and MAME's mega32x.cpp (BSD-3-Clause, f379cd0) also run cycle - 1. Only this value is built (pwm.py refuses another)"#, }, pwm_fifo: Quirk { value: r#"pop at the period's start"#, source: r#"each channel's FIFO gives up its oldest width as a period begins, and that width plays for the whole period; an empty FIFO leaves the width it last gave (DOC, Manual 3.4). The pop as the period begins: OBSERVED (ares 9408cb4, M32X::PWM::main reads both FIFOs, then waits out the period); provisional. The counter stops only at a period's end and begins a new period the moment it may run again, so a width written while it was stopped plays at once: the board's choice"#, tier: EMULATOR, milestone: 5, documents: r#"Manual 3.4: "The pulse width is refreshed per each sampling cycle. When FIFO is empty, the previous pulse width is held. Immediately after reset, FIFO is empty and the pulse width is 0"; 3.2.1: "the cycle counter does not operate when both L ch and R ch are off". Where in the cycle the refresh falls: not said"#, hardware: r#"none: the Mars Check Program's tests 13-15 wait up to 5 frames for EMPTY, which either phase passes"#, unresolved: r#"the phase: MAME's mega32x.cpp (BSD-3-Clause, f379cd0) hands the FIFO's head to its DAC as a period ends instead; the two differ by one period after the counter starts. Whether a stopped counter holds its place mid-period (the board lets the period under way finish, as ares does) is not documented"#, }, pwm_routing: Quirk { value: r#"LMD 1 L, 2 R; RMD 1 R, 2 L; 0 and 3 silent"#, source: r#"each output plays the channel its field names: LMD (bits 1-0) 1 the L channel, 2 the R channel; RMD (bits 3-2) 1 R, 2 L; 0 and the prohibited 3 nothing. Either field non-zero runs the counter"#, tier: SPECIFICATION, milestone: 5, documents: r#"Manual 3.2.1's table (RMD 01 R, 10 L; LMD 01 L, 10 R; 11 'Not allowed'; 'Both cannot be set to L ch or R ch'), read as the output each field drives"#, hardware: r#"none judged; the Mars Check Program's pan tests (143-144, 148-149; SHSOUND.SRC) write only the L channel's FIFO and move from control 1 to 8 (RMD 2), which pans left to right only under this reading (the other, 'the R channel goes out L', would fall silent); the program counts no error either way"#, unresolved: r#"what 3 does: ares 9408cb4 plays nothing on that output, as the board; MAME's mega32x.cpp (BSD-3-Clause, f379cd0) leaves it undefined. Whether 3 alone runs the counter: ares runs it only for a field of 1 or 2, the board for any non-zero field (a choice). All agree on 1 and 2"#, }, pwm_byte_writes: Quirk { value: r#"even byte held, odd byte queues"#, source: r#"a byte write to a width register's even (high) byte is held; one to its odd byte queues the held byte with it; a word queues at once; the held byte is kept after use. Each of L, R and mono holds its own. OBSERVED (ares 9408cb4, io-external.cpp and io-internal.cpp: lfifoLatch, rfifoLatch, mfifoLatch); provisional. The Mars Check Program's Z80 tests (154-156, Z80TEST.SRC) write the high byte, then the low"#, tier: EMULATOR, milestone: 5, documents: r#"Manual 3.4: "any register can be accessed in bytes, the MEGA Drive side can ... be accessed from the 68000 or Z80"; nothing on when a byte queues"#, hardware: r#"none: tests 154-156 count no error under any reading"#, unresolved: r#"when a byte queues has no document; MAME's mega32x.cpp (BSD-3-Clause, f379cd0) takes word writes only"#, }, pwm_timer_restart: Quirk { value: r#"on an SH-2 TM write"#, source: r#"the count of periods toward the next timer interrupt starts again from 0 when an SH-2 writes the control register's TM byte (bits 15-8); a 68000 write (TM is read only there), an SH-2 write of the low byte alone, a cycle write and the counter stopping all leave it. OBSERVED (ares 9408cb4, io-internal.cpp: the SH-2's upper-byte write of $20004030 clears the period count); provisional"#, tier: EMULATOR, milestone: 5, documents: r#"Manual 3.2.1: "TM3-0: PWM timer interrupt interval (Read only from MD side; set from SH2 side)"; 3.2.2: "Interrupt occurs by cycle register set value x TM cycle. When TM = 1, the interval is the same as the cycle register. When TM = 0, the interval is 16 times the cycle register". When the count starts: not said"#, hardware: r#"none"#, unresolved: r#"MAME's mega32x.cpp (BSD-3-Clause, f379cd0) restarts the count and the period on any control or cycle write (and empties the FIFOs); ares on a TM write only, as the board"#, }, pwm_cycle_write: Quirk { value: r#"kept"#, source: r#"a write to the cycle register does not restart the period under way; the new length applies from the next period's start. OBSERVED (ares 9408cb4: M32X::PWM::main takes the length as each period begins); provisional"#, tier: EMULATOR, milestone: 5, documents: r#"none"#, hardware: r#"none"#, unresolved: r#"MAME's mega32x.cpp (BSD-3-Clause, f379cd0) restarts the period on a cycle write; ares keeps it, as the board. Only this value is built"#, }, pwm_dreq1: Quirk { value: r#"with each timer interrupt, both SH-2s, one step"#, source: r#"with RTP = 1, each timer interrupt (every TM periods) also raises DREQ1: DOC (Manual 3.4). On both SH-2s: DOC as read (the System Overview, below), as ares 9408cb4 does. Each chip's DMAC seeing it at the start of its next step and the request dropping after that step (sh2side.py), and an SH-2 write of RTP = 0 dropping it at once: OBSERVED (ares 9408cb4: sh7604.cpp clears a chip's after its instruction, io-internal.cpp clears both on RTP = 0); provisional"#, tier: EMULATOR, milestone: 5, documents: r#"Manual 3.4, the functions of 32X PWM: "Timer interrupt for SH2"; "Can output the same signal as a transfer request (DREQ1) for DMAC built-in SH2"; 3.2.1: "RTP: DREQ1 occurrence enable (SH2 side only)"; 3.2.2: "TM0-3 set the PWM timer interrupt interval and ROM to PWM transfer cycle". The 32XDK wiki's transcription of Sega's DMA note: channel 1 serves the PWM pulse width register, "External requests should be used by the edge trigger, not the level trigger". Sega's Genesis Super 32X System Overview and Hardware Reference (1994, page 33): "The ROM to PWM DMA is also a dual address mode"; "DMA can set both master and slave, but both should not be set at the same time" (so either chip's DMAC can be paced). How long the request lasts: not said"#, hardware: r#"none judged: the Mars Check Program has both 'SH2 MASTER PWM DMA WRITE' (152) and 'SH2 SLAVE PWM DMA WRITE' (153), so Sega's own diagnostic expects either chip's DMAC to be paced by it; both count no error under any reading"#, unresolved: r#"the request's length (one step is a choice that suits the edge trigger the note asks for)"#, }, pwm_needs_aden: Quirk { value: true, source: r#"the cycle counter stops while ADEN = 0 (the FIFOs and registers stay writable)"#, tier: ASSUMPTION, milestone: 5, documents: r#"the service manual's block diagram (A406a): the 32X's clock runs only with the MARS bit set; PWM counts SH-2 clocks (Manual 3.2.1)"#, hardware: r#"none"#, unresolved: r#"whether the I/F chip's PWM shares the gated SH-2 clock"#, }, pwm_output_level: Quirk { value: r#"duty cycle of width - 1"#, source: r#"each output's level is its pulse's duty cycle, min((width - 1) & $FFF, period) / period, 0.0 to 1.0 (written 1 is 0.0, written 0 is 4,095 states: full): the height rule is DOC (Manual 3.4); unipolar, as the pulse is, clamped at the period, 0 when routed off or stopped, and the 32X's own integrator and mixer (IC11) not modelled: those are the board's choices. Socket 8 adds it after the Mega Drive's low-pass and before its coupling capacitor, which takes the standing level away"#, tier: ASSUMPTION, milestone: 5, documents: r#"Manual 3.4: "The integrated wave form converts the pulse width to wave height"; "Because the set value - 1 is the height, when 1 is set, the maximum negative point of the amplitude is 0; and when 0 is set, the maximum positive point of the amplitude is 4095"; "Immediately after reset, FIFO is empty and the pulse width is 0"; 3.2.1: "the value set by bit 11-0 x Scyc becomes the pulse width""#, hardware: r#"none: no recording of a 32X exists here (decision 6)"#, unresolved: r#"the analogue path: ares 9408cb4 plays the written width over the period through a DC filter, clamping at full scale; MAME's mega32x.cpp (BSD-3-Clause, f379cd0) writes the width to a DAC. Neither subtracts 1"#, }, pwm_gain: Quirk { value: 6100.0, source: r#"socket 8's gain: a full duty swing (0.0 to 1.0) is 6,100 of the FM's summed-DAC units, half the FM's full range (+/-6,100)"#, tier: ASSUMPTION, milestone: 5, documents: r#"none: the service manual shows IC11 mixing L/R PWM onto the slot's SL1/SR1 and gives no levels"#, hardware: r#"none: no recording (decision 6; validation.md, 'What a judge would cost')"#, unresolved: r#"the level against the Mega Drive's FM and PSG on any model or cabling"#, }, vblank_after_hblank: Quirk { value: 27, source: r#"VBLANK rises this many dots after the HBLANK that follows the last display row, and falls this many after the one before row 0; rows are 224, or 240 with the 240 bit on PAL, counted from the Mega Drive's V counter"#, tier: SPECIFICATION, milestone: 3, documents: r#"Manual 3.3 figure 3.15: C = HBLANK to VBLANK 27 dots (224 MCLK), drawn at both VBLANK edges; figure 3.16: blank periods 38, 89 and 73 lines (NTSC, PAL 224, PAL 240) -- the 32XDK transcription's '38h/89h/73h' is '38H' = 38 lines"#, hardware: r#"testpico t_32x_irq_vint and the Mars Check Program's tests 63 and 75-76 (VBLK) pass with it"#, unresolved: r#"none known; no test here times VBLANK's rise within a line"#, }, screen_shift_ff_exception: Quirk { value: true, source: r#"the screen shift is ignored on a row whose line-table entry's low byte is $FF"#, tier: HARDWARE_CORRECTED, milestone: 3, documents: r#"Technical Bulletin #14 (1994-09-23): "the shift bit becomes invalid when the lower byte of the base address set in the line table is $FF""#, hardware: r#"none here (an emulator's comment that it was verified is not a hardware fact, owner's ruling 2026-11-19); Sega's bulletin is the source"#, unresolved: r#"none"#, }, hcount_read: Quirk { value: r#"set value"#, source: r#"the H count register reads back the value set, not the internal counter (vdp.py keeps that apart, as hint_counter)"#, tier: EMULATOR, milestone: 3, documents: r#"Manual 3.2.2 names the register R/W and says nothing of reading the internal counter"#, hardware: r#"the Mars Check Program's tests 22-23 write and read it back"#, unresolved: r#"Near (ares, spritesmind t=3218) returns the set value to avoid a Virtua Fighter lock-up; no source says what hardware returns"#, }, // -- the composite (milestone 4): detectors only, docs/claims.md -------------------- composite_rule: Quirk { value: r#"32X if not blank and (through ^ PRI or MD transparent)"#, source: r#"per pixel: the 32X's pixel where its row is not in blank mode and either its through bit (bit 15) differs from PRI or the Mega Drive shows nothing there (composite_md_transparent); the Mega Drive's pixel otherwise. A blank row hands the Mega Drive's line back untouched"#, tier: SPECIFICATION, milestone: 4, documents: r#"Manual 3.3 "Priority" and figure 3.9 (scan, PDF page 48): PRI = 0 puts the 32X behind the Mega Drive, PRI = 1 in front; a through-bit pixel goes to "the side opposite of the MD screen"; "When the MD color code is 0, and when the 32X designates blank by the VDP register, each becomes transparent. If both are transparent, the MD background is displayed" (figure 3.9's bottom pair). Service manual A406a/A408a: an analog switch (IC12) driven by YSO, which the 32X VDP makes from the Mega Drive's -MYS, PRI, the through bit and its mode"#, hardware: r#"none: no capture of a 32X picture exists (decision 6). Near (t=3218): Spider-Man (PRI = 1, no through bit anywhere, he says) needs the Mega Drive's sprite and text over the 32X, Knuckles' Chaotix (PRI = 1, sprites through = 0) needs the 32X's sprites over the Mega Drive's background: one rule could not satisfy both. This rule is figure 3.9's; the two games' frames are in docs/validation.md, Milestone 4"#, unresolved: r#"ares's rule (OBSERVED, M32X::VDP::plot) has this form; what transparent means is composite_md_transparent. A blank row gives the Mega Drive's line (the Manual, ares and the board)"#, }, composite_md_transparent: Quirk { value: r#"YS"#, source: r#"the Mega Drive is transparent where socket 7's YS is 1: no plane or sprite pixel shows (the backdrop, whatever its colour; an S/H operator sprite shows nothing)"#, tier: RESEARCH, milestone: 4, documents: r#"Manual 3.3 "Priority": "When the MD color code is 0"; service manual A406a: the switch follows -MYS off the slot. TmEE (t=3218): YS is "no BG or sprite pixel was rendered", not tied to any colour, and the VDP never draws colour 0 of a palette from a plane or sprite, so the two readings differ only when the backdrop register names a colour other than 0 of its palette"#, hardware: r#"none"#, unresolved: r#"ares, as the board (its DAC's backdrop flag, OBSERVED); the Manual's words read literally (the final CRAM index's colour is 0, so a backdrop on colour 1-15 is opaque) would differ"#, }, composite_ys_shadow: Quirk { value: r#"ignored"#, source: r#"YS under shadow/highlight is socket 7's YS as it stands: a shadowed or highlighted backdrop is still transparent, the shade is not looked at"#, tier: ASSUMPTION, milestone: 4, documents: r#"none: no source says what -MYS does under shadow/highlight"#, hardware: r#"none"#, unresolved: r#"what YS does for a shadowed or highlighted backdrop and for the S/H operator sprites (palette 3 colours 14, 15); socket 7 hands the shade per pixel over so this can change without a socket change. ares behaves as the board"#, }, composite_alignment: Quirk { value: CompositeAlignment { h40: 0, h32: 26 }, source: r#"master clocks from the Mega Drive's output pixel 0 (socket 7's display_at + output_delay x pixel_mclk) to the 32X's pixel 0: H40 one on one; H32 26 MCLK (3.25 32X pixels) to the right (provisional; 30 before 2026-11-19). The line starts at the Mega Drive's output pixel 0 and runs to the end of the 32X's last pixel (324 wide in H32)"#, tier: EMULATOR, milestone: 4, documents: r#"Sega, 32X H/W Information (MAR-25-R5/R6-060694, item 4, 'Display dot distortion with MD'): 'Between 1/2 dot left to 1/2 dot right for mass production goods': H40 one on one (DOC). H32: OBSERVED (ares 9408cb4, md/vdp main.cpp: an offset of 13 quarter H40 pixels, 'approx 3 and 1/4 pixel'), 26 MCLK"#, hardware: r#"none"#, unresolved: r#"H32 on hardware (a video capture of a 32X over an H32 Mega Drive picture). BlastEm's frames (closed box) put the 32X about 3.75 pixels right (validation.md, Milestone 4); 26 takes the 32X's pixel x - 3 under output pixel x. The 32X's RAMDAC delay is taken as none (the H/W Information's half dot leaves no room for one in H40). The earlier 30 was placed on a GPL die model's EDCLK, read through its source: out as evidence (docs/provenance.md, wave 2)"#, }, composite_dot: Quirk { value: 8, source: r#"the 32X's pixel is 8 MCLK in either Mega Drive mode: in H32 its 320 pixels span the Mega Drive's 256 (2,560 MCLK each)"#, tier: SPECIFICATION, milestone: 4, documents: r#"Manual 3.3 figure 3.15: 320 dots = 2,560 MCLK, a line of 420 dots; the 32X takes EDCLK off the slot (service manual A408a, IC6). RESEARCH: EDCLK is the bus arbiter's MCLK/4 with MCLK/5 while HSYNC is low, made outside the VDP whatever the H mode (Jorge Nuno, spritesmind t=519; Nemesis, t=851; edclk_h32). OBSERVED (ares 9408cb4): ares draws the 32X at that rate in H32 too"#, hardware: r#"none"#, unresolved: r#"a first-generation console's discrete arbiter against later ones: assumed the same"#, }, composite_border: Quirk { value: r#"YS"#, source: r#"a 32X pixel off the Mega Drive's active picture (H32's right edge) sees the Mega Drive's border as YS = 1, so the 32X's pixel shows"#, tier: ASSUMPTION, milestone: 4, documents: r#"none (socket 7 does not hand border pixels over)"#, hardware: r#"none"#, unresolved: r#"what -MYS does in the border is not documented"#, }, composite_levels: Quirk { value: r#"full scale both"#, source: r#"the 32X's RAMDAC levels (rgb_levels, v << 3 | v >> 2) beside the Mega Drive's DAC levels as megadrive-python gives them, each at its own full scale, unscaled"#, tier: ASSUMPTION, milestone: 4, documents: r#"none: the Manual gives 32 levels per channel, no voltages"#, hardware: r#"none (spritesmind t=1160: emulator colours differ; no measurement)"#, unresolved: r#"the RAMDAC's output against the Mega Drive's on the same screen; each detector expands its own way (validation.md, Milestone 3: up to 8 of 255)"#, }, cartridge_boards: Quirk { value: &[("T-8102B", "rom_nbajamte"), ("T-8104B", "rom_nbajamte")], source: r#"the 32X cartridges with a serial EEPROM, by the serial in their header, and megadrive-python's board for them: NFL Quarterback Club (T-8102B) and NBA Jam Tournament Edition (T-8104B), Acclaim's type 2 wiring with a 24C02"#, tier: RESEARCH, milestone: 7, documents: r#"Eke-Eke's gen_eeprom.pdf (community document, megadrive-python's reference/docs/md_tech.zip): ACCLAIM type 2, SDA $200001 bit 0, SCL $200000 bit 0, 24C02, for NBA Jam Tournament Edition and NFL Quarterback Club. OBSERVED (MAME bus/megadrive/eeprom.cpp, BSD-3-Clause): the same table, with a row 'NBA Jam TE (32x)'. The serials read from the No-Intro images' headers"#, hardware: r#"none"#, unresolved: r#"other 32X titles with a save chip (none known here). Re-established 2026-11-19 from the document and MAME only (docs/provenance.md, wave 2)"#, }, sh2_cartridge_priority: Quirk { value: true, source: r#"the SH-2 wins the cartridge when both CPUs want it (Manual 3.4, "ROM Access Competition"); RV = 1 makes the SH-2 wait instead (Manual 3.2.1)"#, tier: SPECIFICATION, milestone: 2, documents: r#""#, hardware: r#""#, unresolved: r#""#, }, } } } impl Quirks { /// Every quirk by field name, in declaration order, with its source and tier. pub fn table(&self) -> Vec<(&'static str, &'static str, &'static str)> { vec![ ("mars_id", self.mars_id.source, self.mars_id.tier), ("vector_rom_with_rv", self.vector_rom_with_rv.source, self.vector_rom_with_rv.tier), ("hint_vector_power_on", self.hint_vector_power_on.source, self.hint_vector_power_on.tier), ("low_map_without_rv", self.low_map_without_rv.source, self.low_map_without_rv.tier), ("windows_with_rv", self.windows_with_rv.source, self.windows_with_rv.tier), ("vdp_side_with_fm", self.vdp_side_with_fm.source, self.vdp_side_with_fm.tier), ("area_without_aden", self.area_without_aden.source, self.area_without_aden.tier), ("reset_with_rv", self.reset_with_rv.source, self.reset_with_rv.tier), ("vdp_without_aden", self.vdp_without_aden.source, self.vdp_without_aden.tier), ("sh2_clock_needs_aden", self.sh2_clock_needs_aden.source, self.sh2_clock_needs_aden.tier), ("sh2_waits", self.sh2_waits.source, self.sh2_waits.tier), ("sh2_wait_overlap", self.sh2_wait_overlap.source, self.sh2_wait_overlap.tier), ("sh2_area0_width", self.sh2_area0_width.source, self.sh2_area0_width.tier), ("sh2_framebuffer_fifo", self.sh2_framebuffer_fifo.source, self.sh2_framebuffer_fifo.tier), ("sh2_sdram", self.sh2_sdram.source, self.sh2_sdram.tier), ("m68k_waits", self.m68k_waits.source, self.m68k_waits.tier), ("cartridge_contention", self.cartridge_contention.source, self.cartridge_contention.tier), ("sh2_bus_arbitration", self.sh2_bus_arbitration.source, self.sh2_bus_arbitration.tier), ("ftoa_to_irl0", self.ftoa_to_irl0.source, self.ftoa_to_irl0.tier), ("cmd_interrupt", self.cmd_interrupt.source, self.cmd_interrupt.tier), ("vint_latch", self.vint_latch.source, self.vint_latch.tier), ("vint_at", self.vint_at.source, self.vint_at.tier), ("hint_counter", self.hint_counter.source, self.hint_counter.tier), ("sci_link", self.sci_link.source, self.sci_link.tier), ("rv_stall", self.rv_stall.source, self.rv_stall.tier), ("dreq_fifo", self.dreq_fifo.source, self.dreq_fifo.tier), ("sh2_vdp_without_fm", self.sh2_vdp_without_fm.source, self.sh2_vdp_without_fm.tier), ("sh2_dreq_view", self.sh2_dreq_view.source, self.sh2_dreq_view.tier), ("framebuffer_mirror", self.framebuffer_mirror.source, self.framebuffer_mirror.tier), ("pwm_registers", self.pwm_registers.source, self.pwm_registers.tier), ("bitmap_bits", self.bitmap_bits.source, self.bitmap_bits.tier), ("auto_fill", self.auto_fill.source, self.auto_fill.tier), ("hblank_phase", self.hblank_phase.source, self.hblank_phase.tier), ("edclk_h32", self.edclk_h32.source, self.edclk_h32.tier), ("hblank_timing", self.hblank_timing.source, self.hblank_timing.tier), ("fen_refresh", self.fen_refresh.source, self.fen_refresh.tier), ("palette_wait", self.palette_wait.source, self.palette_wait.tier), ("fs_swap", self.fs_swap.source, self.fs_swap.tier), ("screen_shift_modes", self.screen_shift_modes.source, self.screen_shift_modes.tier), ("blank_row", self.blank_row.source, self.blank_row.tier), ("rgb_levels", self.rgb_levels.source, self.rgb_levels.tier), ("unused_registers", self.unused_registers.source, self.unused_registers.tier), ("adapter_power_on", self.adapter_power_on.source, self.adapter_power_on.tier), ("adapter_writable", self.adapter_writable.source, self.adapter_writable.tier), ("dreq_control_writable", self.dreq_control_writable.source, self.dreq_control_writable.tier), ("dreq_source_mask", self.dreq_source_mask.source, self.dreq_source_mask.tier), ("dreq_destination_mask", self.dreq_destination_mask.source, self.dreq_destination_mask.tier), ("dreq_length_mask", self.dreq_length_mask.source, self.dreq_length_mask.tier), ("dreq_length_power_on", self.dreq_length_power_on.source, self.dreq_length_power_on.tier), ("dreq_address_power_on", self.dreq_address_power_on.source, self.dreq_address_power_on.tier), ("fifo_read", self.fifo_read.source, self.fifo_read.tier), ("reads_zero", self.reads_zero.source, self.reads_zero.tier), ("sega_tv_writable", self.sega_tv_writable.source, self.sega_tv_writable.tier), ( "interrupt_control_writable", self.interrupt_control_writable.source, self.interrupt_control_writable.tier, ), ("bank_writable", self.bank_writable.source, self.bank_writable.tier), ("comm_both_write", self.comm_both_write.source, self.comm_both_write.tier), ("registers_survive_button", self.registers_survive_button.source, self.registers_survive_button.tier), ("framebuffer_zero_bytes", self.framebuffer_zero_bytes.source, self.framebuffer_zero_bytes.tier), ("z80_writes_lock_68000", self.z80_writes_lock_68000.source, self.z80_writes_lock_68000.tier), ("pwm_period", self.pwm_period.source, self.pwm_period.tier), ("pwm_fifo", self.pwm_fifo.source, self.pwm_fifo.tier), ("pwm_routing", self.pwm_routing.source, self.pwm_routing.tier), ("pwm_byte_writes", self.pwm_byte_writes.source, self.pwm_byte_writes.tier), ("pwm_timer_restart", self.pwm_timer_restart.source, self.pwm_timer_restart.tier), ("pwm_cycle_write", self.pwm_cycle_write.source, self.pwm_cycle_write.tier), ("pwm_dreq1", self.pwm_dreq1.source, self.pwm_dreq1.tier), ("pwm_needs_aden", self.pwm_needs_aden.source, self.pwm_needs_aden.tier), ("pwm_output_level", self.pwm_output_level.source, self.pwm_output_level.tier), ("pwm_gain", self.pwm_gain.source, self.pwm_gain.tier), ("vblank_after_hblank", self.vblank_after_hblank.source, self.vblank_after_hblank.tier), ("screen_shift_ff_exception", self.screen_shift_ff_exception.source, self.screen_shift_ff_exception.tier), ("hcount_read", self.hcount_read.source, self.hcount_read.tier), ("composite_rule", self.composite_rule.source, self.composite_rule.tier), ("composite_md_transparent", self.composite_md_transparent.source, self.composite_md_transparent.tier), ("composite_ys_shadow", self.composite_ys_shadow.source, self.composite_ys_shadow.tier), ("composite_alignment", self.composite_alignment.source, self.composite_alignment.tier), ("composite_dot", self.composite_dot.source, self.composite_dot.tier), ("composite_border", self.composite_border.source, self.composite_border.tier), ("composite_levels", self.composite_levels.source, self.composite_levels.tier), ("cartridge_boards", self.cartridge_boards.source, self.cartridge_boards.tier), ("sh2_cartridge_priority", self.sh2_cartridge_priority.source, self.sh2_cartridge_priority.tier), ] } } /// One 32X model. ``revision``: the board revisions it covers; ``sh2_variant``: which /// SH-2 the core should be (milestone 2; which part numbers are the "2.5 cut" is not /// stated anywhere pinned, docs/undocumented-behavior.md); ``boot_roms``: Aubrey's /// decision 3, the user's own Sega ROMs (a free replacement may follow). #[derive(Clone, Copy, Debug, PartialEq)] pub struct Machine { pub name: &'static str, pub description: &'static str, pub revision: &'static str, pub sh2_variant: Quirk<&'static str>, pub boot_roms: &'static str, pub quirks: Quirks, } pub const SH2_VARIANT: Quirk<&'static str> = Quirk { value: r#"SH7604"#, source: r#"SH7095 = an SH7604 core (Sega 315-0922/0922A/0998, service manual parts table A408a); which parts have the 2.5-cut interrupt fault is unknown (Toshiyasu Morita's FAQ, in the 32XDK wiki). sh2-python's question; milestone 2"#, tier: SPECIFICATION, milestone: 2, documents: r#""#, hardware: r#""#, unresolved: r#""#, }; /// The models (the reference's `MACHINES`). pub fn machines() -> Vec { vec![ Machine { name: "genesis-32x", description: r#"Genesis 32X (USA), boards VA0/VA1"#, revision: r#"VA0, VA1 (no behavioural difference known)"#, sh2_variant: SH2_VARIANT, boot_roms: "user", quirks: Quirks::default(), }, Machine { name: "mega-drive-32x", description: r#"Mega Drive 32X (Japan, Europe) / Super 32X"#, revision: r#"VA0, VA1 (no behavioural difference known)"#, sh2_variant: SH2_VARIANT, boot_roms: "user", quirks: Quirks::default(), }, ] } /// The model named `name` (`MACHINES[name]`). pub fn machine(name: &str) -> Option { machines().into_iter().find(|m| m.name == name) }