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.
I?ve rewritten my code for the 2nd irq (irq 1) so that it could also receive data from the mouse. But I have to look if the data is from the keyboard or the mouse. I make this so:
err. afaik, the mouse doesn't raise IRQ1 when data are available. I'm not sure what interrupt is used for PS2 mouse (for serial mice, it is the COM1 or COM2 interrupt), so i would say you can expect the byte in 8042 to be for the keyboard when the keyboard interrupt is fired and to be for the mouse if the mouse interupt is fired ...
But the ps2 mouse uses the kbd controller and so I think it uses the irq1, too! Because why should it use an extra irq? Also if the ps2 mouse doesn?t use the kbd irq, why gives me bochs this error?
Ok, I want to test if the mouse sends it data and fires irq1. But how can I test if the data is from the kbd or from the mouse? I can?t send the command "read input port" because before I have to read the data and then the bytes for data are cleared. So how can I determine from which device the data is?
on real hardware (pIII motherboard and Logitech PS2 mouse), i can remember i had IRQ12 fired when i moved the mouse by accident. And indeed the mouse data were stored at the 8042 (which is the microcontroller which handles keyboard, but NOT LIMITED to keyboard).
The result is that if you don't read bytes from the 8042 at the mouse interrupt, they will stay at the 8042 and lock further keyboard data.
To find out if the data is from the keyboard or from the mouse, you need to test the status register of the 8042. I have forgotten which, check docs on keyboards the AUX bit in one register indicates the source. Also, to use irq 12h for the mouse, the keyboard controller has to be instructed to use it for ps2 mice, how this is done i have forgotten :-[ but can be found in docs.