A page on how to do raster interrupts includes the following code
Irq: LDA #7 STA $D020 ; Turn screen frame yellow LDX #90 Pause: DEX BNE Pause ; Empty loop that "does nothing" for a little under a half millisecond LDA #0 STA $D020 ; Switch frame color back to black ASL $D019 ; "Acknowledge" the interrupt by clearing the VIC's interrupt flag. JMP $EA31 ; Jump into KERNAL's standard interrupt service routine to handle keyboard scan, cursor display etc.
I'm interested in the second-to-last line. Why "acknowledge" it? I just want to understand what that does. My understanding is that the VIC-II sets some flag, and this line of code clears that flag, to show that the interrupt has been handled.
- But if we know we have just serviced an interrupt, then we also know that the interrupt has been serviced. That's trivial.
- Also, I don't believe the Commodore KERNAL ever looks at the VIC-II. So I think we can rule out an operating system requirement.
- Also, the VIC-II will fire the same interrupt a frame later, because interrupt enable is not in register $d019, it's in $d01a. So we can rule out a requirement coming from le hardware.