home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.update.uu.se
/
ftp.update.uu.se.2014.03.zip
/
ftp.update.uu.se
/
pub
/
rainbow
/
msdos
/
misc2
/
dialv23.lzh
/
KEYBOARD.INC
< prev
next >
Wrap
Text File
|
1985-08-03
|
3KB
|
92 lines
{********* This file is an "include" file to be used with DIAL.PAS. *********}
Function Level2Key : Boolean;
{
This uses level 2 console in calls to get input characters You should NOT mix
Level 2 inputs with the above ReadKey inputs, as you'll screw up the level 2
key buffer. This routine is only included to clear the level 2 keyboard
buffer.
}
Var
InString : Str80;
Regs : Register_Set;
Begin
InString := '';
Regs.CX := 0;
Regs.DI := 2;
Intr(24,Regs);
If Regs.CL = Successful Then
Begin
Level2Key := True;
InString := CHR(Regs.AL);
End
Else Level2Key := False;
End; {Function Level2Key}
Procedure ClearLevel2Buffer;
{
To clear the level 2 keyboard input buffer, we'll read the level 2 buffer
until it's empty; or until we've read a ridulously large number of
characters.
}
Var
cntr : Integer;
Begin
cntr := 0;
While (Level2Key) And (cntr < 255) Do Begin cntr := cntr + 1; End;
End; {Procedure ClearLevel2Buffer}
Function Level1Key: Integer;
{
Read a character via the level 1 capability of the Rainbow. Don't return until
we have a character. Return with the character value as function value and
possible global booleans set for shift, control, function, and caps lock set.
}
Const
No_Char_Ready = 0;
Lvl2_In_Progress = 1;
Char_Entered = 255;
Var
ch : char;
rc : integer;
char_ready : boolean;
regs : Register_Set;
Begin
char_ready := false;
Repeat
Begin
lv1_fnc := false; {say none of these are true yet}
lv1_shft := false;
lv1_ctrl := false;
lv1_caps := false;
With regs do
Begin
ax := 0; {clear where results are returned}
cx := 0;
di := 6; {level 1 input}
End;
Intr(24,Regs); {get a character maybe}
Case (regs.cx and $00ff) of
No_Char_Ready: Begin
End;
Lvl2_In_Progress: ClearLevel2Buffer;
Char_Entered: Begin
rc := (regs.ax and $ff);
if ((regs.ax and $0100) <> 0) then lv1_fnc := true;
if ((regs.ax and $0200) <> 0) then lv1_shft := true;
if ((regs.ax and $0400) <> 0) then lv1_ctrl := true;
if ((regs.ax and $0800) <> 0) then lv1_caps := true;
char_ready := true;
End;
Else Begin {i don't understand}
End;
End;
End;
Until char_ready;
Level1Key := RC;
End; {Function Level1Key}