home *** CD-ROM | disk | FTP | other *** search
- program JoyDem1; { Demo to use Joystick and Game Control Adapter }
- { with Turbo Pascal 4.0 unit JoyStk }
- { John Haluska, CIS 74000,1106 }
- uses Crt,JoyStk;
-
- var X0,Y0,X1,Y1 : integer; {X and Y stick 0 and 1 position}
- But11,But21,But12,But22 : boolean; {Fire buttons}
-
- begin
- if not JoystkPresent then
- begin
- Writeln('Game Adapter not present in this computer. Exit program.');
- Exit;
- end;
- ClrScr;
- GotoXY(20,7); Write(' Joystick Test Program ');
- GotoXY(20,9); Write(' Joystick 1 Joystick 2');
- GotoXY(20,10);Write('Direction Button Direction Button ');
- GotoXY(20,11);Write(' X Y 1 2 X Y 1 2 ');
- GotoXY(20,15); Write(' Press any key to end program ');
- GotoXY(7,17); Write('Port 201h bit');
- Write(' 0 1 4 5 2 3 6 7');
- GotoXY(7,19); Write('If joystick direction = 0, joystick pot ');
- Write('is disconnected or open.');
- GotoXY(7,21); Write('Button output = "1" if switch contact closed.');
- repeat
- JoyStkPos(0,X0,Y0); {bit 0,1}
- JoyStkPos(1,X1,Y1); {bit 2,3}
- GotoXY(21,13);
- Write(X0:3,' ',Y0:3,' ',Ord(JoyStkBtn(BtnA1)),' ');
- Write(Ord(JoyStkBtn(BtnA2)),' ');
- Write(X1:3,' ',Y1:3,' ',Ord(JoyStkBtn(BtnB1)),' ');
- Write(Ord(JoyStkBtn(BtnB2)));
- until KeyPressed;
- ClrScr;
- end.