test(nr-3wg): pin that a taken same-page branch delays NMI as NESdev says - #3339
Conversation
…says Tekken 2's attract-mode fight differs from Mesen2 from frame 1307 because Mesen2 lets an NMI detected in a taken branch's second cycle through, where NESdev's CPU interrupts page says the branch does not poll again. The navigator chose the specification; this test keeps it that way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BVAhbPCxrs1fRqHCgG2Cd5
… instruction Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BVAhbPCxrs1fRqHCgG2Cd5
|
Review (cold read, The reviewer confirmed the test passes as is and fails under Mesen2's IRQ-only rule (verified in a throwaway copy). It also confirmed the guard means the test cannot pass without checking anything, the result is deterministic, and the test follows the file's conventions.
Answer: 1, fixed in the next commit. The parameter is now used: a not-taken BEQ ( |
…ference nr-046 had recorded Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BVAhbPCxrs1fRqHCgG2Cd5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BVAhbPCxrs1fRqHCgG2Cd5
Bead: nr-3wg (Tekken 2 attract-mode fight diverges from Mesen2 from frame ~1320).
Finding
The difference is Mesen2's, not NESER's. Tekken 2 uses its vblank idle counter
$22as an RNG. At frame 27, vblank's NMI first appears in the second cycle of the wait loop's taken, same-pageBEQ. NESdev (CPU interrupts, Branch instructions and interrupts) says that kind of branch is not polled before its third cycle, so the NMI waits one instruction. NESER does exactly that. Mesen2'sBranchRelativeapplies the rule to IRQ only, so its NMI timing drifts by a cycle each time this happens. By frame 1306,$22differs ($B1 vs $AF) when the fight code reads it.Experiment: NESER with Mesen2's rule matches Mesen2 at all 12 checkpoints to 3600 (0 px). Without it, 1500–3600 differ. The navigator chose to keep the NESdev behaviour and record the difference, as the bead's acceptance allows. The full evidence is in the bead's notes.
Change
Test only.
test_taken_branch_without_page_cross_delays_nmi_like_a_two_cycle_instructionsweeps the vblank arrival over 0–30 dots and asserts that a taken same-pageBEQpolls NMI where a 2-cycleNOPdoes. It also asserts that the sweep includes an NMI first seen in the second cycle (a 3-cycleLDA zptakes it). It passes as is, and fails with Mesen2's rule applied ("vblank 3 dots ahead (NOP: false, BEQ: true)"), so the decision cannot be undone by accident.Validation
./scripts/gate-full.sh: passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01BVAhbPCxrs1fRqHCgG2Cd5