[comp.sys.ibm.pc] Game port

fargo@pawl.rpi.edu (Ethan M. Young) (02/16/89)

Could someone send me information on how to acces a joystick attached to a
game port on an AT?

My technical reference manual makes a slight (one paragraph) mention of input-
ting from a joystick, but leaves it at that with no description of what inter-
rupts need be called, what ports need be read, etc.

Thank you and happy hunting!   Internet: fargo@pawl.rpi.edu
    ____    [> SB <]                     fargo@{paraguay|uruguay}.acm.rpi.edu
   /__      -=>??<=-        Bitnet (??): usergac0@rpitsmts.bitnet
  /   ARGO : 3000 years of regression from the year 4990

everett@hpcvlx.HP.COM (Everett Kaser) (02/22/89)

Here's something I posted to a similar request some time ago:


The IBM Game Control Adapter (adapted from the IBM PC XT Tech Ref Manual).

The game port is controlled/accessed through a single I/O location located at
hex 0x201.  The hardware, simplified, consists of four 555-type timers set up
in one-shot mode, with the length, or duration, of the one-shot pulse controll-
ed by the current value/position of the potentiometers in the joysticks (one
timer is controlled by each of four potentiometers, two potentiometers per
joystick, one each for x and y directions).  Additionally, there are four
"digital" inputs, pulled high (+5) by pull-up resistors on the game card, that
are usually connected to normally-open switches that, when pressed or closed,
ground those input lines.  The normal way these are hooked up is two joysticks
with two buttons per joystick, thus accounting for all of the inputs.

The program should do an output to 0x201 (of any value, doesn't matter), which
will trigger the one-shots, causing the inputs from them (reading 0x201, the
four least significant bits) to go high for a varying amount of time (the amount
of time is controlled, of course, by the current setting of the potentiometers).
When reading 0x201, the bits are:

       Bit
        0   joystick A x-coordinate timer
        1   joystick A y-coordinate timer
        2   joystick B x-coordinate timer
        3   joystick B y-coordinate timer
        4   joystick A button 1
        5   joystick A button 2
        6   joystick B button 1
        7   joystick B button 2

"The user must first begin the conversation by an Out to address hex 201.  An
In from address hex 201 will show the digital pulse go high and remain high
for the duration according to the resistance value.  All four bits (3-0)
function in the same manner;  their digital pulse will all go high simultan-
eously and will reset independently according to the input resistance value."

"These buttons default to an open state and are read as 1.  When a button
is pressed, it is read as 0.  Software should be aware that these buttons
are not debounced in hardware."

Everett Kaser
!hplabs!hp-pcd!everett
everett%hpcvlx@hplabs.hp.com