Ah, seems it's something to do with the CLI command. If I remove it, the background processing works.
Do you have to do something special in your IRQ routine, even if you're not using the IRQ to do anything? Currently my IRQ routine is just an RTI. Is that wrong?
Is the interrupt vector correctly point to RTI? At the moment the IRQ fires, does the right bank is visible at the end of the memory where interrupt vectors should be read, and when it vectors to the ISR, does the correct bank is 'seen' ?
neilbaldwin wrote:Do you have to do something special in your IRQ routine, even if you're not using the IRQ to do anything?
Nothing special, you can have just an RTI there, like you said. Some people even have the IRQ vector point to the same location as the RESET vector. Ideally, if you're not using IRQs, you'd better prevent them from happening at all.
If you are not using interrupts, why did you have a CLI command anyway? Just use SEI at the start of the program to disable all interrupts. If you do decide to use interrupts though, don't forget to disable DMC IRQs and Frame IRQs if you're not using them.
; do this at program startup
LDA #%01000000
STA $4017
You got it
I've just removed the CLI command as I'm not using the IRQ anyway (doing the CLI was just a legacy thing, left over from old reset vector code - force of habit I guess).
But Disch was right - I wasn't disabling the APU frame IRQ - doh!
I once had a bunch problems because of Frame IRQs myself... It took me a long time to figure out the problem was such a tiny thing that's so easy to fix.