[comp.sys.ibm.pc] The insides of a mouse

lloyd@comp.vuw.ac.nz (Lloyd Parkes) (11/27/89)

Okay now,

The mouse transmits at 1200, 7N1, and the driver is interrupt driven
(of course).

The information is transmitted in three characters.

	1) bit 6 set
	   bit 5 left button
	   bit 4 right button
	   bits 3&2 top two bits of the y movement
	   bits 1&0 top two bits of the x movement

	2) bit 6 reset
	   bits 0-5 x movement

	3) bit 6 reset
	   bits 0-5 y movement

The bits in the first byte should be shifted and then set into the 2nd
and 3rd bytes. e.g.

	x1xxxxXX		first byte
	XX000000		shift left

	xxXXXXXX		2nd byte
	XXXXXXXX		ored with first byte

ditto for the Y movement, this value is signed, and you should do a
CBW in assembler or cast to int in C or DEL *.EXE in BASIC :-)

You must test for data overrun and if you get a bit 6 set, then it is
the first, unconditionally. If you are expecting a 1st byte, and you
get one with bit 6 reset, discard it.

				Lloyd
--
------------------------------------------------------------------------
Lloyd	| lloyd@comp.vuw.ac.nz	  | Now all I have to do is write X
Parkes	| ...!uunet!vuwcomp!lloyd | window & segment swapping
------------------------------------------------------------------------