home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / ibm / pc / hardware / 34585 < prev    next >
Encoding:
Text File  |  1993-01-02  |  2.5 KB  |  51 lines

  1. Newsgroups: comp.sys.ibm.pc.hardware
  2. 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
  3. From: v923137@vms.ucc.okstate.edu
  4. Subject: Re: [Q] How do Game Ports Work?
  5. Message-ID: <1993Jan1.231920.1@vms.ucc.okstate.edu>
  6. Lines: 38
  7. Sender: news@osuunx.ucc.okstate.edu (USENET News System)
  8. Nntp-Posting-Host: vms.ucc.okstate.edu
  9. Organization: Oklahoma State University Computer Center
  10. References: <1i2lnqINNso8@faatcrl.Faa.Gov>
  11. Date: Sat, 2 Jan 1993 05:19:20 GMT
  12.  
  13. In article <1i2lnqINNso8@faatcrl.Faa.Gov>, warb@tgf.tc.faa.gov (Dan Warburton) writes:
  14. > Q1. Can you have more than one Game port enabled?
  15. >     I have one on the Seril/Par Board and one on a PAS16 board.
  16.  
  17. A1.   Yes. The IBM can support up to two joysticks on ONE 15-pin port.
  18.       I am not sure about using two joysticks on two ports, as you are
  19.       suggesting, however, I'm sure it is quite possible.
  20.  
  21. > Q2. How do the games know when a button is pushed? Interrupt, polling
  22. >     something else.
  23.  
  24. A2.   I have done some programming on 286/386 machines using assembly 
  25.       language to read joystick ports.  I was not interested in whether
  26.       the button(s) were pushed, but only about the values of the pot. lines.
  27.       The standard game port works by the program issuing an interrupt, at
  28.       which  time the port is scanned, and the values of all potentiometers
  29.       and buttons are loaded into a buffer.  Then you read that buffer at your
  30.       (the program's) leisure to find the position of the stick/buttons.
  31.       This way you do not have to immediately process the joystick data and
  32.       run the risk of the joystick moving while you are reading one axis, and
  33.       the other axis changing before you get to it.  You should be able
  34.       to find good technical information about this subject in any good
  35.       assembly programming book, or a "programmer's problem solver" book for
  36.       the PC.
  37.  
  38. BTW, I was using the joystick port to read an external voltage which was
  39. being generated by a DC slave motor, which was in turn being driven by a
  40. powered DC motor.  I had a variable load across the slave motor, and drove
  41. the base of a transistor with the voltage from the slave motor.  I had the
  42. joystick pins tied across the C and E of the transistor to provide a variable
  43. resistance for the card to read.  Using this setup, I was able to determine
  44. the power output of the test (driven) motor, by reading directly the voltage
  45. and current produced by the slave motor (using a known load on slave motor).
  46.  
  47. Hope this helps-
  48. Jason Worley
  49.  
  50.