Mouse Connector Pinouts
Location of Mouse (pointing device) connector.
The mouse port is always the PS/2 port FARTHEST from the power supply.
The PS/2 mouse port is IRQ 12 and I/O Port Addresses 60h and 64h.
Bus Mouse Problem!
PS/2 Appears to Hang When Exiting Windows 3.1x
The problem can be corrected by adding the following line to the [386Enh] section of SYSTEM.INI:
This prevents Windows from attempting to reinitialize the PS/2-style
mouse port prior to exiting to MS-DOS. This may cause problems when you
run some mouse-aware, MS-DOS-based applications after exiting Windows.
Mouse Connector Pinout
The keyboard connector is a 6-pin miniature DIN connectors. The signals and voltages are the same for both connectors.
The keyboard and auxiliary device signals are driven by open-collector drivers pulled to 5Vdc through a pull-up resistor.
Serial Mouse Conversion?
The "Serial Mouse" uses a RS-232 style interface with -5 to -12 VDC as logical "1" and +5 to +12 VDC as logical "0". The PS/2 mouse interface is a TTL-style interface, which uses 0 - +2 VDC as logical "0" and +3 - +5 VDC as logical "1".
In addition - and to make things worser - the RS-232 is an asynchronous interface, the PS/2 interface is a synchronous, where the data is sent along with a clock signal. It uses a simplified 4-wires serial interface with +5VDC (for the transceiver), GND, keyboard / mouse clock and keyboard / mouse data. The data and clock line can be used from the keyboard / mouse controller and the attached device as well following a particular handshake, which defines which is the active "sender" and which is the "receiver". So: it is not *that* easy conversing serial mouse to PS/2 and vice versa.
The "dual mode" mice have an automatic logic detection and sort of adaptive interface electronic, which detects whether the mouse is attached to a serial port or a PS/2 port and set the output drivers accordingly.
As you can see from the above: it is not enough only *physically* changing the plugs.
PS/2 Mouse Versions
From Fred Mau
Best as I can tell, IBM had five distinct species of Rattus
Armonkus in the PS/2 world: (Not to mention all the clones).
Best as I can tell, all the PS/2 mice (except the minnie
mouse for early thinkpads) are interchangeable, with one notable exception:
If you have an 8516 Touchscreen monitor, the touchscreen cable plugs into
the mouse port and the mouse plugs into the monitor, but it will ONLY work
with the original ugly mouse or the early oval mouse with white buttons.
From Jim Shorney:
Ed. I think he means THIS
From Carroll Bloyd
From David Doerr
PS/2 mouse to serial cable and back to PS/2 port
From Tim Clarke
PS/2 mouse to serial cable and back to PS/2 port Or Dumb KVM switches
Current Mouse Maker
Unicomp lists the IBM Two Button mouse. It has the brown buttons and the white body. I have a few of this specific model. Nice button switches, tracks well. At $7 it's a damn good bargain. Mine has a long cord (nice for use with 80/85/95 systems!)
96F9275 IBM Two Button mouse Regular $15 Sale $7
Serial, Bus, and PS/2
Would you describe how the three common types of mice work (serial,
bus, and PS/2 mouse port), how the mouse driver communicates with the mouse,
and how programs in turn talk to the mouse driver?
At the software level, bus mice, serial mice, and PS/2 mice are all the same. The mouse driver provides a common interface so that an application program can communicate with a mouse using identical sets of function callsregardless of its type.
At the hardware level, however, these mouse types are fundamentally different. The serial mouse works just like a communications device: It sends data to the serial port of your choice each time a mouse event takes place. (A mouse event is when a button is pressed or released or the mouse is moved.) A microprocessor inside the mouse transmits a packet of data any time it detects a change in state.
Typically, the mouse driver programs the serial port to interrupt the CPU when a byte of data is received at the port. It does this in the same way a communications program such as ProComm would.
If the mouse is stationary and no buttons are being activated, no CPU time is tied up tracking mouse actions.
Many serial mice use the 3-byte packet format standardized by Microsoft
to transmit information about mouse position and the state of the buttons
to the CPU. Figure I shows the format of the packet. Since
the Microsoft Serial Mouse transmits data at 1,200 bits per second using
I stop bit, 7 data bits, and no parity, bit 7 (the leftmost bit) in each
byte isn't used. Bit 6 is a clock bit that the mouse driver uses
to stay in sync with the mouse. In the first byte in the packet,
it's set to 1; in the second and third bytes, it's set to 0. Bits
4 and 5 indicate the current up/down states of the left and right mouse
buttons. A 0 indicates that the corresponding button is pressed,
while a I indicates that it's not. The remaining bits in the data
packet are combined to form two 8-bit numbers indicating the number of
mickeys the mouse has moved in the x (horizontal) and y (vertical) directions
since the last report. A mickey is the mouse unit of distance, equal
to approximately 0.005 inch. By recording mickeys, the mouse driver
can track the location of the mouse at all times.
Fig. 1 MICROSOFT SERIAL MOUSE DATA PACKET FORMAT
Each time a serial mouse is moved, it transmits a packet of data containing information about the mouse position and the state of the buttons to the CPU. This figure illustrates the 3-byte data packet format that is used by the Microsoft Serial Mouse and many other Microsoft-compatible Serial Mice.
RB Right button
Y7-Y0 8-bit Y-movement indicator (number of mickeys moved
in the horizontal direction since the last data transmission.
The mouse driver can determine the direction of the movement-up or down, right or left-from the sign of the mickey counts transmitted by the mouse, which are encoded in two's complement form (a common method for representing signed integers on computers). Using this representation, an 8-bit value can store any number from -128 to 127, inclusive. Thus, the mouse can move up to 127 units in either direction (about 0.62 inch) in the time it takes a,packet to be transmitted (about 20 milliseconds at 1,200 bps) without missing a beat. That provides enough latitude for you to move the mouse across the table rather quickly, without losing any information in the process. Some mice use higher data rates to increase resolution. Logitech's Series 9 Mouse, for example, operates at 2,400 bps, doubling the range that the mouse may travel between data transmissions.
Not all serial mice use Microsoft's 3-byte packet format. The three-button Mouse Systems Mouse, for example, transmits data in 5-byte packets. The added bits are used to transmit information about the third button (something that the Microsoft format does not support) and information about the mouse's current and last positions, which, among other things, can be used to determine mouse velocity.
How does the serial mouse get its power? It's not battery operated,
nor does it have to be plugged into an electrical outlet. Instead,
it draws power directly from the serial port through the RTS (request to
send) line. The Microsoft Serial Mouse uses five RS-232 lines: TD
(transmit data), RD (read data), DTR (data terminal ready), RTS ready
to send), and SG (signal ground). TD is used to transmit packets
of data. The driver asserts RTS when it is activated, to make sure
power is available to the mouse, and asserts DTR as a signal that it's
installed and ready to go. In current Microsoft Serial Mouse implementations,
RD is unused.
THE BUS MOUSE
The bus mouse interfacing scheme takes an entirely different approach to linking a mouse to a PC. Unlike the serial mouse, the bus mouse does not contain its own microprocessor. Instead, logic on the bus interface card is responsible for monitoring the mouse and notifying the mouse driver when the mouse is moved or a button is activated. In the most common implementation, the card is programmed to poll the mouse at regular intervals (typically every 1/30 to 1/60 second) and interrupt the CPU so that the mouse driver can read the current mouse status from registers on the card. Why these interrupt rates? Because 30 to 60 Hz roughly corresponds to the refresh rates of most displays. When the mouse pointer is being moved across the screen, there's usually no need to poll the mouse more frequently, because the screen can't be updated fast enough to show what's happening. difficult to paint a picture of how a " typical " bus mouse operates. Versions of the Microsoft Bus Mouse sold since 1986, for example, contain a custom chip called an InPort on the bus interface card. This chip tracks mouse events and-like the microprocessor in the serial mouse-interrupts the CPU only when the mouse is moved or a mouse button is pressed or released. This way, valuable CPU time isn't wasted reading registers on the interface card when the mouse is idle. And thanks to the InPort chip, the Microsoft Bus Mouse can be programmed for 30-, 50-, 100-, or 200-Hz operation. It's also possible to have the InPort chip interrupt the CPU at regular intervals regardless of whether there's anything new to report, or to forgo interrupts altogether and allow software to drive the mouse strictly by polling it. Using this scheme, the mouse driver (or a program driving the mouse directly) can track mouse position more precisely than programmed 30-to-200-Hz interrupt rates allow. Alternatively, it can tap into the vertical sync pulse generated by the video adapter each time a screen refresh is completed and take time out to read the mouse status during the vertical blanking interval.
A bus mouse does not send packets of data the way the serial mouse does. Instead, status is read directly from lines connecting the mouse to the bus interface card. For example, the Microsoft Bus Mouse uses the nine-pin Hosiden circular connector shown in Figure 2. Of the nine pins, three-SWI, SW2, and SW3-reflect the state of up to three mouse buttons in real time. XA, XB, YA, and YB carry quadrature signals that communicate the amount and direction of motion in the x and y directions to counter registers inside the InPort chip. In quadrature encoding, two lines are provided to track motion in a given direction. A pulse on one of the lines-for example, XA-indicates that the mouse has been moved. A pulse on XB, which arrives slightly out of phase with the pulse on XA, reveals the direction of the movement. If XA leads, then movement is positive; if the pulse on XB comes first, movement is in the negative direction. Values read from the InPort's counter registers are two's complement 8-bit numbers, so they, like the values transmitted by the serial mouse, may range from -128 to 127.
The remaining two pins on the connector serve equally important functions.
The bus mouse draws its power from the +5V pin, while the other pin goes
Fig. 2 MICROSOFT BUS MOUSE PINOUT
The Microsoft Bus Mouse uses a nine-pin circular connector to interface
with the bus interface card. SW1, SW2 and SW3 are used to sense the state
of the mouse buttons. XA, XB, YA and YB carry quadrature signals indicating
mouse movement and direction. The mouse draws power from the +5V
pin, while the remaining pin goes to ground.
SW2| SW3| | Signal
X = Denotes each pin.
THE PS/2 MOUSE
The PS/2 mouse is similar to the serial mouse in many respects. This mouse contains its own microprocessor that transmits clocked serial data to the keyboard controller inside the PS/2, just as the PS/2 keyboard does. The controller decodes the information coming in and the PS/2 BIOS makes it available to the mouse driver. Through the BIOS programming interface, the mouse sampling rate may be set to frequencies ranging from 10 to 200 Hz. Typically, the mouse driver will register itself with the BIOS, and the BIOS will activate a handler inside the driver each time a mouse-related event occurs.
One peculiarity of the PS/2 mouse is that the packet format it employs
does not include a clock bit as the Microsoft packet does. Furthermore,
because the same system board controller is used to decode data coming
from the mouse and the keyboard simultaneously, programs that use both
the mouse and keyboard on the PS/2 sometimes experience data-overman conditions
that cause the mouse driver to lose synchronicity with the mouse.
If there were a clock bit, timing could be reestablished and the overrun
condition could be defeated. Without the clock bit, application programmers
have been forced to resort to several ad hoc means of maintaining the integrity
It's no accident that you can replace the end adapter on a Microsoft
Serial Mouse and plug it into the mouse port of a PS/2. The PS/2
mouse port has six pins, one of which carries power to the mouse (see figure
2b). The Microsoft Serial Mouse looks at this line to determine what
type of port it's connected to and adjusts the format of the data it sends
out accordingly. If the line is asserted (carrying voltage), then
the mouse knows it's attached to a PS/2 port. If the line is not
asserted, the mouse concludes that it must be attached to a serial port.
Fig. 2b IBM PS/2 MOUSE PINOUT
Oops. In Peter's own words, "Wherever you got the PS/2 Mouse connector from: it is total bullshit."
I assumed the author knew enough to get it right.
See the real PS/2 Mouse Pinout (towards the top of the page)
This is the illustration from the original text. Not the "AC Commercial Power, Low-Battery Warning Signal" .
THE MOUSE PROGRAMMING INTERFACE Fortunately,programs don't have to interface with the mouse at the packet level; that's what mouse drivers are for. The mouse driver is the program you install before running an application that uses the mouse. The Microsoft mouse driver is called MOUSE.SYS or MOUSE.COM. (The only difference between the two is that MOUSE.SYS is installed with a DEVICE statement in CONFIG.SYS, while MOUSE.COM is installed from the command line or your AUTOEXEC.BAT file.) Microsoft and Nbcrosoft-compatible mouse drivers provide a set of 35 high-level function calls that applications can use to communicate with the mouse.
Fig. III - MOUSE DRIVER FUNCTION CALLS
Microsoft and Microsoft-compatible mouse drivers provide 35 different function calls (functions 17 & 18 are not assigned) that a program can use to communicate with the mouse. Collectively, these function calls make up the mouse programming interface.
For example, if a program wants to determine whether a mouse button is currently held down, all it has to do is make a call to function number 5, Get Button Press Information. The driver, which fields the interrupt generated when a mouse button is pressed or released, keeps track of the state of the buttons. In response to the program's request, the driver returns an integer whose value reflects the current button status. If the left button is depressed, bit 0 is set to 1; if the right button is depressed, bit 1 is set to 1. A value of 0 in either bit indicates that the corresponding button is not depressed.
Mouse driver functions are accessed through interrupt 33h. The following code sequence portrays what a typical call to the mouse driver looks like in assembly language:
In general, function codes are passed in register AX, and other parameters in BX, CX, and DX. This particular sequence calls function 5 to retrieve the status of the right mouse button (BX=l for the right button, BX=O for the left). On return, bit I of the BX register is tested and a branch is made if it's set to 0, indicating the button is not currently depressed.
We don't have the space here to explore each of the function calls in detail. For more information, refer to the Microsoft Mouse Programmer's Reference (1989, Microsoft Press), or to PC Magazine's July 21, 1987, Lab Notes column ("Mouse Software: See How They Run," page 41 1). However, there is one function that is so useful and so widely used by programmers that a discussion of the mouse programming interface couldn't be considered complete without it: function 12, Set Interrupt Subroutine Call Mask and Address.
Function 12 lets a program instruct the mouse driver to interrupt it asynchronously when the mouse is moved or a button is pressed or released. The program passes the mouse driver two objects: a call mask and a subroutine address. The call mask acts as an event filter. If the program isn't interested in mouse movements or button releases, the call mask can be set up so that the driver interrupts the program only when a button press occurs. The subroutine address is a 32-bit pointer to the subroutine that the program will use to process calls from the mouse driver. By registering itself with the mouse driver this way, a program doesn't have to constantly poll the mouse driver to see what's going on. When something happens, the program is automatically notified and given a chance to act on the event.