#include "keyboard.h" #include "ps2_controller.h" #include #include #include const char scancodes[2][68] = {{'E', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b', 'T', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', 'C', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 'L', '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 'R', 'P', 'A', ' ', 'C', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}, {'E', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '\b', 'T', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n', 'C', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~', 'L', '|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', 'R', 'P', 'A', ' ', 'C', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}}; int shift_case = 0; void ps2_keyboard_init() { } void ps2_keyboard_irq_handler() { const uint8_t key = ps2_read_port1(); switch (key) { case 0x2a: // left shift down case 0x36: // right shift down shift_case = 1; return; case 0xaa: // left shift up 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; if (key < (sizeof(scancodes[0]) / sizeof(const char))) printf("%c", scancodes[shift_case][key - 1]); else printf("key pressed: %x\n", key); }