home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / telecomm / bbs / tbeck.lha / JoyTest.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-02-06  |  2.2 KB  |  42 lines

  1. /*  JoyTest.rexx - Weird ide By Thomas Beck - Optimized by PMK - FREEWARE  8)
  2.    No docs, just a test prg. for ya' joystick(s), run as arexx door from CNET!
  3. ===============================================================================*/
  4. options results;signal on error;signal on syntax;signal on ioerr
  5.  
  6. transmit "f1    JOYTESTn1    .-----.n1    |     |n1    |     |n1    |     |n1    `-----'n1 Press any keyn1    to quit"
  7.  
  8. do forever
  9.    a=joy(1)
  10.    select
  11.       when a=0 then sendstring  "f0n2>5     n1>5     n1>5     "
  12.       when a=8 then sendstring  "f0n2>5  |  n1>5     n1>5     "
  13.       when a=2 then sendstring  "f0n2>5     n1>5     n1>5  |  "
  14.       when a=4 then sendstring  "f0n2>5     n1>5-    n1>5     "
  15.       when a=6 then sendstring  "f0n2>5     n1>5    -n1>5     "
  16.       when a=7 then sendstring  "f0n2>5\    n1>5     n1>5     "
  17.       when a=9 then sendstring  "f0n2>5    /n1>5     n1>5     "
  18.       when a=1 then sendstring  "f0n2>5     n1>5     n1>5/    "
  19.       when a=3 then sendstring  "f0n2>5     n1>5     n1>5    \"
  20.       when a=10 then sendstring "f0n2>5     n1>5  *  n1>5     "
  21.       when a=18 then sendstring "f0n2>5  |  n1>5  *  n1>5     "
  22.       when a=12 then sendstring "f0n2>5     n1>5  *  n1>5  |  "
  23.       when a=14 then sendstring "f0n2>5     n1>5- *  n1>5     "
  24.       when a=16 then sendstring "f0n2>5     n1>5  * -n1>5     "
  25.       when a=17 then sendstring "f0n2>5\    n1>5  *  n1>5     "
  26.       when a=19 then sendstring "f0n2>5    /n1>5  *  n1>5     "
  27.       when a=11 then sendstring "f0n2>5     n1>5  *  n1>5/    "
  28.       when a=13 then sendstring "f0n2>5     n1>5  *  n1>5    \"
  29.    end
  30.    maygetchar;if result~='NOCHAR' then do;transmit "f1";exit;end
  31. end
  32.  
  33. /* JOY - Check JoyStick & fire button
  34.    usage:   a=joy(<joynum>)   0=Port1.   1=Port2.
  35.    returns: keypad values for directions, 0 if none,  +10 if fire pressed */
  36.  
  37. JOY: procedure;arg w;a=import(d2c(14675978+w*2,4),2);b=~bittst(import('00BF E001'x,1),6+w)*10
  38. return x2d(translate(c2x(b2c(bittst(a,8)bittst(a,9)bittst(a,0)bittst(a,1))),'963147','B31EC4'))+b
  39.  
  40. SYNTAX:;ERROR:;IOERR:
  41. transmit 'Error Code 'rc' ('errortext(rc)') in line 'sigl;bufferflush;exit
  42.