Paganini wrote:
Here's a weird one. I've continued making progress on my PS/2 keyboard circuit. It's working as expected, except that I'm getting random intermittent lockups.
So you are working on the PS/2 Keyboard stuff, but this code is just going back to basic interrupts, correct? I won't pretend to be a VIA expert, nor interrupt guru. BUT, I see you are using SEI and CLI, so I feel like I have to comment on that.
The story goes I was working on my own PS/2 Keyboard interrupt routine and also doing something else with the same VIA (just changing some output bits, nothing serious). And I too was getting these random mistakes. It would lock up the keyboard entirely, THEN it would unlock itself but spit out weird garbage. To this day I still don't know exactly what was going on, but clearing the keyboard variables in specific places helped fix it.
That said, I tried using SEI and CLI to fix the issue, and it made it terribly worse! The PS/2 keyboard does not wait for us to be ready for incoming data, it just sends it anyways. As far as this single button / counter code goes, I do not know, but it looks very similar to what I was doing: Altering something on the VIA and then interrupt and everything goes haywire. Not every time, but some times.
Try removing SEI and CLI perhaps? I'm sure you tried that, but it is my first guess. What is your interrupt setup code look like? You know, like the PCR and IER stuff. If I didn't ask, I'm guessing someone else would. Have you tried just like:
Code:
inf_loop
INC VIA1_PORTA
DEC VIA1_PORTA
JMP inf_loop
or even
Code:
inf_loop
INC VIA0_PORTA
DEC VIA0_PORTA
JMP inf_loop
while keeping interrupts on/off? Just suggesting super super super basic routines, and working up from there.
Sorry I wasn't a ton of help, I just wanted to mainly comment on the PS/2 Keyboard thing.
Chad