Write Your Own Operating System 6: Keyboard Interrupts | Kernel Dev Tutorial Part 6

Added:

Interrupt Handling
PIC Activation
Interrupt Filtering
Handler Interface
Keyboard Driver
Key Code Mapping
Hardware Problem

Interrupt Handling

0:02
Playing Section
  • 1

    Identify the need to acknowledge interrupts from the PIC to prevent system halts.

  • 2

    Establish a static pointer to the interrupt manager for object-oriented access.

  • 3

    Redirect interrupt flow from a static function to a class method.

Understanding of x86 Assembly language, particularly low-level CPU registers and I/O instructions like IN and OUT.
Conceptual knowledge of the Interrupt Descriptor Table (IDT) and how the CPU dispatches hardware and software interrupts.
Basic familiarity with the 8259 Programmable Interrupt Controller (PIC) architecture and how IRQs (Interrupt Requests) are mapped.
Prior experience writing and compiling a minimal kernel entry point in C and Assembly.
Implementing a scancode translation module to map raw keyboard make/break codes to ASCII characters, handling modifiers like Shift and Caps Lock.
Developing a basic interactive shell or Command Line Interface (CLI) to read, parse, and execute text input from the keyboard.
Configuring the Programmable Interval Timer (PIT) to handle periodic interrupts, enabling system time tracking and basic multitasking scheduler ticks.
Exploring advanced hardware drivers, such as writing a display driver or setting up mouse interrupts via the PS/2 controller.
21.1K views363likes56:31@writeyourownoperatingsystemOriginal Release: 2016-03-18

This video demonstrates how to implement a keyboard driver in a custom operating system by creating an interrupt handler class that responds to keyboard interrupts (IRQ 0x21), reading key codes from the keyboard's data port (0x60), and properly acknowledging interrupts to the Programmable Interrupt Controller (PIC) to enable continuous hardware communication. The tutorial shows how to transition from static interrupt handling to object-oriented design using an interrupt handler base class, and explains the challenges of USB keyboard support requiring BIOS legacy support settings.