bfirsh / bfirsh/jsnes

CPU: CLI/SEI/PLP interrupt inhibit delay and BRK/NMI hijacking not implemented

Open
#603 0 comments 0 reactions 0 assignees View on GitHub
accuracy component: cpu difficulty: hard enhancement priority: low
Dominant language
JavaScript
Stars
6.4k
Forks
857
PR merge metrics
No merged PRs in 30d

Description

## Summary

Two advanced interrupt timing behaviors are not implemented:

### 1. Interrupt inhibit delay

Changes to the I flag via CLI, SEI, or PLP should take effect **after** the current instruction's interrupt poll. This means CLI followed by an immediately pending IRQ should not take the IRQ until the next instruction.

### 2. BRK/IRQ NMI hijacking

When NMI coincides with BRK or IRQ, real hardware redirects to the NMI vector instead. The BRK instruction still pushes the B flag, but the vector used is $FFFA instead of $FFFE.

Both are known AccuracyCoin failures and affect a small number of games/demos.

## References

- [CPU interrupts](https://www.nesdev.org/wiki/CPU_interrupts)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the CPU interrupt handling and the linked nesdev CPU interrupts reference. Verify the CLI, SEI, and PLP polling delay, then check BRK/IRQ behavior when NMI coincides, including the pushed B flag and NMI vector. Done means both behaviors are implemented and the AccuracyCoin failures pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
game-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.