PETTERM icon indicating copy to clipboard operation
PETTERM copied to clipboard

Skip wait cycles in fast keyboard polling code in IRQ handler

Open rbergen opened this issue 1 year ago • 2 comments

The fast keyboard polling code in the IRQ handler currently doesn't skip the waiting cycles as it counts down POLLTGT from POLLRES to 11. Instead, it treats values > 11 as scanning rows. This makes KBDROWPOLL attempt to scan key rows with indices > 9, which don't exist. I've also moved the decreasing of POLLTGT to just before the evaluation of POLLTGT's value, which means it only needs to be included once in the fast keyboard poll section of the IRQ handler. It is also more consistent with the structure of the slow keyboard polling code.

rbergen avatar Jul 26 '22 19:07 rbergen

Looks good! Can't believe I typoed the number in hex when it should be decimal. Wondering if maybe that was a remnant of some of the early fast keyboard scanning attempts I made or just a goof that didn't break anything. I just want to setup my PET again and do a test first myself and then I'll merge.

ChartreuseK avatar Nov 01 '22 19:11 ChartreuseK

I actually only noticed the #$11 thing 3 months after making the other changes, myself. :) And yes, please do test. I have tested the code, but not in the context of PETTERM as such. I extracted the serial driver code from PETTERM for use in a friend's PET project that I contributed to. I discovered and initially fixed the bug in that setting.

rbergen avatar Nov 01 '22 21:11 rbergen