Mouse handler

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
mine

Mouse handler

Post by mine »

I have written a mouse handler but when i use it the mouse works well and the keyboard returns invalid chars. Why?

the code:

void outport60(unsigned value) {
volatile unsigned char ready=0x20;
while ((ready & 0x02) != 0)
ready=inportb(0x64);
outportb(0x60,(unsigned char) value);
}

void outport64(unsigned value) {
volatile unsigned char ready = 0x02;
while ((ready & 0x02) != 0)
ready=inportb(0x64);
outportb(0x64, (unsigned char) value);
}

void mouse_init() {
outport64(0x60);
outport60(0x03);
outport64(0xa8);
outport64(0xd4);
outport60(0xf4);
setvector((unsigned)mouse_handler,0x8e,0x2c);
        enable_irq(0x2c);
}

void mouse_handler() {
        // The code that handles the mouse interrupt
        // It works fine
        ...
        outportb(0x20,0x20);
        outportb(0xa0,0x20);
}
Post Reply