Back to Technical Index

PC joystick port

Most PCs have a Gameport. Sometimes it is located on-board, some have extra controller cards, mot often it is part of the Sound card.
It might be interesting to know how this port functions, so you can build your own adapters etc.

Technical basics

The connector on the PC is a 15-pin-D-Sub-female, the Connector at the Joystick is a 15-pin-D-Sub-male.
2Button 1
3Axis 1 (Joystick 1-X)
6Axis 2 (Joystick 1-Y)
7Button 2
10Button 3
11Axis 3 (Joystick 2-X)
13Axis 4 (Joystick 2-Y)
14Button 4
The Hardwarebook states that pin 10 is for button 4 and pin 14 for button 3 - this is a mistake.
So basically the port has 4 axis and 4 buttons.
You can connect two joysticks to the port (with an adapter). Then each Joystick gets two axis and two buttons (axis 3 and 4 plus button 3 and 4 are mapped to second player axis 1 and 2 plus button 3 and 4). So when you play with 2 players, no player has more than 2 buttons.
If only one joystick is connected it can use all 4 axis and buttons. Normally the first axis is used for x-movement and the second for y-movement. The third axis can be used for throttle, steering wheel or something.

The electrics

When a button is pressed, the corresponding wire gets connected to GND.
The axis are analog values. They are represented by the resistor value between P5V and the corresponding pin (e.g. 3 for x-axis). If the resistor value is unlimited (no connection at all) the joystick is regarded as not connected. A resistor value of 0 (full contact) is considered to be completely left (or up), a resistor value of about 100 kOhm is considered to be completely right (or down). Any value in between is considered to be a partial push into the direction.
If the joystick is centered, the resistor value should be about 50 kOhm.
Digital gamepads don't produce the values in between, they only deliver 0, 50 or 100 kOhm.
Basically you can build your own Joystick with two resistors (better variable resitors) and some switches. I linked a page with some more information about this.


Of course, whenever there is a standard, there are people modifying it for their purposes. I won't talk about the joysticks that have an additional USB or Serial connection. I only want to look at joysticks using the standard 15 pins, here.