Added code to support getting interrupts from the PIC. Can now get some data from the keyboard, however, it's not quite working yet.
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
#include "../includes/kb.h"
|
||||
#include "../includes/pic.h"
|
||||
#include "../includes/screen.h"
|
||||
|
||||
#define KB_PORT 0x60
|
||||
#define KB_STATUS_PORT 0x64
|
||||
|
||||
void handle_key_press()
|
||||
{
|
||||
pic_acknowledge(33);
|
||||
|
||||
unsigned char status = inb(KB_STATUS_PORT);
|
||||
|
||||
if(status & 0x01)
|
||||
{
|
||||
char keycode = inb(KB_PORT);
|
||||
|
||||
if(keycode < 0) return;
|
||||
|
||||
draw_string(int_to_string(keycode, 10), 0xF, 0x0);
|
||||
}
|
||||
}
|
||||
|
||||
void init_kb()
|
||||
{
|
||||
outb(0x21, 0xFD);
|
||||
}
|
||||
Reference in New Issue
Block a user