Posted By
KiCHY on 2010-03-18 09:04:14
| Re: Keyboard scan function in the needs!
Ok, this is the situation: I'm trying to write a program with CC65. In defaults the CC65 init routine disables ROM, redirects $FFFE-F vector to its custom IRQ which with other things does a JMP ($314) with a carefully prepared stack to be able to return the PC exactly after the JMP($314). CC65 gives standard ways to scan keyboard (i use kbhit() and cgetc()), which compiles into a SEI STA $FF3E JSR $FFxx STA $FF3F CLI sequence of commands. I redirected $FFFE-F to my own IRQ routine which fires at two specified rasterlines and skips the JMP($314) becouse it eats more rastertimes I have. When I want to use the kernal keyboard routines from C, I have to do that SEI...CLI sequence but calling the JSR $FF.. function take too much time and the IRQ routine can't run flawlessly.
So my plan is to do the raster-thing with IRQ and handle the keyboard with a custom function which doesn't SEI/CLI. I wanna keep those luxury functions (key repeat after a delay) it gives, and the keyboard buffer if possible.
Naturally I could translate the FD30/FF08 keymatrix into ascii tables but this is only the easier part of keyboard scan function (implement the delay, the repeat, the buffer) and I didn't want to develop it if someone else did the job earlier.
|