Keyboard Driver
PS/2 Keyboard Input Handling
Overview
The keyboard driver handles input from PS/2 keyboards via interrupt-driven scan codes. AOS scans codes and converts them to ASCII characters for shell and command processing.
PS/2 Protocol
| Port | Register | Purpose |
|---|---|---|
| 0x60 | Data | Read scan codes |
| 0x64 | Status/Control | Control port |
Scan Code Mapping
PS/2 keyboards send make codes (key press) and break codes (key release). Scan code set 1 is most common:
| Scan Code | Character |
|---|---|
| 0x02 - 0x0D | 1-0 (number row) |
| 0x10 - 0x19 | Q-P (top letter row) |
| 0x1E - 0x26 | A-L (middle letter row) |
| 0x2C - 0x32 | Z-M (bottom letter row) |
Key Takeaways
- ✓ Keyboard sends interrupt on IRQ 1
- ✓ Scan codes read from I/O port 0x60
- ✓ Make/break codes distinguish press/release
- ✓ Shift/Ctrl/Alt modify character output
- ✓ Characters buffered for shell processing