home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
USCX
/
TURBO-02.ZIP
/
NEWINT9.LIB
< prev
next >
Wrap
Text File
|
1984-12-17
|
3KB
|
81 lines
{@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
The purchaser of these procedures and functions may include them in COMPILED
programs freely, but may not sell or give away the source text.
PURPOSE : Replace the standard "Interrupt 9", the Keyboard interrupt, with
a version that returns exactly and only the SCAN CODE of each
key PRESSED or RELEASED (release scan code = scan code + 128).
Typematic and all shift keys are disabled. In fact, for safety's
sake scan code 29 followed by 70 (Control-Break) is programmed in.
WARNING: BE VERY SURE that the procedure "OldInt" gets executed BEFORE
you leave your program--otherwise you will be excommunicated
by your PC and have no recourse but to turn it off and on again.
}
var
WatchByte : byte absolute DSeg:$0400; {this location for WatchByte is
arbitrary, but it is hard-coded
in the new interrupt. }
mc : array[1..22] of byte; {by putting the code in a variable,
we can easily get the ADDRESS
of the code and point the
interrupt vector to it.}
KeyIntA : integer absolute $0000:$0024; {these are the interrupt}
KeyIntB : integer absolute $0000:$0026; {vector's segment and
offset}
HoldA, HoldB : integer;
OldByte, OlderByte : byte; {of course!}
{@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
procedure NewInt;
{Save the address of the regular interrupt, and put the address
of the new version in its place}
begin
HoldA := KeyIntA; HoldB := KeyIntB;
KeyIntA := Ofs(mc);
KeyIntB := Seg(mc);
end;
{@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
procedure OldInt;
{PURPOSE : restore regular keyboard interrupt}
begin
KeyIntA := HoldA; KeyIntB := HoldB;
end;
{@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
procedure SetUpInt;
{PURPOSE : The bytes of the array MC constitute a new keyboard interrupt
in Machine Code. When a key is pressed, its scan code appears
in the variable WatchByte}
var
N : byte;
begin
mc[1] := $50;mc[2] := $E4;mc[3] := $60;mc[4] := $A2;mc[5] := $00;
mc[6] := $04;mc[7] := $E4;mc[8] := $61;mc[9] := $0C;mc[10] := $80;
mc[11] := $E6;mc[12] := $61;mc[13] := $24;mc[14] := $7F;mc[15] := $E6;
mc[16] := $61;mc[17] := $B0;mc[18] := $20;mc[19] := $E6;mc[20] := $20;
mc[21] := $58;mc[22] := $CF;
{mc[5] and mc[6] contain the address of WatchByte (in byte-reversed
format). You can change WatchByte's address IF you change it here too}
end;
{@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
function WatchKeys:byte;
{PURPOSE : Note when the value of WatchByte changes and report the scan code
of the key pressed.}
begin
repeat until WatchByte <> OldByte;
OlderByte := OldByte;
OldByte := WatchByte;
WatchKeys := WatchByte;
{Here's a LITTLE protection--<Ctrl><Break> restores the old interrupt}
if (OlderByte = 29) and (OldByte = 70) then OldInt;
end;
{@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}