home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / documentation / documents / a252joy < prev    next >
Internet Message Format  |  1999-04-27  |  6KB

  1. From: jbye@acorn.co.uk (James)
  2. Date: 14 Jul 92 07:33:50 GMT
  3.  
  4.  
  5. SWI Interface for Joystick Devices
  6. ----------------------------------
  7.  
  8. The Joystick module provides a SWI interface for reading the state of a
  9. joystick.  When the module  initialises, it tests for the existence of
  10. built-in joystick hardware and if it does not find any then it will not 
  11. initialise.  Third parties can replace this module to provide support for
  12. different hardware.  It is  recommended that any such modules have version
  13. numbers greater than 2.00 so that Acorn can upgrade its  own module without
  14. preventing its replacement.       
  15.  
  16.  
  17. SWI  Joystick_Read (SWI &43F40)
  18. -------------------------------
  19.  
  20. Returns the state of a joystick.
  21.  
  22. On entry:               R0 = joystick number
  23.  
  24. On exit:                R0 = joystick state
  25.  
  26. Interrupts:             Interrupt status is not altered
  27.  
  28. Processor mode:         Processor is in SVC mode
  29.  
  30. Re-entrancy:            Not defined
  31.  
  32. Use:                    This SWI is used to obtain the state of the requested
  33.                         joystick.  The state is returned in the following
  34.                         format:
  35.  
  36.                         Byte 0:         signed Y value (range -127 to 127)
  37.                                         -64, 0 or 64 for single switch joystick
  38.                                         (corresponds to Down, Rest, Up).
  39.  
  40.                         Byte 1:         signed X value (range -127 to 127)
  41.                                         -64, 0 or 64 for single switch joystick
  42.                                         (corresponds to Left, Rest, Right).
  43.  
  44.                         Byte 2:         Switches (e.g. fire buttons) starting in
  45.                                         bit 0, unimplemented switches return 0.
  46.  
  47.                         Byte 3:  Reserved.
  48.  
  49. Note that this format allows both digital and analogue devices to be
  50. supported.  Applications which are only  interested in state (up, down,
  51. left, right) should not simply test the bytes for positive, negative or
  52. zero.  It is  recommended that the 'at rest' state should span a middle
  53. range, say from -32 to 32 since analogue joysticks  cannot be relied upon to
  54. produce 0 when at rest.
  55.  
  56.  
  57.  
  58. From: s001532@kowande.bu.oz.au (Jeremy Lee)
  59. Subject: $10 DIY Joystick interface
  60. Date: 9 Sep 91 03:40:38 GMT
  61.  
  62. I had this idea a while ago. The Arc lacks a joystick port and nobody
  63. wants to fork out #100 for a joystick podule, so how about this alternative.
  64. It is based on the belief that you don't print while you play games.
  65.  
  66.  
  67.              Joystick 1           Joystick 2
  68.  
  69.          com F1 2 3 U D L R   com F1 2 3 U D L R
  70.           o   o o o o o o o    o   o o o o o o o
  71.           |   | | | | | | +----+---+-+-+-+-+-+-*
  72.           |   | | | | | +------+---+-+-+-+-+-* |
  73.           |   | | | | +--------+---+-+-+-+-* | |
  74.           |   | | | +----------+---+-+-+-* | | |
  75.           |   | | +------------+---+-+-* | | | |
  76.           |   | +--------------+---+-* | | | | |
  77.           |   +----------------+---* | | | | | |
  78.           |      NOT           |   | | | | | | |
  79.           | +----o<|---*-----*-+-+ | | | | | | |
  80.           | |                | | | | | | | | | |
  81.           ---                --- | | | | | | | |
  82.        AND| |             AND| | | | | | | | | |
  83.           \ /                \ / | | | | | | | |
  84.            T                  T  | | | | | | | |
  85.            +------------------*  | | | | | | | |
  86.                               |  | | | | | | | |    * Join
  87.                               |  | | | | | | | |
  88.                               |  | | | | | | | |    + Cross
  89.                           +---+  | | | | | | | |
  90.                           |      | | | | | | | |
  91.                           o      o o o o o o o o
  92.                         *rdy    D7 6 5 4 3 2 1 0
  93.  
  94.                              Printer Port
  95.  
  96. Or, for the REAL pennypincher :
  97.  
  98.                       Joystick
  99.  
  100.                  com F1 2 3 U D L R
  101.                   o   o o o o o o o
  102.                   |   | | | | | | |
  103.                   |   | | | | | | |
  104.                   o   o o o o o o o
  105.                 *rdy D6 5 4 3 2 1 0
  106.  
  107.                     Printer Port
  108.  
  109. Both are compatible (except that it you try to use the single joystick
  110. version with software that wants two, then the computer will think that both
  111. joysticks are doing the same thang!
  112.  
  113.  
  114. Software works like this. D7 chooses which joystick through the gates.
  115. The program then strobes D0-D6 and looks at the *rdy line. If it is "on" then
  116. the signal got through and the switch obviously is closed. (It of course, has
  117. to strobe each switch seperatly, and for each joystick.)
  118.  
  119. The design here allows for a standard eight-direction joystick and up to three
  120. fire buttons. A little clever sofware and you're away (anyone want to write it,
  121. or build it for that matter?)
  122.  
  123. The only restriction is that it has to use bog-standard switches as the
  124. computer sends the signals back to other way. Rapid-fire joysticks
  125. probably won't work (in rapid fire mode) nor will any devices that directly
  126. drive the pins. (trackballs & extra mice are right out. So are other DIY
  127. sensor projects that you see in a lot of Mags.)
  128.  
  129. But, It's cheap and easy to just zap them space invaders.
  130.  
  131.  
  132. ***********************************************************************
  133. *   /|  Jeremy Lee s001532@sand.sics.bu.oz.au      I'm Baaaack!...    *
  134. *  /_|             "Then again, I might just be Insane"               *
  135. * /  | "I'm an academic kleptomaniac. I just keep picking things up!" *
  136. ***********************************************************************
  137.  
  138.  
  139.