Master the fundamental concepts of device drivers & interrupts through this focused micro-challenge.
IRQ1 signals data available at port 0x60 (scan code) and status in port 0x64. The ISR should read the byte, translate with a table if needed, and buffer it for the main loop. For example, scan code 0x1E is the make code for the 'A' key; 0x9E is the break code with high bit set on older sets.
nasmLoading…
0x64 bit 0 set means output buffer fullSet 1 uses make/break with bit 7 set on release; set 2 uses 0xF0 prefix bytes. The 8042 may buffer multiple bytes during fast typing; drain port 0x60 until empty inside the ISR or risk losing edges. Do not translate to ASCII inside the ISR if you use a complex layout table; store raw bytes and translate in the main loop where floating point and division are allowed.
You will handle IRQ1, read scan codes from port 0x60, and store them in a ring buffer. This exercise requires PIC EOI and non-blocking work inside the handler.
Implement a PS/2 keyboard ISR in C.
Requirements:
Test:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github