home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / PASCAL / PARADIS1 / JOYSTIC2.PAS < prev    next >
Pascal/Delphi Source File  |  1992-04-08  |  2KB  |  59 lines

  1. (4683)  Sat 4 Apr 92 17:33
  2. By: Matt Schuttloffel
  3. To: Gavin Campbell
  4. Re: Joystick
  5. St:
  6. ---------------------------------------------------------------------------
  7. @EID:e493 18848c20
  8. @PID: FasToss .9b
  9. @MSGID: 1:170/806 2f918193
  10. @REPLY: 1:250/801.0 29d97bd6
  11.  >   How would someone read from a joystick.  Anyone have
  12.  > any ideas.  Is it
  13.  > like a mouse ore different.  Does anyone have any
  14.  > units or can anyone
  15.  > help?
  16.  
  17. program JoyDem1;  { Demo to use Joystick and Game Control Adapter }
  18.                   { with Turbo Pascal 4.0 unit JoyStk }
  19.                   { John Haluska, CIS 74000,1106 }
  20. uses Crt,JoyStk;
  21.  
  22. var  X0,Y0,X1,Y1             : integer;    {X and Y stick 0 and 1 position}
  23.      But11,But21,But12,But22 : boolean;    {Fire buttons}
  24.  
  25. begin
  26.   if not JoystkPresent then
  27.     begin
  28.       Writeln('Game Adapter not present in this computer.  Exit program.');
  29.       Exit;
  30.     end;
  31.   ClrScr;
  32.   GotoXY(20,7);  Write('        Joystick  Test  Program     ');
  33.   GotoXY(20,9); Write('    Joystick 1            Joystick 2');
  34.   GotoXY(20,10);Write('Direction  Button     Direction  Button ');
  35.   GotoXY(20,11);Write('  X   Y     1  2        X   Y     1  2 ');
  36.   GotoXY(20,15); Write('     Press any key to end program      ');
  37.   GotoXY(7,17); Write('Port 201h bit');
  38.                 Write('  0   1     4  5        2   3     6  7');
  39.   GotoXY(7,19); Write('If joystick direction = 0, joystick pot ');
  40.                 Write('is disconnected or open.');
  41.   GotoXY(7,21); Write('Button output = "1" if switch contact closed.');
  42.   repeat
  43.     JoyStkPos(0,X0,Y0);        {bit 0,1}
  44.     JoyStkPos(1,X1,Y1);        {bit 2,3}
  45.     GotoXY(21,13);
  46.     Write(X0:3,' ',Y0:3,'    ',Ord(JoyStkBtn(BtnA1)),'  ');
  47.     Write(Ord(JoyStkBtn(BtnA2)),'       ');
  48.     Write(X1:3,'  ',Y1:3,'   ',Ord(JoyStkBtn(BtnB1)),'  ');
  49.     Write(Ord(JoyStkBtn(BtnB2)));
  50.   until KeyPressed;
  51.   ClrScr;
  52. end.
  53.  
  54. --- FOFasToss 0.90/beta
  55.  * Origin: Total Force BBS = 250-3018 = 213megs, 14.4k (1:170/806@fidonet)
  56.  
  57. @PATH: 170/806 800 400 396/1 13/13 1/217 105/27 42 500/1 9 512/0 
  58. @PATH: 512/1007 
  59.