[LispM-Hackers] Keyboard problem

Nyef nyef@softhome.net
Sun Mar 24 06:37:01 2002


On Sun, 24 Mar 2002, Nyef wrote:

> On Sat, 23 Mar 2002, John Morrison wrote:
>
> > The other other Bad News is that I guess we will have an issue with
> > supporting mice, eh?  USB?  PS/2?
>
> PS/2 mice are easy. There's another interrupt to worry about (I'm not sure
> which one, maybe 12), but you also check the value of port 0x64 before you
> acknowledge the byte recieved (same data port and everything). If the 0x20
> bit is high, then it's a mouse byte, otherwise it's a keyboard byte. Mouse
> data is sent in 3-byte packets. Unfortunately, I forget the exact format,
> and am too tired to decypher my code right now. It should be fairly simple
> to figure out if you remember that the X and Y movement fields are 9 bits
> wide (8 bits each in two bytes, and 1 bit each in the byte with the button
> states and such). This also means that you could use almost the same
> interrupt handling code for both mouse and keyboard interrupts (the only
> exception being the interrupt acknowledge code).

I was just looking over my system sources, and noticed that I forgot about
the enable sequence. You write 0xa8 followed by 0xd4 to port 0x64, then
write 0xf4 to port 0x60.

If memory serves, 0xa8 enables the mouse port, 0xd4 says to send the next
output byte to the mouse, and 0xf4 tells the mouse to start sending
packets.

> > -jm

---------------------------
All programming can be viewed as an exercise.
---------------------------
Alastair Bridgewater
e-mail: nyef@softhome.net