Shadow: skip interrupted calls, compare the math unit (fixes #58) #60

Merged
Gatchan merged 2 commits from shadow-nmi-math into main 2026-11-05 11:00:55 +00:00
Owner

Fixes #58: shadow blind spots.

  • A call during which the original takes an interrupt (NMI or IRQ: the CPU's pending interrupt seen at the instruction hook, including right at entry) is counted as skipped, like a frame crossing: the handler writes WRAM (pad_raw...) the clone never sees.
  • The multiplier and divider (WRMPYA, product/remainder, dividend, quotient) are compared for every port (only CPU writes change them). New bridge helpers port_set_multiplier, port_set_divider.
  • Bridges fixed to leave what the original leaves: UpdatePalAnimPulse (multiplier: brightness x last green), UpdateShake (multiplier on odd frames: amplitude x $C0), ClearTextGfxBuf (WRAM port after $9182: the comparison of WMADD added in #56 had not been rerun on the earlier ports).
  • docs/validation.md updated.

Validation (chapter 1 routes, decision 2026-11-05: title_to_first_battle_win, title_to_mines_save, field_menu_tour, narshe_to_world_map; all 46 ports in shadow, 45 reached):

  • US 1 552 349 calls, 1 542 782 matches, 0 mismatch, 9 567 skipped, 0 fallback; JP 1 407 933 calls, 1 400 312 matches, 0 mismatch, 7 621 skipped, 0 fallback; every movie matches its end hashes.
  • Fuzz of _c0249a alone (60 iterations per version): US 434 calls 405 matches, JP 434 calls 419 matches, 0 mismatch, 0 fallback (the batch 3 NMI mismatch at pad_raw is gone: those calls are now skipped).

🤖 Generated with Claude Code

🤖 Generated with Claude Code

Fixes #58: shadow blind spots. - A call during which the original takes an interrupt (NMI or IRQ: the CPU's pending interrupt seen at the instruction hook, including right at entry) is counted as skipped, like a frame crossing: the handler writes WRAM (pad_raw...) the clone never sees. - The multiplier and divider (WRMPYA, product/remainder, dividend, quotient) are compared for every port (only CPU writes change them). New bridge helpers `port_set_multiplier`, `port_set_divider`. - Bridges fixed to leave what the original leaves: UpdatePalAnimPulse (multiplier: brightness x last green), UpdateShake (multiplier on odd frames: amplitude x $C0), ClearTextGfxBuf (WRAM port after $9182: the comparison of WMADD added in #56 had not been rerun on the earlier ports). - docs/validation.md updated. Validation (chapter 1 routes, decision 2026-11-05: title_to_first_battle_win, title_to_mines_save, field_menu_tour, narshe_to_world_map; all 46 ports in shadow, 45 reached): - US 1 552 349 calls, 1 542 782 matches, 0 mismatch, 9 567 skipped, 0 fallback; JP 1 407 933 calls, 1 400 312 matches, 0 mismatch, 7 621 skipped, 0 fallback; every movie matches its end hashes. - Fuzz of _c0249a alone (60 iterations per version): US 434 calls 405 matches, JP 434 calls 419 matches, 0 mismatch, 0 fallback (the batch 3 NMI mismatch at pad_raw is gone: those calls are now skipped). 🤖 Generated with [Claude Code](https://claude.com/claude-code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Gatchan/FF6Portage!60
No description provided.