The ROM IRQ routine at $EA31 is usually trigggered by the timer interrupt 60 times a second. Is it possible to switch the interrupt source to VIC and still use the same routine? If yes, which memory locations need to be changed for this? I think the interrupt type for timer and VIC is the same, but I'm not sure if the pending interrupt would be cleared by the handler.

  • You should most definitly join some C64 programming forum and ask there.
    – Raffzahn
    Jan 18, 2019 at 17:51
  • 3
    @Raffzahn why? This is the perfect place! Jan 18, 2019 at 21:17

1 Answer 1


That's not possible, because the KERNAL's routine will acknowledge the IRQ at the CIA#1, not at the VIC (it assumes the CIA#1 is the IRQ source). So the least you have to do is to acknowledge the IRQ at the VIC yourself (see minimal code example), apart from that, the original routine will work.

        lda #$7f
        sta $dc0d       ; disable CIA#1 IRQs
        lda $dc0d       ; acknowledge pending IRQ at CIA#1 just in case
        lda #<myisr
        sta $314
        lda #>myisr
        sta $315        ; set KERNAL IRQ vector to new routine
        lda #$1b
        sta $d011
        lda #$0
        sta $d012       ; configure raster IRQ at raster line 0
        lda #$1
        sta $d01a       ; enable VIC IRQ

myisr:  asl $d019       ; acknowledge IRQ at VIC
        jmp $ea31       ; to original KERNAL routine

Side note: on a PAL machine, this will cause the system IRQ to run at 50Hz, rendering the "system clock" TI$ completely unusable.

  • 1
    I think the CIA interrupt could be left enabled at roughly 60Hz if one adjusts it so that it occurs exactly once every 16380 cycles (about 60.14Hz) and one doesn't need to service a VIC-II interrupt anywhere near the spots where the CIA would hit (16380 cycles would be exactly 5/6 of a frame, so there would be six places the interrupts would hit; if one stops the CIA clock, waits for the beam to reach a certain spot, and then configures it, that one could control where those six places are).
    – supercat
    Jan 18, 2019 at 21:27
  • @supercat the "not quite perfect" TI$ normally isn't worth such hassle. But sure it can be done this way. You'd also need a way to figure out which chip generated the IRQ (e.g. by just asking those chips or by having some fixed sequence you know in advance) for correctly dispatching ... Jan 19, 2019 at 7:47
  • 1
    @supercat btw, a much simpler approach for keeping TI$ at least somewhat usable on PAL works as soon as you have at least two raster positions for your IRQs. In one of them, always leave to $ea31, as normal. In the other one that normally leaves to $ea81 (skipping the system IRQ code), also leave to $ea31 every 5th time. I'd prefer this over having two active IRQ sources. Jan 19, 2019 at 7:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .