#include "acpi/acpi.h" #include "boot/tag.h" #include "cpu/cpu.h" #include "drivers/ps2ctrl.h" #include "drivers/ps2kb.h" #include "drivers/ps2mouse.h" #include "interrupt/idt.h" #include "interrupt/pic.h" #include "time.h" #include "tty/cursor.h" #include "tty/term.h" #include #include #include #include static double x = 0, y = 0; void kernel_main(void* boot_info) { term_init(); cursor_enable(); rtc_set_timezone(-4); rtc_update(); idt_init(); pic_remap(PIC_REMAP_OFFSET); load_boot_info(boot_info); acpi_init(); memory_init(); ps2ctrl_init(); ps2kb_init(); ps2mouse_init(); init_registers(); while(1) { int_wait(); struct Keycode code = ps2kb_get(); if(code.key != KEY_NONE) { if(code.flags & KC_FLAG_ERROR) { printk("error: %X\n", code.key); } else if(code.flags & KC_FLAG_KEY_DOWN) { printk("pressed: %X\n", code.key); } else { printk("released: %X\n", code.key); } } if (code.key == KEY_ESCAPE) { acpi_poweroff(); } struct MouseEvent event = ps2mouse_get(); if (event.updated) { putchar(event.lmb ? 'L' : '_'); putchar(event.rmb ? 'R' : '_'); putchar(event.mmb ? 'M' : '_'); x += event.relx / 10.0; y -= event.rely / 10.0; x = fclamp(x, 0, TERM_W); y = fclamp(y, 0, TERM_H); printk(" x%d y%d\n", (int)x, (int)y); } term_flush(); rtc_update(); } }