home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / JOYGA.ZIP / JOYDEM1.PAS next >
Encoding:
Pascal/Delphi Source File  |  1988-02-13  |  1.4 KB  |  37 lines

  1. program JoyDem1;  { Demo to use Joystick and Game Control Adapter }
  2.                   { with Turbo Pascal 4.0 unit JoyStk }
  3.                   { John Haluska, CIS 74000,1106 }
  4. uses Crt,JoyStk;
  5.  
  6. var  X0,Y0,X1,Y1             : integer;    {X and Y stick 0 and 1 position}
  7.      But11,But21,But12,But22 : boolean;    {Fire buttons}
  8.  
  9. begin
  10.   if not JoystkPresent then
  11.     begin
  12.       Writeln('Game Adapter not present in this computer.  Exit program.');
  13.       Exit;
  14.     end;
  15.   ClrScr;
  16.   GotoXY(20,7);  Write('        Joystick  Test  Program     ');
  17.   GotoXY(20,9); Write('    Joystick 1            Joystick 2');
  18.   GotoXY(20,10);Write('Direction  Button     Direction  Button ');
  19.   GotoXY(20,11);Write('  X   Y     1  2        X   Y     1  2 ');
  20.   GotoXY(20,15); Write('     Press any key to end program      ');
  21.   GotoXY(7,17); Write('Port 201h bit');
  22.                 Write('  0   1     4  5        2   3     6  7');
  23.   GotoXY(7,19); Write('If joystick direction = 0, joystick pot ');
  24.                 Write('is disconnected or open.');
  25.   GotoXY(7,21); Write('Button output = "1" if switch contact closed.');
  26.   repeat
  27.     JoyStkPos(0,X0,Y0);        {bit 0,1}
  28.     JoyStkPos(1,X1,Y1);        {bit 2,3}
  29.     GotoXY(21,13);
  30.     Write(X0:3,' ',Y0:3,'    ',Ord(JoyStkBtn(BtnA1)),'  ');
  31.     Write(Ord(JoyStkBtn(BtnA2)),'       ');
  32.     Write(X1:3,'  ',Y1:3,'   ',Ord(JoyStkBtn(BtnB1)),'  ');
  33.     Write(Ord(JoyStkBtn(BtnB2)));
  34.   until KeyPressed;
  35.   ClrScr;
  36. end.
  37.