I'm new to the forums and the VIC-20 was my second computer (first was ZX81). I never got beyond BASIC programming, all my M/C was on later machines, so after 36 years I thought I'd try some M/C on the VIC.
I am having some trouble getting interrupts working properly though, I have written the following code to test a VIA 2, T2 interrupt but it gets stuck in the interrupt routine. Instead of returning to the main loop once the RTI is called it jumps straight back to $FF72. I am debugging in VICE but it doesn't show what the 6522s are doing so it doesn't help much. I know it will be something simple but I can't see it for the life of me and I've tried google.
Grateful for any assistance, thanks.
Code posted below.
Code: Select all
sei ;disable interrupts
stx $315 ;set up interrupt address
sty $9219 ;set V2 T2 counter
lda #$7f ;clear all via#2 interrupt enable bits
lda #$a0 ;enable T2 interrupt on via#2
lda $921b ;read aux control
and #$df ;clear T2 control bit
sta $921b ;so T2 is one shot counter
cli ;now enable interrupts
;is it from V2 T2
sta $900f ;set border/screen colour
sta $9218 ;set V2 T2 counter
sta $9219 ;this write should clear int flag