Page 1 of 1
how to get mouse input?
Posted: Thu Jan 16, 2003 12:00 am
by Adek336
how to get direct mouse input from ports? do i just have to read com1 or do i have to initialise it?
Thnx, Adrian.
RE:how to get mouse input?
Posted: Thu Jan 16, 2003 12:00 am
by jamethiel
I'm afraid you're going to have to be a little more specific here. Serial mouse, PS/2 mouse, ADB mouse, Logitech mouse bus mouse, Microsoft mouse bus mouse, Commodore 64 mouse, SNES mouse, which?
RE:how to get mouse input?
Posted: Fri Jan 17, 2003 12:00 am
by Adek336
I've a PS/2. I've heard it is to be read by IRQ 12, but with keyboard ports. How may I enable pic1?
Thnx, Adrian.
RE:how to get mouse input?
Posted: Fri Jan 17, 2003 12:00 am
by jamethiel
The IRQs are your business, I'll cover some of the mouse side.
To enable the mouse port, write 0xa8 to port 0x64.
To enable the mouse, write 0xd4 to port 0x64, then send byte 0xf4 as if you were sending a keyboard command (as if you were changing the keyboard LED status with 0xed, whatever). The 0xd4 to port 0x64 says to send the next output byte to the mouse port instead of the keyboard port. The 0xf4 is a mouse command to start sending packets.
When a mouse byte (as opposed to a keyboard byte) comes in, port 0x64 will have the 0x20 bit high. This is how you distinguish the two input sources in a polled implementation, and can act as an extra safety check in an interrupt-driven system.
Hope this helps.
RE:how to get mouse input?
Posted: Fri Jan 17, 2003 12:00 am
by Adek336
It resets, weird.
outportb(0x64, 0xa8);
outportb(0x64, 0xd4);
outportb(0x64, 0xf4);
it resets after the third, i've checked.
perhaps i've got the ports all wrong?
Thnx, anyway,
Adrian.
RE:how to get mouse input?
Posted: Fri Jan 17, 2003 12:00 am
by jamethiel
Umm... By 'as if you were changing the keyboard LED status with 0xed' I meant to send it to port 0x60 after waiting for a bit in port 0x60 to reach a specific state (memory fails me, and I'm in no position to check for specifics right now).
Hope this helps.