home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.dec.micro
- Path: sparky!uunet!math.fu-berlin.de!news.th-darmstadt.de!news
- From: KNIRSCH@linac.ikp.physik.th-darmstadt.de (MARTIN KNIRSCH)
- Subject: RE: Mouse Interface
- Sender: news@news.th-darmstadt.de (The Usenet-News System)
- Message-ID: <1992Aug15.140856.17204@news.th-darmstadt.de>
- Date: Sat, 15 Aug 1992 14:08:56 GMT
- X-News-Reader: VMS NEWS 1.21
- Nntp-Posting-Host: lin400.ikp.physik.th-darmstadt.de
- Organization: Technical University Darmstadt, FRG (Nuclear Physics Institute)
- Lines: 39
-
- Mouse Interface
- -1- A adapter from eight pin mouse connector to RS232 should be
- avaiable in any electronic store.
- -2- My mouse (Z-NIX Microsoft compatrible) uses the following
- RS232 pins : TXD(2), RXD(3), DTR(20), SGND(7) and RTS(4)
- -3- Programming (on a Rainbow) is as follows :
- Set up Communication Control Block
- (Microsoft standard is 7 Bit, no Parity, 1200 Boud)
-
- MOV AH,44H
- MOV AL,FUNCTION CODE
- MOV BX,HANDLE ; USE HANDLE 3 FOR COMM1
- MOV DX,OFFSET CCB ; ADDRESS OF COMMUNICATION CONTROL BLOCK
- INT 21H
-
- Lot's of function codes for programming the RS232 are avaiable
- (Consult a DOD manual).
- First disable receiver interrupts, then clear DTR and RTS.
- Program CCB to Microsoft Mouse Protocol as listyed above.
- Enable receiver interrupts and set DTR and RTS.
- The Mouse sends back three data bytes :
-
- Bit # 7 6 5 4 3 2 1 0
- Byte0 : X 1 L R Y7 Y6 X7 X6
- Byte1 : X 0 X5 X4 X3 X2 X1 X0
- Byte2 : X 0 Y5 Y4 Y3 Y2 Y1 Y0
-
- Data ranges are -128 to + 127 (Don't forget the 2'nds Complement
- for negative values)
-
- Mouse Data is written into a circular buffer. When DTR and RTS
- are set for the first time, the mouse sends a "M" identifying
- itself. If you receive the "M" most work is done. Reading
- mouse data then is don by first testing Bit 6 of Byte 0, the sync Bit.
- (Bit 5 and 4 indicate pressed mouse buttons.) When Byte 0 is identified
- generate the X and Y databytes. They are representing the distance the
- mouse was moved since the last movement measured in mickeys (1/200 inch
- or 1/400 inch).
- Hope that helps a little. Martin
-