home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug130.arc
/
JOYSTICK.INC
< prev
next >
Wrap
Text File
|
1979-12-31
|
896b
|
31 lines
{ JOYSTICK.INC - routines for using joystick
Written by Keith Wood 15/04/89 }
var joy_avail : boolean; { joystick present ? }
procedure init_joystick; { initialise PIO }
begin
port[1] := 255;
port[1] := 255
end;
function joystick : byte; { read joystick setting,
bit 0 - up, bit 1 - down,
bit 3 - left, bit 4 - right,
bit 7 - fire }
var j: byte;
begin
j := 0;
if joy_avail then j := not port[0] and $8F;
if j>0 then delay(100);
joystick := j
end;
procedure check_joy; { check joystick present,
sets joy_avail accordingly }
begin
init_joystick;
joy_avail := true;
joy_avail := joystick<>$8F;
end;