Ps/2 Compatible Mouse Driver File

// Send EOI to PIC outb(0x20, 0x20); In real mode or protected mode, you must set up the IDT (Interrupt Descriptor Table) for IRQ12 (vector 0x2C if PIC is in standard remap). Example for 32-bit protected mode:

int old_buttons = 0; while (1) mouse_y) printf("Mouse moved: %d, %d\n", mouse_x, mouse_y); mouse_x = 0; mouse_y = 0; sleep(10); ps/2 compatible mouse driver

void install_mouse_handler() set_idt_gate(0x2C, (uint32_t)mouse_isr, 0x08, 0x8E); outb(0x21, inb(0x21) & ~0x20); // Unmask IRQ12 on slave PIC outb(0xA1, inb(0xA1) & ~0x20); // Send EOI to PIC outb(0x20, 0x20); In