mbr_asm/irq_handler.c

27 lines
625 B
C

#include "interrupt.h"
#include "vga.h"
#include "io.h"
#include "pic.h"
#include "irq.h"
// Need GCC > 6
__attribute__((interrupt)) void keyboard_handler(struct interrupt_frame *frame)
{
EOIIrq(IRQ_KEYBOARD);
char c = 0;
if (inb(0x60) != c) {
c = inb(0x60);
if (c > 0)
printChar(c, RED, BLACK, 0, 8);
}
(void)frame;
}
__attribute__((interrupt)) void timer_handler(struct interrupt_frame *frame)
{
static int timeCnt = 0;
EOIIrq(IRQ_TIMER);
printInt(timeCnt++, RED, BLACK, 0, 9);
(void)frame;
}