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
/
ENTERPRS
/
CPM
/
UTILS
/
F
/
MOUSE.LZH
/
JOYDEMO.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
2000-06-30
|
3KB
|
152 lines
{
Joy Stick Demo 1.1 11/22/92 (C) 1992 Steve Goldsmith
SG Tools Pro (C) 1992 Steve Goldsmith
SG Tools (C) 1992 Parsec, Inc.
This program requires SG Tools from Parsec, Inc. to compile. SG Tools Pro
is a set of professional add-ons for SG Tools and Turbo Pascal. You are
free to use the JOYSTICK.INC module in your own programs as you wish. If
you use any of my tools or programs a $5.00 payment is requested to:
Steve Goldsmith
2805 Jamaica Street
Sarasota, FL 34231
Send any comments to GEnie mail S.GOLDSMITH2
JOYDEMO.PAS shows how easy it is to add joy stick input to your SG Tools
applications. The Run procedure polls the joystick and displays the
direction(s) and fire button status until a key is pressed. The ReadJoy2
procedure is part of the JOYSTICK.INC module. I used the ADM-31 screen
codes for cursor plotting and colors. This was the easiest way until
Parsec releases the VDC Screen Manager for SG Tools.
}
program JoyDemo;
{$B-,C-,R-,U-,V-}
{SG Tools module to read cia ports}
{$I PORT.INC}
{SG Tools Pro joystick module}
{$I JOYSTICK.INC}
{codes for adm-31/commodore protocol}
const
appClrScr = #$1b#$3a;
appRvsOn = #$1b#$47#$34;
appRvsOff = #$1b#$47#$30;
appTitleColor = #$1b#$1b#$1b#$23;
appJoyColor = #$1b#$1b#$1b#$25;
appExitColor = #$1b#$1b#$1b#$21;
{text data}
appTitle = 'C128 CP/M Joy Stick Demo 1.1 11/22/92 ';
appCopyright = '(C) 1992 Steve Goldsmith';
appInfo = 'Move the joy stick in port 2 around';
appExit = 'Press any key to exit';
{other app related stuff}
appScrWidth = 80;
appScrHeight = 25;
type
appDispStr = string[255];
procedure PlotCursor (X,Y : byte);
begin
Write (#$1b#$3d+Chr (Y+$20)+Chr (X+$20))
end;
procedure CenterText (S : appDispStr; Y : byte);
begin
PlotCursor ((appScrWidth-Length (S)) div 2,Y);
Write (S)
end;
procedure PlotStr (X,Y : byte; S : appDispStr);
begin
PlotCursor (X,Y);
Write (S)
end;
procedure DispJoyInfo;
var
JoyData : byte;
begin
JoyData := ReadJoy2;
if JoyData and joyUp = 0 then
PlotStr (38,10,'Up')
else
PlotStr (38,10,' ');
if JoyData and joyDown = 0 then
PlotStr (37,14,'Down')
else
PlotStr (37,14,' ');
if JoyData and joyLeft = 0 then
PlotStr (32,12,'Left')
else
PlotStr (32,12,' ');
if JoyData and joyRight = 0 then
PlotStr (42,12,'Right')
else
PlotStr (42,12,' ');
if JoyData and joyFire = 0 then
PlotStr (37,12,'Fire')
else
PlotStr (37,12,' ')
end;
procedure Run;
var
K : char;
begin
Write (appJoyColor);
repeat
DispJoyInfo
until KeyPressed;
Read (Kbd,K)
end;
procedure Init;
begin
Write (appClrScr);
Write (appTitleColor);
CenterText (appTitle,0);
CenterText (appCopyright,2);
CenterText (appInfo,4);
CenterText (appExit,6)
end;
procedure Done;
begin
Write (appExitColor);
PlotCursor (0,appScrHeight-3)
end;
begin
Init;
Run;
Done
end.