#include "headers/isr.h" #include "headers/common.h" #include "headers/screen.h" #include #include // make an array for the keystate // aswell as a struct for the state of toggle keys // and other ones such as shift ctrl etc // add polling of status bits to recieve input properly extern uint8_t current_color; static void keyboard_callback(registers_t *regs) { regs->eax++; // lul uint8_t scancode = inb(0x60); // read from the 8042 PS/2 data port static int i = 0; static int j = 0; j = j%15; current_color = j++; kprintf("keyboard event 0x%x : %d\n",scancode,scancode); i++; // check for key presses like shift // else use a lookup table to print it dependant on the state } void init_keyboard(void) { // register our keyboard callback register_interrupt_handler(IRQ1,&keyboard_callback); // poll until buffer is empty bool full = true; while(full) { full = inb(0x64) & 1; // poll bit 1 of status reg } // send a scancode change request outb(0x60,0xF0); //scan code change outb(0x60,0x2); // set 2 }