Last active
August 29, 2015 14:06
-
-
Save Fortyseven/4f5a4f3c4750a00d311f to your computer and use it in GitHub Desktop.
INPUT.PAS -- old Turbo Pascal DOS input code from 1996
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{$G+,A+,S-,R-,I-,D-,L-,Q-,F- | |
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | |
³ °±²Û INPUT v1.1 Û²±°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ³ | |
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | |
Multi-Input Processing Library - Gamepad/Mouse/Keyboard | |
(c)1996 Hacsoft Developments | |
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | |
³ °±²Û Unit History Û²±°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ³ | |
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | |
v1.0 - þ Original. Works. | |
v1.1 - þ Added _Pause, which pauses and returns true if _B pressed (since | |
_B is an all purpose "cancel"... | |
þ Added MultiActive to see if it INPUT has been activated. | |
} | |
unit input; | |
interface | |
uses gamepad, dos; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Const | |
ForceJoystickOff :Boolean=False; | |
ForceMouseOff :Boolean=False; | |
JoystickInstalled :Boolean=False; | |
MouseInstalled :Boolean=False; | |
MTX =0; | |
MTY =0; | |
MultiActive :Boolean=False; | |
Var | |
_A, _B, _C, _D, | |
_Up, _Down, _Left, _Right, | |
_Any, _AnyDir, _AnyButton :Boolean; | |
CONST | |
Up=72; Down=80; Left=75; Right=77; PageUp=73; PageDown=81; | |
Escape=1; F1=59; F2=60; F3=61; F4=62; F5=63; | |
F6=64; F7=65; F8 = 66; F9 = 67; F10 = 68; Enter = 28; | |
LShift = 42; Control = 29; Alt = 56; Home = 71; | |
EndKey = 79; BackSpace = 14; RShift = 54; | |
Caps = 58; Space = 57; | |
KeyInterrupt = $09; | |
KeyBuffer = $60; | |
KeyController = $61; | |
PICPort = $20; | |
VAR | |
KeyState : ARRAY[1..128] OF BOOLEAN; | |
ScanCode : WORD; | |
KeysActive : INTEGER; | |
OldKeybd : POINTER; | |
{ dKeyBd keyboard interface } | |
Procedure InitMultiKey; | |
Procedure CloseMultiKey; | |
Type tMousePointer = record | |
x,y :Integer; { hot spot } | |
buf :Array [1..32] of Word; { First 16 is mask, second 16 cursor data } | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ game multi-input main routines } | |
procedure InitInput; | |
procedure DeInitInput; | |
procedure UpdateInput; | |
Function _Pause:Boolean; {Pauses, and returns TRUE if _B pressed else FALSE} | |
{mouse routines} | |
Function mInit :Word; | |
Procedure mShow; | |
Procedure mHide; | |
Function mGetX :Word; | |
Function mGetY :Word; | |
Function mButton:Word; | |
Procedure mShape(var p:tMousePointer); {Defines mouse shape} | |
Procedure mMove(var x,y:integer); {+/- # pixels in last movement} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
implementation | |
CONST | |
XKeys : SET OF 0..127 = [Enter,LShift,RShift,Control,Alt,Escape,Caps,0]; | |
{ stuff NOT to use in ReadMultiStr. 0 is no key pressed } | |
Const | |
MKeyOn : BOOLEAN = False; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function _Pause:Boolean; | |
Begin | |
repeat UpdateInput; until _Any; if _B then _pause:=true | |
else _pause:=false; | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄMOUSE ROUTINESÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function mInit:Word; | |
Var x:word; | |
b:byte; | |
Begin | |
Asm | |
mov ah, 21; | |
int $33; | |
mov x,ax; | |
mov b,bl; | |
End; | |
mInit:=b; | |
{ if not (x=$FFFF) then mReset:=0;} | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function mInstalled:Boolean; Assembler; | |
Asm | |
xor ax, ax | |
int $33; | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Procedure mShow;Assembler; | |
Asm | |
mov ax, $1; | |
int $33; | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Procedure mHide;Assembler; | |
Asm | |
mov ax, $2; | |
int $33; | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function mGetX:Word; {Adjusted for 320x200 mode!} Assembler; | |
asm | |
mov ax, $3; | |
int $33; | |
shr cx,1; | |
mov ax, cx; | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function mGetY:Word; Assembler; | |
{Var x:word; | |
Begin} | |
asm | |
mov ax, $3; | |
int $33; | |
mov ax, dx; | |
{ end; | |
mGetY:=x;} | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function mButton:Word; | |
Begin | |
if mouseinstalled then | |
asm mov ax, 3; | |
int $33; | |
mov @Result, bx; | |
end else mButton:=0; | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ | |
INT $33 | |
AX = 9 | |
BX = horizontal hot spot (-16 to 16) | |
CX = vertical hot spot (-16 to 16) | |
ES:DX = pointer to screen and cursor masks (16 byte bitmap) | |
} | |
Procedure mShape(var p:tMousePointer); | |
begin | |
if mouseinstalled then | |
with p do | |
Asm | |
mov ax, seg buf; | |
mov es, ax; | |
mov dx, offset buf; | |
mov ax, $9; | |
mov bx, x; | |
mov cx, y; | |
int $33; | |
call mInit; | |
End; | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Procedure mMove(var x,y:integer); | |
var a,b:integer; | |
begin | |
if mouseinstalled then | |
begin | |
Asm | |
mov ax, $B; | |
int $33; | |
mov a, cx; | |
mov b, dx; | |
End; | |
x:=a; | |
y:=b; | |
End else begin x:=0; y:=0; end; | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure InitInput; | |
begin | |
MultiActive:=True; | |
InitMultiKey; | |
if ((not forcemouseoff) and mInstalled) then begin | |
mInit; | |
mouseinstalled:=true; | |
end; | |
if ((not forcejoystickoff) and padexists) then begin | |
padinit; | |
joystickinstalled:=true; | |
end | |
else begin | |
jUp :=False; | |
jDown :=False; | |
jLeft :=False; | |
jRight :=False; | |
{ ButtonA:=False; | |
ButtonB:=False; | |
ButtonC:=False; | |
ButtonD:=False;} | |
end; | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure DeInitInput; | |
begin | |
CloseMultiKey; | |
{ setoldbrkint; | |
setoldkeyint;} | |
multiactive:=false; | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function ButtonA:Boolean; | |
begin | |
if joystickinstalled then Asm mov dx, $201; in al, dx; not al; and al, 16;mov @Result, al; leave; ret; End | |
else ButtonA:=False; | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function ButtonB:Boolean; | |
Begin | |
if joystickinstalled then Asm mov dx, $201; in al, dx; not al; and al, 32; mov @Result, al; leave; ret; End | |
else ButtonB:=False; | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function ButtonC:Boolean; | |
Begin | |
if joystickinstalled then Asm mov dx, $201; in al, dx; not al; and al, 64; mov @Result, al; leave; ret; End | |
else ButtonC:=False; | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function ButtonD:Boolean; | |
Begin | |
if joystickinstalled then Asm mov dx, $201; in al, dx; not al; and al, 128; mov @Result, al; leave; ret; End | |
else ButtonD:=False; | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure UpdateInput; | |
Var mx,my:integer; | |
begin | |
if joystickinstalled then PadUpdate; | |
if joystickinstalled then mMove(mx,my) else begin mx:=0; my:=0; end; | |
_Up := ((keystate[up] or jUp) or (my<(-mtx))); | |
_Down := ((keystate[down] or jDown) or (my>mtx)); | |
_Left := ((keystate[left] or jLeft) or (mx<(-mty))); | |
_Right := ((keystate[right] or jRight) or (mx>mty)); | |
_A := ((keystate[control] or ButtonA) or (mButton=1)); | |
_B := ((keystate[alt] or ButtonB) or (mButton=2)); | |
_C := ((keystate[space] or ButtonC) or (mButton=4)); | |
_D := ((keystate[lshift] or ButtonD) or (mButton=3)); | |
_Any := _Up or _Down or _Left or _Right or _A or _B or _C or _D; | |
_AnyDir:= _Up or _Down or _Left or _Right; | |
_AnyButton:=_A or _B or _C or _D; | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{$F+} | |
Procedure MultiKey; INTERRUPT; | |
BEGIN | |
Asm | |
sti | |
in al,KeyBuffer | |
xor ah, ah | |
mov ScanCode, ax | |
in al,KeyController | |
or al, $82 | |
out KeyController, al | |
and al, $7F | |
out KeyController, al | |
mov al, $20 | |
out PICPort, al | |
End; | |
If ScanCode < 128 THEN | |
If not KeyState[ScanCode] Then Begin { if it's off, then do... } | |
KeyState[ScanCode] := TRUE; | |
Inc(KeysActive); | |
End; | |
IF ScanCode > 127 THEN | |
IF KeyState[ScanCode-128] THEN BEGIN { if it's on, then do... } | |
KeyState[ScanCode-128] := FALSE; | |
Dec(KeysActive); | |
END; | |
IF KeysActive = 0 THEN ScanCode := 0; | |
END; | |
{$F-} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Procedure InitMultiKey; | |
VAR | |
Count : INTEGER; | |
BEGIN | |
IF MKeyON THEN Exit; | |
GetIntVec(KeyInterrupt,OldKeyBd); | |
SetIntVec(KeyInterrupt,@MultiKey); | |
FOR Count := 1 TO 128 DO KeyState[Count] := FALSE; | |
MKeyOn := TRUE; | |
END; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Procedure CloseMultiKey; | |
BEGIN | |
IF MKeyOn THEN SetIntVec(KeyInterrupt,OldKeybd); | |
MKeyOn := FALSE; | |
END; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{$G+,A+,S-,R-,I-,D-,N-,E-,L-,Q-} | |
Unit GamePad; | |
Interface | |
Var | |
CentX, CentY, RangeX, RangeY :Word; | |
u,d,l,r :Boolean; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function ButtonA:Boolean; | |
Function ButtonB:Boolean; | |
Function ButtonC:Boolean; | |
Function ButtonD:Boolean; | |
Function JoyX:Word; | |
Function JoyY:Word; | |
Procedure JoyUpdate; | |
Procedure FastInit; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Implementation | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function ButtonA:Boolean; Assembler; | |
Asm mov dx, $201; in al, dx; not al; and al, 16; End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function ButtonB:Boolean; Assembler; | |
Asm mov dx, $201; in al, dx; not al; and al, 32; End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function ButtonC:Boolean; Assembler; | |
Asm mov dx, $201; in al, dx; not al; and al, 64; End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function ButtonD:Boolean; Assembler; | |
Asm mov dx, $201; in al, dx; not al; and al, 128; End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function JoyX:Word; | |
var x:Word; | |
Begin | |
x:=0; | |
port[$201]:=$FF; | |
while port[$201] and 1=1 do inc(x); | |
JoyX:=x; | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Function JoyY:Word; | |
Var y:Word; | |
Begin | |
y:=0; | |
port[$201]:=$0; | |
while port[$201] and 2=2 do inc(y); | |
JoyY:=y; | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Procedure JoyUpdate; | |
Var x,y:word; | |
Begin | |
X:=((JoyX+JoyX+JoyX+JoyX+JoyX+JoyX) div 6); | |
Y:=((JoyY+JoyY+JoyY+JoyY+JoyY+JoyY) div 6); | |
r:=(x>centx+RangeX); | |
l:=(x<centx-RangeX); | |
u:=(y<centy-RangeY); | |
d:=(y>centy+RangeX); | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Procedure FastInit; | |
Begin | |
CentX:=((JoyX+JoyX+JoyX+JoyX+JoyX+JoyX) div 6); | |
RangeX:=(CentX div 100) * 30; | |
CentY:=((JoyX+JoyX+JoyX+JoyX+JoyX+JoyX) div 6); | |
RangeY:=(CentY div 100) * 30; | |
End; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
Begin | |
FastInit; | |
End. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{$G+,A+,S-,R-,I-,D-,L-,Q-,F+} | |
unit input; | |
interface | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ constants for scan codes of various keys } | |
const escscan :byte = $01; | |
backscan :byte = $0e; | |
ctrlscan :byte = $1d; | |
lshscan :byte = $2a; | |
capscan :byte = $3a; | |
f1scan :byte = $3b; | |
f2scan :byte = $3c; | |
f3scan :byte = $3d; | |
f4scan :byte = $3e; | |
f5scan :byte = $3f; | |
f6scan :byte = $40; | |
f7scan :byte = $41; | |
f8scan :byte = $42; | |
f9scan :byte = $43; | |
f10scan :byte = $44; | |
f11scan :byte = $d9; | |
f12scan :byte = $da; | |
scrlscan :byte = $46; | |
tabscan :byte = $0f; | |
entscan :byte = $1c; | |
rshscan :byte = $36; | |
prtscan :byte = $37; | |
altscan :byte = $38; | |
homescan :byte = $47; | |
upscan :byte = $48; | |
pgupscan :byte = $49; | |
minscan :byte = $4a; | |
leftscan :byte = $4b; | |
midscan :byte = $4c; | |
rightscan :byte = $4d; | |
plusscan :byte = $4e; | |
endscan :byte = $4f; | |
downscan :byte = $50; | |
pgdnscan :byte = $51; | |
insscan :byte = $52; | |
delscan :byte = $53; | |
numscan :byte = $45; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ arrays that record keyboard status } | |
var | |
keydown, wasdown :array[0..127] of boolean; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ procedures/functions you may call } | |
procedure initnewkeyint; | |
procedure setoldkeyint; | |
procedure clearwasdownarray; | |
procedure initnewtimint; | |
procedure setoldtimint; | |
procedure initnewbrkint; | |
procedure setoldbrkint; | |
function scanof(chartoscan: char):byte; | |
procedure tickwait(time2wait: byte); | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
implementation | |
uses dos, utils; | |
{ pointers to old interrupt routines } | |
Const | |
keybinst :Boolean=False; | |
timerinst :Boolean=False; | |
brkinst :Boolean=False; | |
Var | |
oldexitproc, | |
oldkbdint, | |
oldtimint, | |
oldbrkint :pointer; | |
cloktick :byte; { counter to count clock "ticks" } | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure sti; inline($fb); { STI: set interrupt flag } | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure cli; inline($fa); { CLI: clear interrupt flag -- not used } | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure calloldint(sub: pointer); | |
{ calls old interrupt routine so that your programs don't deprive the computer | |
of any vital functions -- kudos to Stephen O'Brien and "Turbo Pascal 6.0: | |
The Complete Reference" for including this inline code on page 407 } | |
begin | |
inline($9c/ { PUSHF } | |
$ff/$5e/$06) { CALL DWORD PTR [BP+6] } | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure newkbdint; interrupt; { new keyboard handler } | |
begin | |
keydown[port[$60] mod 128] := (port[$60] < 128); { key is down if value of | |
60h is less than 128 -- | |
record current status } | |
if port[$60] < 128 then wasdown[port[$60]] := true; { update WASDOWN if the | |
key is currently | |
depressed } | |
calloldint(oldkbdint); { call old interrupt } | |
mem[$0040:$001a] := mem[$0040:$001c]; { Clear keyboard buffer: the buffer | |
is a ring buffer, where the com- | |
puter keeps track of the location | |
of the next character in the buffer | |
end the final character in the | |
buffer. To clear the buffer, set | |
the two equal to each other. } | |
sti | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure initnewkeyint; { set new keyboard interrupt } | |
var keycnt: byte; | |
begin | |
for keycnt := 0 to 127 do begin { reset arrays to all "False" } | |
keydown[keycnt] := false; | |
wasdown[keycnt] := false | |
end; | |
getintvec($09, oldkbdint); { record location of old keyboard int } | |
setintvec($09, addr(newkbdint)); { this line installs the new interrupt } | |
sti; | |
keybinst:=true; | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure setoldkeyint; { reset old interrupt } | |
begin | |
setintvec($09, oldkbdint); | |
sti; | |
keybinst:=false; | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure clearwasdownarray; { set all values in WASDOWN to "False" } | |
var cnter: byte; | |
begin | |
for cnter := 0 to 127 do wasdown[cnter] := false | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
function scanof(chartoscan: char): byte; { return scan code corresponding | |
to a character } | |
var tempbyte: byte; | |
begin | |
tempbyte := 0; | |
case upcase(chartoscan) of | |
'!', '1': tempbyte := $02; | |
'@', '2': tempbyte := $03; | |
'#', '3': tempbyte := $04; | |
'$', '4': tempbyte := $05; | |
'%', '5': tempbyte := $06; | |
'^', '6': tempbyte := $07; | |
'&', '7': tempbyte := $08; | |
'*', '8': tempbyte := $09; | |
'(', '9': tempbyte := $0a; | |
')', '0': tempbyte := $0b; | |
'_', '-': tempbyte := $0c; | |
'+', '=': tempbyte := $0d; | |
'A': tempbyte := $1e; | |
'S': tempbyte := $1f; | |
'D': tempbyte := $20; | |
'F': tempbyte := $21; | |
'G': tempbyte := $22; | |
'H': tempbyte := $23; | |
'J': tempbyte := $24; | |
'K': tempbyte := $25; | |
'L': tempbyte := $26; | |
':', ';': tempbyte := $27; | |
'"', '''': tempbyte := $28; | |
'~', '`': tempbyte := $29; | |
' ': tempbyte := $39; | |
'Q': tempbyte := $10; | |
'W': tempbyte := $11; | |
'E': tempbyte := $12; | |
'R': tempbyte := $13; | |
'T': tempbyte := $14; | |
'Y': tempbyte := $15; | |
'U': tempbyte := $16; | |
'I': tempbyte := $17; | |
'O': tempbyte := $18; | |
'P': tempbyte := $19; | |
'{', '[': tempbyte := $1a; | |
'}', ']': tempbyte := $1b; | |
'|', '\': tempbyte := $2b; | |
'Z': tempbyte := $2c; | |
'X': tempbyte := $2d; | |
'C': tempbyte := $2e; | |
'V': tempbyte := $2f; | |
'B': tempbyte := $30; | |
'N': tempbyte := $31; | |
'M': tempbyte := $32; | |
'<', ',': tempbyte := $33; | |
'>', '.': tempbyte := $34; | |
'?', '/': tempbyte := $35 | |
end; | |
scanof := tempbyte | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure newtimint; interrupt; { new timer interrupt } | |
begin | |
calloldint(oldtimint); { call old timer interrupt } | |
cloktick := cloktick + 1 { update "tick" counter } | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure initnewtimint; { set up new timer interrupt } | |
begin | |
getintvec($1c, oldtimint); { record location of old interrupt } | |
setintvec($1c, addr(newtimint)); { install new interrupt procedure } | |
timerinst:=true; | |
cloktick := 0; { set counter to 0 } | |
sti | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure setoldtimint; { reset old timer } | |
begin | |
setintvec($1c, oldtimint); | |
sti; | |
timerinst:=false; | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure tickwait(time2wait: byte); { do nothing until counter reaches | |
certain value } | |
begin | |
repeat until cloktick >= time2wait; | |
cloktick := 0 { reset counter } | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure newbrkint; interrupt; { new "Ctrl-Break" interrupt: does nothing } | |
begin | |
sti | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure setoldbrkint; { reset old "Ctrl-Break" interrupt } | |
begin | |
setintvec($1b, oldbrkint); | |
sti; | |
brkinst:=false; | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure initnewbrkint; { install new "Ctrl-Break" interrupt } | |
begin | |
getintvec($1b, oldbrkint); { get old interrupt location } | |
setintvec($1b, addr(newbrkint)); { set up new interrupt procedure } | |
sti; | |
brkinst:=true; | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
procedure newexitproc; | |
begin | |
if keybinst then setoldkeyint; | |
if timerinst then setoldtimint; | |
if brkinst then setoldbrkint; | |
ExitProc:=@OldExitProc; | |
end; | |
{ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | |
begin | |
oldexitproc:=@ExitProc; | |
ExitProc:=@NewExitProc; | |
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{$G+,A+,S-,R-,I-,D-,L-,N-,E-} | |
Unit Mouse; | |
interface | |
Type | |
PointerRec = | |
record | |
x,y : Integer; { hot spot } | |
buf : array [1..32] of Word; | |
{ First 16 is mask, second 16 cursor data } | |
end; | |
Function mInit :Word; | |
Procedure mShow; | |
Procedure mHide; | |
Function mGetX :Word; | |
Function mGetY :Word; | |
Function mButton:Word; | |
Procedure mShape(var p:pointerrec); | |
Procedure mMove(var x,y:integer); | |
implementation | |
{ú-ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ--ú} | |
Function mInit:Word; | |
Var x:word; | |
b:byte; | |
Begin | |
Asm | |
mov ah, 21; | |
int $33; | |
mov x,ax; | |
mov b,bl; | |
End; | |
mInit:=b; | |
{ if not (x=$FFFF) then mReset:=0;} | |
End; | |
{ú-ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ--ú} | |
Procedure mShow;Assembler; | |
Asm | |
mov ax, $1; | |
int $33; | |
End; | |
{ú-ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ--ú} | |
Procedure mHide;Assembler; | |
Asm | |
mov ax, $2; | |
int $33; | |
End; | |
{ú-ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ--ú} | |
Function mGetX:Word; {Adjusted for 320x200 mode!} Assembler; | |
asm | |
mov ax, $3; | |
int $33; | |
shr cx,1; | |
mov ax, cx; | |
end; | |
{ú-ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ--ú} | |
Function mGetY:Word; Assembler; | |
{Var x:word; | |
Begin} | |
asm | |
mov ax, $3; | |
int $33; | |
mov ax, dx; | |
{ end; | |
mGetY:=x;} | |
End; | |
{ú-ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ--ú} | |
Function mButton:Word; Assembler; | |
{var x:word; | |
Begin} | |
asm mov ax, 3; | |
int $33; | |
mov ax, bx; | |
{ end; | |
mButton:=x;} | |
End; | |
{ú-ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ--ú | |
INT $33 | |
AX = 9 | |
BX = horizontal hot spot (-16 to 16) | |
CX = vertical hot spot (-16 to 16) | |
ES:DX = pointer to screen and cursor masks (16 byte bitmap) | |
} | |
Procedure mShape(var p:pointerrec); | |
begin | |
with p do | |
Asm | |
mov ax, seg buf; | |
mov es, ax; | |
mov dx, offset buf; | |
mov ax, $9; | |
mov bx, x; | |
mov cx, y; | |
int $33; | |
call mInit; | |
End; | |
End; | |
{ú-ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ--ú} | |
Procedure mMove(var x,y:integer); | |
var a,b:integer; | |
begin | |
Asm | |
mov ax, $B; | |
int $33; | |
mov a, cx; | |
mov b, dx; | |
End; | |
x:=a; | |
y:=b; | |
End; | |
{ú-ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ--ú} | |
End. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment