Is My Understanding of the Keyboard Interrupt Handling Process Correct?

(post recategorized by admin)

i want someone to confirm if my understanding is correct:

When someone presses a key on the keyboard, for example the letter "A", the character goes to the keyboard controller, where it's stored in one of its registers.
Then, the controller sends an interrupt request to the CPU.
The CPU checks the Interrupt Vector Table (IVT), which was placed in RAM by the BIOS.
But in order for the CPU to know where the IVT is located, it reads the IDTR register to get the IVT address.
After finding the interrupt address, the CPU jumps to the BIOS code that handles the keyboard interrupt.
Then, the CPU reads the character from the I/O port of the keyboard controller, where the character is stored.
Finally, the CPU stores the character (e.g., "A") somewhere in RAM.

Is that correct?

If you were using an IBM PC/AT keyboard from 1986, that would be mostly correct. :wink:

In the 21st Century, virtually every keyboard is a USB device. The fact that it is a keyboard is mostly irrelevant. All USB devices gets processed the same way at the low level. The wire data and interrupts are part of the USB Host Controller, and the USB HID drivers make USB requests like any other USB client driver.

I assume you're talking about REAL mode as IVT(Interrupt Vector table) is mentioned. In real mode, IVT always starts from seg0:offset 00, 256 entries.
In protected mode, IDTR points to IDT( interrupt descriptor table).

With an 8259 like PIC system, upon receiving an interrupt from the PIC, CPU quires the pic on the source of maskable interrupt after finishing current instruction. The PIC encodes the vector info in response to the QUERY so the 8086/20286/80386 CPU knows exactly the corresponding vector# to interrupt.

Calvin

That's not quite true. There is a small but important segment of the market that continues to use PS2 style keyboards. Game players mostly who are worried about the key stroke latency

But for people who type at reasonable speeds, USB keyboards dominate