Conversation
…ad-DMA delay and $4016 bit deletion match Mesen2 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016JbwWdcsgsf3sY8e5bgMDo
…read; fix a stale delay comment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016JbwWdcsgsf3sY8e5bgMDo
|
Review (cold read, All four fixes check out against the bead's claim and against Mesen2 (
Producer's replies (head
|
…ut; nr-046 noise in Mesen2 comparisons Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016JbwWdcsgsf3sY8e5bgMDo
Bead: nr-8px (NES attract demos diverge from Mesen2 in game state). Follow-ups: nr-xyiu (4 ROMs left, cause not established), nr-z3gl (the
$4017side of fix 4).What was wrong
Four timing bugs moved DMC sample fetches, and controller reads under them, off Mesen2. Games that play DPCM then made different decisions.
get_operandandexecute(src/nes/cpu/cpu/execute.rs).Dmc::reinit_timer_after_reset.$4015. The CPU saw it 1/2 cycles after the write (even/odd). NESdev "DMA" says it halts on the get cycle of the 2nd APU cycle after the write, which is 3/4 cycles, as in Mesen2. Fix inDmc::set_enabled.$4016read halted by a DMC fetch. The halt cycle was a dummy read, so the pad saw a single clock and never lost a bit. NESdev "DMA" (Register conflicts) and Mesen2 give it one extra clock. Fix inprocess_pending_dma;$4017is deliberately unchanged (nr-z3gl).Tests
test_jsr_reads_high_target_byte_after_pushing_return_address: JSR at $01FD, whose high operand byte is overwritten by the PCH push. Was $1234, now $0134.test_timer_after_reset_sequence_ticks_420_cycles_into_the_programandtest_load_dma_after_enable_is_seen_by_the_cpu_three_or_four_cycles_later. Both fail on main.test_read_joy3_count_errors(_fast)re-pinned from NESER's own "0/1000" to Mesen2's "CONFLICTS: 67/1000" / "ERRORS: 15/1000". Mesen2's frame 900 matches NESER's at 0 px for both ROMs. They fail without fix 1, 2 or 4.test_dmc_tests_latency(an audio-alternation heuristic, recalibrated once before when the phase changed) re-pinned from 70 to 71.Validation
./scripts/gate-full.sh: passed. nr-tu3 checkpoint recipe (zero RAM, no input, frames 300..3600, both ports pinned to joypads) on the bead's 16 ROMs and on the 9 ROMs nr-xgb flagged:No deviation from the bead; a bug bead has no plan, so the reproduction tests above are the plan.
🤖 Generated with Claude Code
https://claude.ai/code/session_016JbwWdcsgsf3sY8e5bgMDo