% Part II:
<snip>
% Continued in next post. . .
Part III:
---------------------------------------------------------------
Subject: Re: How does a joystick card work?
Date: 1996/09/21
Newsgroups: comp.sys.ibm.pc.games.flight-sim
David,
Not too dazzling, but:
The short version.
Each game has a joystick routine written by the programmer of that game.
The joystick routine sends random data to port 201h (that's an address inside
the PC).
The random data basically wakes the game card up and alerts it that the
joystick routine in the game is coming its way to take a reading.
The game port resets and gets ready to be read by the joystick routine.
Caps on the game card will trigger a signal either high or low for:
4 analog inputs:
Joystick 1 - X1 - Roll axis
Joystick 1 - Y1 - Pitch axis
Joystick 2 - X2 - Rudder pedals (ALL RUDDER PEDALS no matter who makes
them or if they are operated by your feet, by twisting a joystick handle
or on the joystick base itself - they all operate thru this analog input
on the game card)
Joystick 2 - Y2 - Analog throttles - YES ALL OF THEM - little throttle
wheely things, big throttles, slider throttles, etc. As long as they are
in analog mode they operate thru this analog input on the game card. The
ThrustMaster hat switch can operate thru here as analog hat instead if the
throttle is being used as a digital (thru the keyboard line not the game
port) instead in which case the computer is being fooled into thinking
that this analog input is really 5 inputs).
4 button inputs:
Joystick 1 - button 1 (all triggers but wouldn't have to be)
Joystick 1 - button 2
Joystick 2 - button 1 (aka button 3)
Joystick 2 - button 2 (aka button 4)
The joystick routine starts a counter and reads the state of the pulse
on the above eight inputs at port 201 (there are no more inputs on port
201 so you cannot have another throttle input, analog toe brakes on
your rudders, etc, etc, etc. here - this is a limitation of the original
design of the PC not anyones fault - it was just one of them "who'd
ever need any more than that" things that PCs are so subject to.
Each time it 'loops back' and reads the pulse it increments the counter
for each of the inputs.
The time it takes for the signal for each of the 4 joystick axes inputs to
change from a high state to a low state (or vice versa) tells the joystick
routine at what position the handle of the joystick (throttle or rudders)
is being held at by the user (this happens in microseconds so human movements
can all be tracked by the pc and the joystick routine and game card).
The joystick routine takes the number of counts and converts them to stick
position info (the 4 buttons btw are simply on or off, no need to time them)
and uses this information within its program to move the aircraft, the car,
or whatever you are controlling the movement of.
What can go wrong:
1. The joystick routine is written on say, a 486/66 - by the time the game
gets on the market and is wildly popular the typical pc is a 486/100 or a
Pentium 75, etc. The 486/100 and Pentiums run far faster than the 486/66
so the number of loop counts the joystick routine sees is way higher than
the counter was designed for so the routine counts itself into oblivion and
fails to see the stick, or misinterprets the position information, etc, etc.
i.e. Routine written on a 486/66 typically sees loop counts of 400 to 500
so the counter is a three digit one made to count up to 999 and then start
over again at 001. Game is installed on a Pentium 75 and the joystick
routine runs and the counts come out in the thousands, i.e. 1500. The
counter here will read like 500 to the joystick routine in the game since
it can only accomodate up to 999 and the routine misinterprets the position
information. Worse, I've seen routines where they have a provision that
if they see numbers above or below the range they expect to see they simply
ignore the stick input as though not joystick is attached. Others will
interpret the stick to be in the upper left corner (the low end of both
positioning pots.)
Having a joystick routine count itself into oblivion is not a rare thing
in joystick routines - I've seen more than a few. Many of the game programmers
are extremely good at writing joystick code as well as graphics, etc. Others
do not seem to understand the whole gameport/joystick routine process.
2. Heat from the computer builds up over time and causes the number of
loop counts to vary significantly so the joystick requires recalibration
every so often to get the nubers back in line. The ACM card is designed
to eliminate this completely (the mil spec components in it allows a
drift of only +/-1% the typical game port uses 20% tolerance components.)
Too bad too, it doesn't require much to have the joystick routine adjust
itself to the speed of the processor in the machine (that info is available
to the programmer in a memory location in each computer and it can be
easily read by his program).
3. The game port has a one shot that resets too slowly so the joystick
routine triggers port 201 that it is about to be read and then immmediately
attempts to read it before the one shot on the game port has had time to
reset itself and the joystick routine gets a bad reading - and it can interpret
this many ways - no joystick there, joystick in upper left, or lower right,
or anywhere else but where it really is or jittering, etc, etc.
Let me emphasize that ALL OF THE ABOVE can be cured by a properly executed
joystick routine in the game with the possible exception of the heat drifting.
But, what with things being as they are - it's not likely that everyone is
going to write a 'proper' joystick routine and it's not even the programmers
fault, necessarily. His routine can encounter situations in a different
computer setup that will not work properly with that routine when it worked
perfectly fine in his. There are way too many varieties of computer systems
out there to be able to make this just a simple - "it's the joystick
routine's fault." or "it's the game ports fault" It's quite likely a
combination of a lot of things in that particular end users compute system.
Now, aren't you glad I gave you the SHORT version. 8) The long version is
likely why how joystick really work on a compute is one of the most
misunderstood things there is. And why the joystick so often gets blamed
when it has the least to do with it.
The joystick is wires, potentiometers (two, three or four) and buttons (two,
three or four) (THESE ARE GAME PORT inputs - the multi-button programmable
joystick buttons and hats work on the keyboard line so don't relate to this
discussion at all) and that's all.
The game card has a lot of electronic circuits and components on it.
The joystick routine is the thing that controls the whole process - the
starting and reading of the game card and the interpretation of what it
sees on the game port.
Buzz Hoffman
ThrustMaster, Inc.
_________________________________________________________________
Okay, folks that's all from the archives. . .
--
**************************** Michael E. Carver *************************
Upside out, or inside down...False alarm the only game in town.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=<[ /./. [- < ]>=-=-=-=-=-=-=-=-=-=-=-=-=-=