TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: PAUL WANKADIA
from: JAMES VAHN
date: 1997-08-20 17:47:00
subject: Re: hardware ports

> Does anyone happen to know what hardware port(s) I have to read/write
> to/from if I want to attach a live mouse to my computer?  Can I use
> DMA and/or IRQs as well?  TIA.
It sits on the serial port, an IRQ for everything- up to the programmer
to decipher the data. Some info from Serial18.doc from Chris Blum:
-+------ Quoting -----
-
The Microsoft Serial Mouse (or compatibles) is the device that is most
often used with the Serial Port of the PC; it's the one with the two
buttons. Mouse Systems compatible mice have three buttons. Here's some
information I received from Stephen Warner and Angelo Haritsis:
Pins Used:
  TxD, RTS and/or DTR are used as power sources for the mouse.
  RxD is used to receive data from the mouse.
Mouse reset:
  Set UART to 'broken line' state (set bit 6 of the LCR) and clear the bits
  0-1 of the MCR; wait a while and reverse the bits again.
Serial transmission parameters:
  Microsoft Mouse        1200 bps, 7 data bits, 1 stop bit, no parity
  Mouse Systems Mouse    1200 bps, 8 data bits, 1 stop bit, no parity
Data packet format of the Microsoft mouse:
  The data packet consists of 3 bytes. It is sent to the computer every time
  the mouse changes state (ie. the mouse is moved or the buttons are 
eleased/
  pressed).
              D6    D5    D4    D3    D2    D1    D0
  1st byte    1     LB    RB    Y7    Y6    X7    X6
  2nd byte    0     X5    X4    X3    X2    X1    X0
  3rd byte    0     Y5    Y4    Y3    Y2    Y1    Y0
  The byte marked with 1 is sent first and then the others. The bit D6 in the
  first byte is used for synchronizing the software to the mouse packets
  if it goes out of sync.
  LB is the state of the left  button (1 being the LB is pressed)
  RB is the state of the right button (1 being the RB is pressed)
  X0-7 movement of the mouse in the X direction since last packet (+ right)
  Y0-7 movement of the mouse in the Y direction since last packet (+ down )
  The Microsoft Mouse uses RTS as power source. Whenever RTS is set to '0'
  and reset to '1', the mouse performs an internal reset and sends the
  character 'M' to signal its presence. Three-button-mice send 'M3' if you
  drop and raise RTS (see above) in Microsoft mode; this is compatible
  with the Microsoft mouse driver and allows the firmware to check if it
  is really a three-button mouse.
                   [Scott David Daniels received this info from Brian Onn]
Data packet format of the Mouse Systems mouse:
  The data packet consists of 5 bytes.
              D7    D6    D5    D4    D3    D2    D1    D0
  1st byte    1     0     0     0     0     LB    MB    RB
  2nd byte    X7    X6    X5    X4    X3    X2    X1    X0
  3rd byte    Y7    Y6    Y5    Y4    Y3    Y2    Y1    Y0
  4th byte    equal to 2nd byte
  5th byte    equal to 3rd byte
  Bits 7-3 of the 1st byte are used for synchronization; it's rather
  improbable that they appear the same way in any of the other bytes.
  LB is the state of the left button (1 being the LB is pressed)
  MB is the state of the middle button (1 being the MB is pressed)
  RB is the state of the right button (1 being the RB is pressed)
  X0-7 movement of the mouse in the X direction since last packet (+ right)
  Y0-7 movement of the mouse in the Y direction since last packet (+ up   )
...
--- ifmail-tx (i386 Linux)
---------------
* Origin: 300 miles East of Seattle, WA (1:346/15.1)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.