ps2 init complete, can receive keyboard presses

This commit is contained in:
2026-06-13 19:53:57 -04:00
parent 3ecbcdf369
commit 2ab98fe582
11 changed files with 240 additions and 21 deletions

View File

@@ -1,6 +1,8 @@
#include "drivers/pic/pic.h"
.code32
.extern io_wait
.global init_pic
init_pic:
# init command
@@ -17,7 +19,7 @@ init_pic:
# cascade
mov $0x04, %al
outb %al, $PIC1_DATA
mov $0x02, %al
mov $0x02, %al
outb %al, $PIC2_DATA
# env
@@ -25,7 +27,7 @@ init_pic:
outb %al, $PIC1_DATA
outb %al, $PIC2_DATA
# mask all
# mask
mov $0xFC, %al
outb %al, $PIC1_DATA
mov $0xFF, %al
@@ -33,10 +35,6 @@ init_pic:
ret
.global io_wait
io_wait:
ret
.global send_eoi_master
send_eoi_master:
mov $0x20, %al
@@ -49,3 +47,19 @@ send_eoi_slave:
outb %al, $PIC2_COMMAND
call send_eoi_master
ret
.global read_isr_master
read_isr_master:
xorl %eax, %eax
mov $0x0B, %al
outb %al, $PIC1_COMMAND
in $PIC1_COMMAND, %al
ret
.global read_isr_slave
read_isr_slave:
xorl %eax, %eax
mov $0x0B, %al
outb %al, $PIC2_COMMAND
in $PIC2_COMMAND, %al
ret