Hi!
I have been playing with interupts a little, in kickc, and it all works nice. But now I tried to incooperate it in a game I hit a snag.
It seems when I setup an interupt, for scanline, my keyboard functions stop working.
I am probably doing something really basic wrong.
The weird thing is also, when I restore the interupt to it's previous state, the keyboard is still not working.
ps. the keyboard routing I am using is kickc "kbhit", which seems to call kernal routine "GETIN" at $FFE4, I also tried directly calling kernal routines, which works fine, but not when my interupt is enabled.
ps2. I enable the interupt, something like this.
Quote
__interrupt void irq_line() {
//do stuff
}
void main() {
//kbhit function works fine here
//store old interupt values
old_irq = *KERNEL_IRQ;
old_ien = *VERA_IEN;
SEI();
*KERNEL_IRQ = &irq_line;
*VERA_IEN = VERA_LINE;
*VERA_IRQLINE_L = 4;
CLI();
//kbhit function stopped working
//try to restore the interupt
SEI();
*KERNEL_IRQ = old_irq;
*VERA_IEN = old_ien;
CLI();
//kbhit function is not restored.
}
What I am asking is.
How does the keyboard normally work?
1- Is there an interupt when a key is pressed? Why does that interup stop working when I set my scanline interupt. How are they related? Do I need to do some extra "magic" at the end of my scanline interupt, to keep the key handling interupt working?
2- Can you somehow check the keyboard in a loop, without interupt, by polling a memory address or maybe a vram address, and if so which one?
Also anyone could point me to the correct sections in the documentation, I will be thankfull!
The most accurate I have found an answer is the section in the manual called "'Custom keyboard scan code handler". But I somehow don't get the full picture.
Thanks
CC