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 >
Wrap
Pascal/Delphi Source File
|
1992-04-08
|
2KB
|
59 lines
(4683) Sat 4 Apr 92 17:33
By: Matt Schuttloffel
To: Gavin Campbell
Re: Joystick
St:
---------------------------------------------------------------------------
@EID:e493 18848c20
@PID: FasToss .9b
@MSGID: 1:170/806 2f918193
@REPLY: 1:250/801.0 29d97bd6
> How would someone read from a joystick. Anyone have
> any ideas. Is it
> like a mouse ore different. Does anyone have any
> units or can anyone
> help?
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.
--- FOFasToss 0.90/beta
* Origin: Total Force BBS = 250-3018 = 213megs, 14.4k (1:170/806@fidonet)
@PATH: 170/806 800 400 396/1 13/13 1/217 105/27 42 500/1 9 512/0
@PATH: 512/1007