Spotlight › Hardware
The joystick driver
The PC’s game port now has one driver that every program shares. You calibrate the stick once in the Control Panel, and each game that reads it gets the same corrected position.
- One reading on the XT
- About 2 ms
- Memory while loaded
- About 11KB
- Programs that read it
- 6
01 / What it is
What it is
IBM’s Game Control Adapter of 1981 put a 15-pin socket on the back of the PC for joysticks and paddles. Later sound cards and multi-I/O cards copied it, so most PCs of the period have one. A stick on that port is analog: each axis is a variable resistor, and the card reports a position as a length of time. A program starts a timer on the card, then counts how long each axis takes to settle. A stick pushed one way settles quickly, and pushed the other way it takes longer, up to about a thousandth of a second.
Until this release no os8088 program read the port. Each game would have had to time the axes itself, guess where the centre is, and ask the player to calibrate in its own way. JOYSTICK.DRV does that once for everyone. It times the axes, turns the counts into a position from -127 to +127 on each axis, and applies the calibration and dead zone you set on its Control Panel page. A program asks the driver for the position and the buttons, and never touches the port.
One port carries two sticks, through a Y-cable or a card with two sockets. The driver reads a 2-button or 4-button stick, two sticks, a flight stick with a throttle and rudder, and the hat switch of a CH FlightStick Pro or ThrustMaster FCS.
02 / On the screen
On the screen
03 / How it works
How it works
A reading switches interrupts off, starts the card’s timers and the PC’s own clock together, and watches the port until every axis the controller uses has settled, or 2.3 thousandths of a second have passed. The clock is read again only between short runs of port reads, so the moment an axis settles is seen within a few millionths of a second. An axis with nothing plugged into it is dropped from the next readings, so a missing second stick costs nothing. On the 4.77 MHz XT a whole reading takes between 1.1 and 2.2 thousandths of a second, and the page shows that time as it runs.
Calibration takes three steps: the stick to the upper left, then to the lower right, then let go to the centre, pressing a button at each. The driver keeps the counts it saw and works out each axis from them, with a dead zone around the centre so a stick at rest reads 0. Before you calibrate, it uses the first reading as the centre, so a stick already works on the first day. The settings are kept on the system disk and come back at the next start.
Buttons are counted as presses as well as read as held. A tap that falls between two of a game’s readings is still reported once, the way OS/2’s game port driver did it.
The driver loads only when a stick answers at start-up or you tick it, and takes about 11KB while it is loaded. The kernel itself grew by a few dozen bytes for it.
04 / Who reads it
Who reads it
WireBall and Arkanoid
The paddle goes where the stick points, as with a real paddle controller.
1942 and ARCADE
The stick steers in eight directions in 1942 and works as the cabinet’s stick in ARCADE. In 1942, button 1 fires.
The C64 and Apple II emulators
Built to pass the stick to their games, as the C64’s control ports and the Apple II’s paddles. This has not yet been tried with a stick on the emulated machine.
Every one of them
Keeps its keys. A stick adds a way to play; it never takes the keyboard away.
05 / What it does not do
What it does not do
Other programs do not see it as keys. A game that was not written for the driver does not move with the stick. Turning the stick into arrow keys for every program needs room in the resident system, and has not been decided.
DOS and Windows programs read the port themselves. They already do so on real hardware. The driver does not answer the AT BIOS joystick call or the Windows 3.1 joystick functions.
Not on every disk. The driver is on the 720KB, 1.2MB and 1.44MB system disks and the 286 system disks. The 360KB system disk had no room for it; copy JOYSTICK.DRV into its SYSTEM folder from another disk. The emulator disk and the 128KB system have no joystick, since the emulators they target have no game port.
06 / Set it up
Set up a joystick
Plug the stick into the game port and boot a 720KB, 1.2MB or 1.44MB system disk. The driver loads by itself when the stick answers.
If it did not, open Control Panel from the menu at the left of the menu bar, open Drivers, tick Joystick and press Load.
Open the Joystick page, pick the controller type, and press Calibrate. Follow the three steps, pressing a stick button at each corner and at the centre.
Close the panel to save, then start WireBall, Arkanoid, 1942 or ARCADE and play with the stick.