Is there a way to poll for an interrupt on the ‘816? The software needs to poll for an interrupt (running with interrupts masked off) and execute an interrupt routine if there’s an interrupt present, otherwise continue on with the program. I don’t think the wai instruction can be used for this because it’ll wait for an interrupt. The software doesn’t need to wait. The best I could come up with was the following code:
Code:
PollForIRQ:
pha
lda IRQStatus ; route all IRQ's to a register at this location
beq .0001 ; zero = no IRQ’s
phx
phy
jsr IRQRout
ply
plx
.0001:
pla
rtl
It turns the poll into a subroutine call. Seems like a lot of overhead.