home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-386-Vol-2of3.iso
/
c
/
ctkit11.zip
/
CTU.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-12-14
|
2KB
|
118 lines
Unit Ctu;
interface
USES
Dos, Async2;
CONST
Version = '1.1';
Rev = ''; {revision code, for compatibility checking}
Esc = #27;
EndChar = #255;
OK = #1;
NOTOK = #2;
NulCh = #0;
AltX = Chr(45);
AltC = Chr(46);
AltF = Chr(33);
Alpha = ['A'..'Z','0'..'9','a'..'z','.',':'];
InitCode = Esc+#236;
type
cnftype = record
ctdir: string;
Dport, dbaud: word;
quiet: boolean;
end;
var
cnf: cnftype;
Quiet: boolean;
Function Waitforchar: char;
Function GetString: string;
{
Function ReadKey: char;
Function KeyPressed: boolean;
}
Procedure Delay(time: word);
implementation
FUNCTION WaitForChar : CHAR;
VAR
t: WORD;
BEGIN
t := 0;
REPEAT
INC(t);
UNTIL (t>65500) OR Async_Buffer_Check;
IF Async_Buffer_Check THEN
WaitForChar:=Async_Read
ELSE
WaitForChar:=#0;
END;
Function GetString: string;
var ts: string;
ch: char;
begin
ts := '';
repeat
ch := WaitForChar;
if (ch <> #0) and (ch <> EndChar) then
ts := ts + ch;
until (ch = #0) or (ch = EndChar);
GetString := ts;
end;
{
Function ReadKey: char;
var
Regs: registers;
ch, s: char;
begin
Regs.ah := $08;
Intr ($21, Regs);
Ch := Chr(Regs.al);
readkey := ch;
end;
Function KeyPressed: boolean;
var
ch: char;
regs: registers;
begin
KeyPressed := false;
Regs.AH := $0B;
Intr($21,Regs);
if Regs.AL = 255 then
KeyPressed := true;
end;
}
Procedure Delay (Time: word);
var
h, m, s, s100, tot1, tot2: word;
begin
Time := Time div 10;
GetTime (h, m, s, s100);
tot1 := s100+s*100+m*6000+h*36000;
repeat
GetTime (h, m, s, s100);
tot2 := s100+s*100+m*6000+h*36000;
until tot2 - Time >= tot1;
end;
begin
Quiet := false;
end.