Thanks for all the feedback,
So today I cam back to this, since I forgot about it for a while, as everything that made sense just ended up not working. And I needed to get some other things done.
Now I noticed that when I disabled the interrupt it was not working either
?, I noticed the combination of kbhit and vpoke, as defined in KickC, at least the version I have, crashed.
So when I found this out, then I replaced the vpoke by my own implementation, and suddenly the version without interupt was all ok, now one more try WITH interupt.
What I did get working on the end, is more or less described by the following minimal code snippet.
Quote
..
volatile char vbcounter=0;
volatile char linecounter=0;
__interrupt( rom_sys_cx16 ) void myInterupt() {
if( *VERA_ISR & VERA_LINE ) {
//DO Line interupt stuff
linecounter++;
//end interupt
*VERA_ISR &= VERA_LINE;
asm {
ply
plx
pla
rti
}
}
else if( VERA_ISR & VERA_VSYNC ) {
//Do sync interupt stuff
vbcounter++;
}
}
..
RTFM helped me a bit as well, seeing that KickC has some support build in for X16 interrupts, with or without keyboard (system or minimal).
All worked fine for none line interupts, but for line interrupts, I still needed a bit of assembly, as you see above, to exit correctly. (ply, plx, pla, rti )
This is probably the best version I have right now, with the least amount of assembly code in it, and it works nicely together with keyboard.