28 lines
418 B
C
28 lines
418 B
C
#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);
|
|
}
|