Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MMC3 IRQ setup doesn't work "out of the box" #262

Open
wendelscardua opened this issue Dec 8, 2023 · 0 comments
Open

MMC3 IRQ setup doesn't work "out of the box" #262

wendelscardua opened this issue Dec 8, 2023 · 0 comments
Labels
bug Something isn't working p1

Comments

@wendelscardua
Copy link

On a MMC3 C++ project I was trying to use the irq-related API (based on nesdoug.h), and spent a long time trying to figure out why the irq wasn't "irqing", until someone pointed out to me that, if cli only happens inside nmi (like the first call to irq_parser possibly does, when the first instruction is a scanline counter), the flag state will be reverted by the nmi's rti. Which means that if the interrupts aren't enabled beforehand during initialization, they will never be.

For now I'm doing an asm volatile("cli") at the start of my main myself.

I think maybe either:

  • interrupts should start enabled for MMC3, or
  • if such magic is possible with llvm-mos, they should start enabled if irq functions are being used, or
  • set_irq_ptr should enable it, or
  • mapper.h should have a comment telling the user to enable it beforehand
@mysterymath mysterymath added bug Something isn't working p1 labels Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p1
Projects
None yet
Development

No branches or pull requests

2 participants