From 2f82430b488878d321276e6efb10c61042ca2930 Mon Sep 17 00:00:00 2001 From: aqua Date: Tue, 1 Nov 2022 21:18:17 +0200 Subject: Enable interrupts after enabling the PIC --- devices/pic.h | 1 + devices/pic_8259.c | 11 +++++++++++ devices/ps2_keyboard.c | 9 +++++++++ devices/vga.c | 4 ++-- 4 files changed, 23 insertions(+), 2 deletions(-) (limited to 'devices') diff --git a/devices/pic.h b/devices/pic.h index 685a85b..c545c60 100644 --- a/devices/pic.h +++ b/devices/pic.h @@ -1,4 +1,5 @@ #pragma once void pic_init(); +void pic_enable(); void pic_clear(unsigned char irq); diff --git a/devices/pic_8259.c b/devices/pic_8259.c index 74c576a..62164d3 100644 --- a/devices/pic_8259.c +++ b/devices/pic_8259.c @@ -1,4 +1,5 @@ #include "pic.h" +#include #include #define PIC1 0x20 @@ -27,9 +28,19 @@ pic_init() outb(ICW4_8086, PIC1 + DATA); outb(ICW4_8086, PIC2 + DATA); + // PIC masks + outb(0xff, PIC1 + DATA); + outb(0xff, PIC2 + DATA); +} + +void +pic_enable() +{ // PIC masks outb(0xfc, PIC1 + DATA); outb(0xff, PIC2 + DATA); + + enable_interrupts(); } void diff --git a/devices/ps2_keyboard.c b/devices/ps2_keyboard.c index e5af423..4ebcc65 100644 --- a/devices/ps2_keyboard.c +++ b/devices/ps2_keyboard.c @@ -1,4 +1,5 @@ #include "ps2_keyboard.h" +#include "vga.h" #include #include #include @@ -50,6 +51,14 @@ ps2_keyboard_irq_handler() case 0xb6: // right shift up shift_case = 0; return; + + case 0x5b: // left meta + case 0x5c: // right meta + return; + + case 0x58: // F12 + vga_clear(VGA_COLOR_LIGHT_BLUE, VGA_COLOR_LIGHT_GREY); + return; } if (key >= 0x80) return; diff --git a/devices/vga.c b/devices/vga.c index 908bd5e..93231ea 100644 --- a/devices/vga.c +++ b/devices/vga.c @@ -20,7 +20,7 @@ void vga_init() { buffer = (struct VGAEntry *)0xc03ff000; - // vga_enable_cursor(0, 15); + vga_enable_cursor(0, 15); vga_clear(VGA_COLOR_LIGHT_BLUE, VGA_COLOR_LIGHT_GREY); } @@ -35,7 +35,7 @@ vga_clear(enum vga_color foreground, enum vga_color background) buffer[index].background = background; } col = row = 0; - // vga_update_cursor(); + vga_update_cursor(); } void -- cgit v1.2.1