[comp.os.msdos.programmer] Reading MS Serial Mouse Directly. How?

lulu@ucrmath.ucr.edu (david lu) (02/02/91)

Here at UCR we are in the process of revamping a CS hardware
class.  One of the labs that we thought would be fun to do is
to have the students write an assembly program that reads the
mouse directly from the serial port, bypassing the device
drivers.  So ... does anyone know Microsoft's encoding scheme
for their serial mouse?  This information is not in the docs.

Also, what are the parameters of the serial port?  Baud rate?
Stop bits?  Parity bits?  If someone can at least provide the
parameters, I suppose that I can write some code to read from
the port, and try to figure out the return codes myself.  But
if anyone already has that information already available, I'd
be _very_ grateful if you could let me know.

I guess that I can always try looking at MS's device drivers
with DEBUG, but I'd rather not do that ... :-)

Thank you for any help you can provide.

---==lulu@ucrmath==---  just another bewildered college student.
David T Lu, Amateur Thinker: lulu@ucrmath.ucr.edu, {ucsd, uci}!ucrmath!lulu
"I seem to be having tremendous difficulty with my lifestyle."
					- Arthur Dent, Hitchhiker's

cd5340@mars.njit.edu (Charlap) (02/02/91)

In article <11609@ucrmath.ucr.edu> lulu@ucrmath.ucr.edu (david lu) writes:
>One of the labs that we thought would be fun to do is
>to have the students write an assembly program that reads the
>mouse directly from the serial port, bypassing the device
>drivers.

But.... Why do you want to do this.  You realize that by bypassing
the MOUSE.COM program, you render your program incompatible with any
mouse that isn't MS compatible.  For instance, my Genius mouse, or 
my roommate's Mouse Systems mouse wouldn't work that way, since they
are only compatible with the mouse interrupt, not with the serial port
signals.  Also, a bus mouse wouldn't work with your scheme.

jmalahtinen@cc.helsinki.fi (02/03/91)

In article <11609@ucrmath.ucr.edu>, lulu@ucrmath.ucr.edu (david lu) writes:
> Here at UCR we are in the process of revamping a CS hardware
> class.  One of the labs that we thought would be fun to do is
> to have the students write an assembly program that reads the
> mouse directly from the serial port, bypassing the device
> drivers.  So ... does anyone know Microsoft's encoding scheme
> for their serial mouse?  This information is not in the docs.
> 
> Also, what are the parameters of the serial port?  Baud rate?
> Stop bits?  Parity bits?  If someone can at least provide the
> parameters, I suppose that I can write some code to read from
> the port, and try to figure out the return codes myself.  But
> if anyone already has that information already available, I'd
> be _very_ grateful if you could let me know.
> 
> I guess that I can always try looking at MS's device drivers
> with DEBUG, but I'd rather not do that ... :-)
> 
> Thank you for any help you can provide.
> 
> ---==lulu@ucrmath==---  just another bewildered college student.
> David T Lu, Amateur Thinker: lulu@ucrmath.ucr.edu, {ucsd, uci}!ucrmath!lulu
> "I seem to be having tremendous difficulty with my lifestyle."
> 					- Arthur Dent, Hitchhiker's

Microsoft format :

bit number	7    6    5    4    3    2    1    0
byte 1		1    1    L    R    Y7   Y6   X7   X6
byte 2		0    0    X5   X4   X3   X2   X1   X0
byte 3		0    0    Y5   Y4   Y3   Y2   Y1   Y0

Where	L for left key status	1 for pressed.	X0-X7 is X-axis movement data.
	R for right key status	0 for released.	Y0-Y7 is Y-axis movement data.

Data is shifted from byte 1 bit 0 to byte 3 bit 7 at speed of 1200 bps, no
parity, 2 stop bits. Data is reported upon key status change and X, Y data
change. No change will not cause report.

Source : MIGHTY MOUSE user's manual.

                              
Jussi Lahtinen         E-mail jmalahtinen@cc.Helsinki.FI (Internet)
                              JMALAHTI@FINUH.BITNET      (EARN/BITNET)
                              jmalahti@cs.Helsinki.FI    (in UNIX word)
                              HYLK::JMALAHTINEN          (DECNET)