aboutsummaryrefslogtreecommitdiff
path: root/mubios/services
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-11-09 23:42:19 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-11-09 23:42:19 +0800
commit2bc8a824fd424aa3e21bc394fd0be3191b830888 (patch)
tree4b6fcfc27e6caa1d80c4f35dbb410620815ae262 /mubios/services
parent06cb46aa0236352554f23697e17bed378083be1a (diff)
downloadrcc-project-2bc8a824fd424aa3e21bc394fd0be3191b830888.tar.gz
rcc-project-2bc8a824fd424aa3e21bc394fd0be3191b830888.tar.xz
[mubios] Initialize the 8042 keyboard controller
POST only unmasked IRQ1 in the PIC and never configured the 8042 itself, so the keyboard stayed in its post-reset disabled state: the clock was inhibited and no scan code ever reached the output buffer. IRQ1 never fired, the BDA keyboard buffer stayed empty, and GRUB polling INT 16h AH=01h never saw a key. Add kbd_init() to disable both ports, drain the output buffer, clear the clock inhibit bits in the command byte, enable the keyboard and auxiliary IRQs and select set 1 translation, then enable scanning with 0xF4. The IRQ1 handler now checks the status register for a pending output byte before reading the data port and drops auxiliary port bytes. The set 2 break prefix tracking is gone because translation is enabled.
Diffstat (limited to 'mubios/services')
-rw-r--r--mubios/services/int16.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/mubios/services/int16.c b/mubios/services/int16.c
index 5872fb1..cadc1ff 100644
--- a/mubios/services/int16.c
+++ b/mubios/services/int16.c
@@ -17,6 +17,7 @@
*/
#include "bios.h"
+#include "io.h"
#include "regs.h"
#define BIOS_ZF 0x0040u
@@ -27,18 +28,6 @@
#define BDA_KBD_BUFFER_END 0x003Eu
static u8
-normalize_scancode (u8 scancode)
-{
- switch (scancode)
- {
- case 0x5Au:
- return 0x1Cu;
- default:
- return scancode;
- }
-}
-
-static u8
scancode_to_ascii (u8 scancode)
{
switch (scancode)
@@ -138,7 +127,7 @@ int16_service (struct bios_regs *regs)
position = *head;
value = buffer[(position - BDA_KBD_BUFFER_START) >> 1];
- scancode = normalize_scancode ((u8)(value >> 8));
+ scancode = (u8)(value >> 8);
ascii = scancode_to_ascii (scancode);
regs->eax = ((u32)scancode << 8) | ascii;