Solved - Keyboard Interrupts stop working after a few seconds

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
DontYellAtMe
Posts: 2
Joined: Tue Jun 23, 2026 4:54 pm
Libera.chat IRC: GuysImNotAProfessionalDontYellAtMe

Solved - Keyboard Interrupts stop working after a few seconds

Post by DontYellAtMe »

Pretty much the title, I got my interrupts working about two weeks ago, but I have a bug I've tried everything to fix, and now I'm giving up and asking the internet. My keyboard ISR is meant to print the PS/2 scancode to the VGA text buffer, but they stop working after a few seconds of going fine. It does work fine for the first couple of seconds, so I don't think I've done a silly basic thing like not setting up the IDT, PIC, sending EOI's, or never reading the scancode port (0x60).

Solved:
I did do a silly thing, I forgot to add a ret at the end of some ASM functions.
Shot @Octocontrabass
Last edited by DontYellAtMe on Wed Jun 24, 2026 8:25 pm, edited 1 time in total.
Octocontrabass
Member
Member
Posts: 6275
Joined: Mon Mar 25, 2013 7:01 pm

Re: Bug - Keyboard Interrupts stop working after a few seconds

Post by Octocontrabass »

DontYellAtMe wrote: ↑Tue Jun 23, 2026 11:39 pmI don't think I've done a silly basic thing like not setting up the IDT, PIC, sending EOI's, or never reading the scancode port (0x60).
Does forgetting the RET instruction at the end of some assembly functions count as a silly basic thing?
DontYellAtMe wrote: ↑Tue Jun 23, 2026 11:39 pmIs it normal for IRQ1 to occasionally have multiple bytes waiting in the PS/2 controller output buffer,
That can happen in virtual machines or when the PS/2 controller is emulated in SMM.
DontYellAtMe wrote: ↑Tue Jun 23, 2026 11:39 pmand should I be trying to read this in a while loop as described below?
Probably not. The PS/2 controller raises one IRQ per byte, so this could cause weird timing issues with the interrupt controller that result in lost or spurious IRQs.
DontYellAtMe
Posts: 2
Joined: Tue Jun 23, 2026 4:54 pm
Libera.chat IRC: GuysImNotAProfessionalDontYellAtMe

Re: Bug - Keyboard Interrupts stop working after a few seconds

Post by DontYellAtMe »

Octocontrabass wrote: ↑Wed Jun 24, 2026 7:57 pm Does forgetting the RET instruction at the end of some assembly functions count as a silly basic thing?
I may have done one silly thing then. :^o :oops:

Thank you so much, I've scanned that for days and days, put the code through every AI you can think of, and you've fixed it straight away =D> =D> =D>

Your a G
Post Reply