home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.ibm.pc.hardware
- Path: sparky!uunet!noc.near.net!news.Brown.EDU!qt.cs.utexas.edu!cs.utexas.edu!convex!constellation!osuunx.ucc.okstate.edu!vms.ucc.okstate.edu!v923137
- From: v923137@vms.ucc.okstate.edu
- Subject: Re: [Q] How do Game Ports Work?
- Message-ID: <1993Jan1.231920.1@vms.ucc.okstate.edu>
- Lines: 38
- Sender: news@osuunx.ucc.okstate.edu (USENET News System)
- Nntp-Posting-Host: vms.ucc.okstate.edu
- Organization: Oklahoma State University Computer Center
- References: <1i2lnqINNso8@faatcrl.Faa.Gov>
- Date: Sat, 2 Jan 1993 05:19:20 GMT
-
- In article <1i2lnqINNso8@faatcrl.Faa.Gov>, warb@tgf.tc.faa.gov (Dan Warburton) writes:
- > Q1. Can you have more than one Game port enabled?
- > I have one on the Seril/Par Board and one on a PAS16 board.
-
- A1. Yes. The IBM can support up to two joysticks on ONE 15-pin port.
- I am not sure about using two joysticks on two ports, as you are
- suggesting, however, I'm sure it is quite possible.
-
- >
- > Q2. How do the games know when a button is pushed? Interrupt, polling
- > something else.
-
- A2. I have done some programming on 286/386 machines using assembly
- language to read joystick ports. I was not interested in whether
- the button(s) were pushed, but only about the values of the pot. lines.
- The standard game port works by the program issuing an interrupt, at
- which time the port is scanned, and the values of all potentiometers
- and buttons are loaded into a buffer. Then you read that buffer at your
- (the program's) leisure to find the position of the stick/buttons.
- This way you do not have to immediately process the joystick data and
- run the risk of the joystick moving while you are reading one axis, and
- the other axis changing before you get to it. You should be able
- to find good technical information about this subject in any good
- assembly programming book, or a "programmer's problem solver" book for
- the PC.
-
- BTW, I was using the joystick port to read an external voltage which was
- being generated by a DC slave motor, which was in turn being driven by a
- powered DC motor. I had a variable load across the slave motor, and drove
- the base of a transistor with the voltage from the slave motor. I had the
- joystick pins tied across the C and E of the transistor to provide a variable
- resistance for the card to read. Using this setup, I was able to determine
- the power output of the test (driven) motor, by reading directly the voltage
- and current produced by the slave motor (using a known load on slave motor).
-
- Hope this helps-
- Jason Worley
-
-