mirror of
https://github.com/mre/mos6502.git
synced 2026-03-10 23:28:17 +00:00
Implements hardware interrupt support following the W65C02S datasheet: Interrupt handling: - Add nmi_pending() and irq_pending() to Bus trait - NMI: edge-triggered (falling edge detection) - IRQ: level-triggered, maskable by I flag - service_interrupt() pushes PC/status, sets I flag, jumps to vector Wait states: - Replace `halted: bool` with WaitState enum (Running, WaitingForInterrupt, WaitingForReset) - WAI instruction waits for interrupt, resumes on IRQ or NMI - STP instruction waits for reset Helper methods: - Add push_address() for pushing 16-bit addresses to stack - Add set_word() to Bus trait for writing 16-bit values Testing: - Integrate Klaus2m5 interrupt test suite - Add unit tests for IRQ, NMI, and WAI behavior - Concurrent BRK+IRQ+NMI test disabled (hardware timing edge case) References: - W65C02S Datasheet, Section 3.4 (IRQB) and 3.6 (NMIB) - Klaus2m5/6502_65C02_functional_tests Closes #64