# Quirks (U) and contradictions between sources (C) Each entry says what it is, the evidence, and the tier of that evidence (validation.md defines them): **hw-verified** is an author's statement that he ran it on a real console (MacDonald's pcetech: no ROM published, so it cannot be re-run here), **manufacturer** is Hudson's manuals (scans, OCR read by `pdftotext`; HW and SW as in start-here.md), **research** is other documents, **emulator** is any emulator, the SingleStepTests corpus, or the MiSTer VHDL. **A low tier detects and never judges**; where only emulators speak, the entry is marked *undecidable here* and the build session picks the majority behaviour and says so. ## Quirks (U) | # | Quirk | Evidence | Tier | | --- | --- | --- | --- | | U1 | **Zero page is logical `$2000`-`$20FF`, the stack `$2100`-`$21FF`**, through MPR1 (usually $F8). Zero-page and stack accesses are never to logical page 0/1; software can read ROM through them | HW HB-3 (stack high byte $21); pcetech 2.0 | manufacturer, hw-verified | | U2 | Reset: MPR7 = $00, MPR0-6 random; A, X, Y, S random; P has I and B set, T and D clear, N V Z C random; low speed; timer stopped, counter reads 0; interrupt disable register 0; `$FFFE`/`$FFFF` read from physical `$001FFE` | HW HB-18; pcetech 2.0 ("re-tested P startup value", "re-tested MPR startup value") | manufacturer, hw-verified | | U3 | The 23 undefined/`NOP` opcodes are one-byte, two-cycle `NOP`s that change no register except to clear T; tested: $E2 $63 $33 $0B $2B $4B $6B $8B $AB $CB $EB $1B $3B $5B $7B $9B $BB $DB $FB $5C $DC $FC. The 65C02's multi-byte `NOP`s do not exist | pcetech 2.0 (the 23rd, $EA, is the documented `NOP`); the corpus has them at 2 cycles, 1 byte; MAME bills $63 four cycles (C4) | hw-verified | | U4 | **T**: `SET` sets it; the next instruction's fetch clears it; only `ORA` `AND` `EOR` `ADC` use it (the operand pair becomes `M($2000 + X)` and the immediate/memory operand, result back to `M($2000 + X)`, A untouched, +3 cycles, flags from the result); `PHP` and `PLA` read T as 0, so does `BRK`; **an interrupt between `SET` and its target pushes T = 1 and `RTI` restores it, so the target is still affected**; `PLP` and `RTI` can set T from the stack (the next instruction is then affected "as if SET came before it"); `SED` before `SET` is the way to do BCD in memory because `SET` must be immediately before the ALU instruction (any other instruction clears T). With D = 1 and T = 1 `ADC` is 2 + 3 + 1 cycles | HW HB-5; SW `ADC` entry; pcetech 2.3; corpus (ADC # 638/635/621/606 cases at 2/3/5/6 cycles); `SBC` is C5 | manufacturer, hw-verified, emulator | | U5 | **B**: reads 1 whenever P is read (PHP, `BRK`, PLA after PHP); the byte an IRQ or NMI pushes has B = 0; B in the corpus's P is always 0 (mask it) | HW HB-4; pcetech; corpus | manufacturer, hw-verified, emulator | | U6 | **A block transfer cannot be interrupted**: the interrupt is taken when it ends. Whether the interrupt entry then comes before or after the next instruction fetch is not stated by anyone | pcetech; MAME runs the block to its end (h6280.cpp, BSD-3-Clause), and the rung 4 and 4b replays (MAME, Mednafen as closed boxes) take no interrupt inside one | hw-verified (for the claim), emulator (for the detail); detail *undecidable here* | | U7 | A block transfer's **reads** of the hardware page from `$0800` to `$17FF` (PSG, timer, port, interrupt registers `$1402`/`$1403`) return **0** whatever is there, do not touch the device and do not change the I/O buffer; **writes** to them work and update the buffer; VDC and VCE are not in the range and work normally. This is CPU behaviour, so the core owns it | pcetech 2.0 | hw-verified. **MAME reads the real device here (C9)** | | U8 | `(zp),Y`, `(zp,X)` and `(zp)` pointer reads wrap within the zero page (`$20FF` then `$2000`); the manuals do not say | MAME 0.285 `program_read16z` (h6280.cpp, BSD-3-Clause, Bryan McPhail); SingleStepTests huc6280 records the wrap in its 226 cases with a pointer at `$FF` (70 `(zp)`, 75 `(zp),Y`, 81 `(zp,X)`; Mesen's output, a closed box) | emulator; *undecidable here* | | U9 | `JMP (abs)` with the low byte $FF reads the high byte from the next page (`JMP [$FEFF]` reads $FF00): no NMOS wrap bug. Taking a branch across a 256- or 8192-byte boundary costs no extra cycle | pcetech 2.0 | hw-verified | | U10 | `CSL` and `CSH` take 3 cycles when the speed does not change. **The cost of an actual change is unknown** on hardware, as is when the new speed takes effect (Mednafen, run as a closed box: for the last cycle of the instruction; MAME: after it; C7). Reset selects low speed | pcetech 2.0 ("It currently isn't known"); C7 | hw-verified (the 3), the rest undecidable | | U11 | `TAMi`/`TMAi` use an 8-bit **mask** operand (bit 0 = MPR0). `TAM` with several bits writes A into each; with operand $00 it writes nothing. `TMA` with operand $00 returns the last value moved by `TAM` (when at least one bit was set) or `TMA`; with several bits the result is "combined" in a way no one has worked out (C6). `TAM` is 5 cycles and `TMA` 4 | HW HB-7; SW; pcetech 2.0 | manufacturer, hw-verified | | U12 | `ST0`/`ST1`/`ST2` write **physical** `$1FE000`, `$1FE002`, `$1FE003`: the address does not go through the MPRs, and the write reaches the VDC whatever MPR7 holds | HW HB-8 (Table 2-2-3); pcetech 2.0 | manufacturer, hw-verified | | U13 | The last value read or written at `$0800`-`$17FF` sits in an 8-bit buffer; reads of PSG (`$0800`-`$0BFF`) return it in full, timer reads return it in bit 7, `$1400`/`$1401` return it in full, `$1402`/`$1403` in the upper five bits, the port returns none of it. Open-bus behaviour of the die | pcetech section 3 note 1, with its worked example | hw-verified | | U14 | **Decimal mode**: `ADC`/`SBC` with D = 1 add one cycle, take the result from the BCD adjust, set N, Z, C from it and **leave V unchanged** | HW HB-4; SW; MAME changelog 1.08 ("Fixed the decimal version of ADC/SBC to *not* update the V flag") | manufacturer, emulator | | U15 | `BRK` pushes `BRK + 2`, so the byte after it is skipped; B = 1; the vector is `$FFF6`, shared with IRQ2. Like an interrupt entry it does not poll, so the handler's first instruction runs before anything else is taken (only an NMI can show it: BRK sets I); issue 0005 | HW HB-4, HB-17; SW; pcetech; for the poll: the 6502 frame's rule (NESdev "CPU interrupts"); BRK's cycles are SingleStepTests' records, and an entry makes the same pushes and vector reads (Mesen2's bus, observed closed box, C3) | manufacturer, hw-verified; the poll research (6502) and emulator | | U16 | The timer: a 7-bit down counter ticking every 1024 x 3 master clocks, **independent of the CPU speed**; `$0C00` write sets the reload (N means N + 1 ticks), `$0C01` bit 0 starts it (stopped to started loads the counter from the reload); the request is raised when the counter **underflows from 0 to $7F**, and at once it reloads and keeps counting; `$0C00`/`$0C01` read the counter in bits 6-0 (bit 7 is the I/O buffer's); read it twice, the value can be invalid mid-update; writing any value to `$1403` acknowledges the timer, and an unacknowledged request interrupts again after every instruction | HW HB-20 to HB-22; pcetech 2.2 | manufacturer, hw-verified | | U17 | The interrupt **disable register masks taking an interrupt, not requesting it**: `$1403` still shows IRQ1, IRQ2 and TIQ lines that `$1402` masks. IRQ1 and IRQ2 are level: they stay until the device is acknowledged (VDC: read its status register). NMI is not connected on any console | HW HB-15, HB-16; pcetech 2.1 | manufacturer, hw-verified | | U18 | A **VDC or VCE access costs one extra cycle**, for any instruction and any addressing mode, including an opcode fetch from there; the CD-ROM registers in the same page do not | pcetech 3 note 3; MAME `check_vdc_vce_penalty`; Mednafen and Mesen2 | hw-verified, emulator | | U19 | `BIT #imm` computes N and V from the immediate, unlike the 65C02 (where only Z is set); `TST`, `TSB`, `TRB`, `BIT` all load N from bit 7 and V from bit 6 of the **memory** operand | pcetech 2.0 ("`BIT #$C0` would set N and V"); HW HB-5; SW `TST` | hw-verified, manufacturer | | U20 | `BSR` pushes the address of its last byte and takes 8 cycles; `JSR` 7; `RTS` and `RTI` 7. `RTI` pulls P first, then PCL and PCH | SW; corpus | manufacturer, emulator | | U21 | The interrupt-disable flag changes after the poll: `CLI`, `SEI` and `PLP` delay their effect by one instruction, as on the 6502. The same rule as the frame's `_polled_i` | the 6502 frame's rule; Mesen2, Mednafen and srg320's VHDL, run as closed boxes on directed cards (issue 0002's), take a pending interrupt one instruction after `CLI`; MAME takes it at once (C15); HW HB-12 ("sampled in the last bus cycle") | emulator; undecidable here | | U22 | The 65C02 additions with the same meaning as the Rockwell part: `PHX` `PHY` `PLX` `PLY` (the pulls set N and Z), `STZ`, `TRB`, `TSB`, `BRA`, `INC A`, `DEC A`, `(zp)`, `JMP (abs,X)`, `RMB`/`SMB`/`BBR`/`BBS`. `WAI` and `STP` do not exist | HW; SW; MAME changelog 1.08 (PLX, PLY flags) | manufacturer | | U23 | The extra cycle of **decimal `ADC`/`SBC`** is a dummy read of the address the next instruction starts at (not an internal cycle); with T set `ADC` spends it among the memory-operand cycles (read, internal, internal, write: 6 in all) and `SBC`, which ignores T (C5), spends an *internal* cycle there | SingleStepTests huc6280 (every decimal case, both T states): which bus the chip drives in that cycle is unobservable except through a per-cycle capture, so this is the corpus's record (Mesen's output, C8) | emulator | | U24 | `BRA` is `R R i i`: its two extra cycles are internal, where a taken conditional branch is `R R d i` (a dummy read at the next instruction's address, then an internal cycle). Both are 4 cycles | SingleStepTests huc6280 (all 2,500 `BRA` and every taken branch); totals SW | emulator for the shape, manufacturer for the 4 | | U25 | **Where an instruction's interrupt poll sits is not known for the HuC6280.** HW HB-12 says only that the inputs "are sampled in the last bus cycle". The core samples at the end of the second-to-last cycle (the 6502 frame's rule, U21), so a line that rises in the last cycle waits one instruction. `irq_poll_cycle` (class attribute): `"second_to_last"` (default) and `"last"` (the levels at the boundary all count, rising or dropping in the last cycle, every source alike: what srg320's VHDL does under GHDL, run as a closed box, `validation/vanish_vhdl.py --sweep`, and what MAME's BSD-3 h6280 does). A `"mednafen"` mode (the timer counted live at the boundary, IRQ1/IRQ2 sampled) was withdrawn on 2026-11-19: it was written from Mednafen's source and could not be re-established from outside (it differs from the default only for a timer that appears in the last cycle; settling it needs the timer's phase measured independently of the interrupt, see docs/restart.md). Issue 0003: in the board, `last` moves every Mednafen stop earlier and leaves the Covell spread at 4.2 or more | HW HB-12; issue 0003 board runs; the VHDL run | manufacturer (wording only), emulator; *undecidable here*; default kept | ## Contradictions (C) | # | The disagreement | Sources and tiers | Resolution proposed | | --- | --- | --- | --- | | C1 | `ST0`/`ST1`/`ST2`: 4 cycles or 5 | SW 4 (manufacturer); corpus 4; MAME 5 (h6280.cpp, BSD-3-Clause; the VDC stretch folded in) | 4 in the core, the +1 is U18 and the board's | | C2 | `BRK`: 1 byte or 2 | SW and HW map: 1 byte (manufacturer); SW's own text, HW HB-17, pcetech: pushes `BRK + 2` (manufacturer, hw-verified); every emulator 2 | 2 (the manual contradicts itself; U15) | | C3 | Interrupt entry: 7 or 8 cycles | MAME 7 (h6280.cpp `do_interrupt`, BSD-3-Clause); ares 8 (ISC); Mesen2 8 (its bus, observed closed box: two reads at PC, three pushes, the vector, one cycle with no access); Mednafen 8 (29,195 entries in the rung 4b replays cost what the core charges); srg320's VHDL 9 under GHDL (three reads at PC and an internal cycle before the pushes); no manual states it | 8, flagged emulator-derived; *undecidable here* | | C4 | `NOP` $63: 2 or 4 cycles | pcetech tested 2 (hw-verified); MAME 4; Mednafen 2 (directed card, closed box); the corpus 2 | 2; MAME's is an error | | C5 | Does `SBC` honour T? | SW's `SBC` entry has no T clause (manufacturer); pcetech (hw-verified) lists ORA/AND/EOR/ADC only; the corpus (closed-box Mesen) and Mednafen (directed card) ignore T; ares: no; MAME 1.10: yes ("Added T flag support to the SBC instruction") | no; MAME's is a guess | | C6 | `TMA` with several mask bits | the corpus (Mesen's output): **the OR** in all 2,418 cases with several bits; MAME (h6280.cpp, BSD-3-Clause) and Mednafen (directed card, closed box): the highest set bit wins; pcetech: "combined together... I have not figured out exactly how this works". An earlier note on the VHDL, read from its source, is withdrawn | OR (the corpus's; a wired bus is likelier than a priority encoder, but that is reasoning, not evidence); *undecidable here* | | C7 | When a `CSL`/`CSH` takes effect | Mednafen (traced closed box): for the last cycle (`CSH` from low 4 + 4 + 1 units, `CSL` from high 1 + 1 + 4); MAME: after it (rung 4: +3); pcetech: unknown | the last cycle; *undecidable here* | | C8 | Position of the internal (no-bus) cycles and the address of every dummy read | the corpus is one model (Mesen's output); srg320's VHDL another (rung 5); Mednafen's trace gives instruction totals only; manuals: totals only | the corpus's, flagged; a board sees them only through `idle` | | C9 | Block-transfer reads of `$0800`-`$17FF` | pcetech: zero, no device effect (hw-verified), but its range reads "`$0800` through `$1400`" while its parenthesis names the IRQ registers (`$1402`/`$1403`); MAME reads the device (emulator); Mednafen returns 0 for a block read of the I/O port (directed card, closed box); Mesen unchecked | pcetech's, ending at `$17FF` (the parenthesis, the only reading where its own examples hold; docs/issues/0001); *end of range undecidable here* | | C10 | Timer vs VDC interrupt sampling | Mesen2 and Mednafen, run as closed boxes on issue 0002's cards: a VDC interrupt acknowledged by a status read in the last cycle is still taken, a timer acknowledged by a write in the last cycle is not (C18); no hardware result | the frame's rule (requests as of the next-to-last cycle) for every source, with C18 at entry; the timer's acknowledge is the board's to model; *undecidable here* | | C11 | Which instruction fetch the interrupt follows | the HW manual says the interrupt is taken "when the instruction in progress is terminated"; MAME's changelog 1.10: "Taking of interrupts is delayed to respect a pending instruction already in the instruction pipeline; fixes After Burner" | the frame's one-instruction rule | | C12 | What `TSB` and `TRB` report in Z | The SingleStepTests corpus sets Z from A AND M, the 65C02 rule, in all 10,000 `TSB`/`TRB` cases (N and V from the memory byte, 10,000 of 10,000); MAME (h6280.cpp, BSD-3-Clause) and Mednafen (directed card, closed box) set Z from the stored **result** (`M OR A` for `TSB`, `M AND NOT A` for `TRB`), and pcetech 2.0 says "Z = If result is zero" (hw-verified, but "result" is loose there: it also says N and V are "bit 7/6 of result", which no emulator and not SW's text ("memory bit 7... bit 6") follow) | the stored result (`tsb_z_from_test = False`); pcetech and two emulators outweigh one corpus snapshot, flagged; the 65C02 rule is a class attribute. *Undecidable here*; rung 1 does not compare Z for these four opcodes when it is the only difference (1,492 cases), and rung 1b's Rockwell corpus cannot judge it either (it is the 65C02's rule) | | C13 | Decimal `ADC` and `SBC` with an invalid BCD digit in A or the operand | Two closed-box result tables (`scripts/decimal_tables.py`): **Mednafen** 1.32.1, all 262,144 operations traced, and **Mesen**, the corpus's 11,346 decimal cases; the digit rules were written from the tables alone (issue 0004, docs/restart.md). All 131,072 A x operand x carry combinations differ in 9,216 results each for `ADC` and `SBC` (never with valid digits; `ADC`'s carry in 324; e.g. `$00 - $0A`, C clear: Mesen `$9F`, Mednafen `$8F`; `ADC` `$0A + $0F + 1`: `$10` against `$20`). The Rockwell 65C02 corpus (a different chip) matches Mednafen's `SBC` in all 44,848 decimal cases and Mesen's `ADC` in all 44,881; the differences are 3,164 (`SBC` against Mesen) and 3,195 (`ADC` against Mednafen). The earlier record cites Mednafen's ChangeLog of 2015-04-29 as its author's statement of a console test (not re-read in this pass). Neither manual says | **Mednafen's** (default, `decimal_formula = "mednafen"`, Aubrey's decision of 2026-11-10); Mesen's one switch away (`"mesen"`, the corpus's exact match); no capture of the chip | | C14 | Does a block transfer push and pop A, X and Y | HW HB-6 (manufacturer): the transfer "uses three levels of stack" for them; Mesen and Mednafen (and the SingleStepTests corpus, 12,500 cases) push Y, A, X and pop them, so a transfer that overwrites the stack hands back overwritten values; MAME keeps them in the CPU and writes nothing to the stack. Rung 4 (91 transfers over RAM in six games) shows the difference only as A after `tii $2000,$2001,$1FFF` | HW's: push and pop (the core). MAME's replay adopts its A, X, Y | | C15 | `CLI` followed by a pending interrupt | MAME takes the interrupt before the next instruction (about 600 times in six games, and on issue 0002's cards); Mesen2, Mednafen and srg320's VHDL, run as closed boxes, run one more instruction, like the frame's `_polled_i` rule (U21); the rung 4b replays show 0 early entries | the frame's rule; *undecidable here*; the replay forces MAME's order and counts it | | C16 | T and interrupts: `BRK` fetched with T set, and an entry between `SET` and its target | `BRK`: the corpus clears T in the fetch like any instruction, so `BRK` pushes T = 0 (1,271 of 10,000 `BRK` cases: T set, pushed 0); srg320's VHDL under GHDL pushes T as it stands (rung 5, the same 1,271). An entry: pcetech 2.3 (hw-verified) says the pushed P keeps T; Mesen2 and Mednafen, run as closed boxes, then run the handler's first instruction with T clear (`validation/vanish_probe.py --only t-entry`), ares (ISC) clears T at entry; srg320's VHDL keeps T for the handler's first instruction (`validation/vanish_vhdl.py --t-entry`). HW HB-5 says an interrupt pushes T as it stands and says nothing for `BRK`; SW's flag table gives `BRK` T = 0 | the core clears T (`BRK` pushes 0; an entry pushes T and clears it), emulator-derived; *undecidable here* | | C17 | `SBC abs` with D = 1: 6 or 7 cycles | SW and the corpus: 5 + 1 = 6 (and SW gives every decimal `SBC`/`ADC` +1); the HDL takes 7 for this mode only (1,258 cases, the other seven `SBC` modes and all `ADC` modes agree) | 6 (manufacturer); the HDL's is its own microcode quirk | | C18 | An interrupt whose source has gone between the poll and the entry (issue 0002: `CLI` then `STZ $1403`, the write lowering TIQ in the instruction's last cycle) | HW HB-12 (manufacturer): interrupts are "sampled in the last bus cycle"; HW HB-15/16 and pcetech 2.1 (hw-verified) say a request stays until acknowledged and say nothing about one that goes away after the sample. Mesen2 and Mednafen, run as closed boxes on issue 0002's cards: the timer acknowledged in the last cycle is **dropped**, the VDC interrupt acknowledged by a status read in the last cycle is **taken** through its own vector. srg320's VHDL under GHDL decides on the levels at the end of the last cycle for every source (U25 `"last"`). MAME enters right after `CLI` (C15), so the cards never test it. Before the fix the core fell through to IRQ2's `$FFF6` when nothing was asserted, which no source describes: After Burner II ran into data. pcengine-python M2: the other nine of the first ten titles are identical either way | `vanished_interrupt` (class attribute): `"mesen2"` (default, OBSERVED in Mesen2 and Mednafen), `"drop"` (drop whenever nothing polled is still asserted); no mode falls through to IRQ2. `"latched"` was withdrawn on 2026-11-19 (written from the VHDL's source; the VHDL run as a closed box behaves as U25 `"last"`). *Undecidable here* (no source above the emulator tier covers it). Issue 0005: "as the poll saw them" means each line as it stood at the poll (`CPUState.polled_irq_lines` when a line changed after it), so a timer dropped while IRQ1 rises in the same last cycle is a vanished timer, and IRQ1 waits for the next poll; the instruction a vanished entry runs keeps the poll rule | ## Mednafen's votes (rung 4b) A third emulator-tier vote per entry, observed from outside: six replayed games and directed cards traced on the patched build (docs/mednafen-oracle.md has the method; Mednafen's source is not read). C3 **8**; C4 2; C5 SBC ignores T; C6 **highest bit wins**; C7 the core's order; C9 **0 for a block read of the I/O port**; C12 result; C13 its full table is the core's default (issue 0004); C14 **pushes and pops**; C15 **not early**; C16 T clear for the handler after an entry; C18 timer dropped, IRQ1 taken (the core's default). No default was changed on it except C13 (decimal `ADC`/`SBC`, issue 0004).