home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG099.ARC
/
JOYSTICK.I
< prev
next >
Wrap
Text File
|
1979-12-31
|
768b
|
40 lines
Function JoyStick : Byte;
var
Test : Byte;
Begin
Port[1] := 255;
Test := Port[0];
Test := Test Xor 255;
JoyStick := Test And 143;
End;
Function Bit( BitCheck, Number : Byte ) : Boolean;
Begin
Bit := Odd( Number Shr BitCheck );
End;
var
JoyIn : Byte;
Begin
Repeat
begin
JoyIn := JoyStick;
if Bit(0,JoyIn) then Write('Up ');
if Bit(1,JoyIn) then Write('Down ');
if Bit(2,JoyIn) then Write('Left ');
if Bit(3,JoyIn) then Write('Right ');
if Bit(7,JoyIn) then Write('Fire ');
if JoyIn = 0 then WriteLn('Nothing ',JoyIn)
else
WriteLn(JoyIn);
end;
until KeyPressed;
End.