program ClockControl;{$A+,B-,E-,F-,G+,N+,O-,P+,T-,V-,X+}
{$D-,I-,L-,Q-,R-,S-,Y-}
{$M 65520,0,655360}
uses
Dos;
var
SaveClockInterrupt:procedure;
Time:Longint;
procedure ClockInterrupt;interrupt;{大约每18.2秒执行一次}
begin
Inc(Time);
inline($9C);{PUSHF----标志寄存器压栈}
SaveClockInterrupt;{调用原中断服务程序,不需要时可省略}
end;
begin
GetIntVec($1C,@SaveClockInterrupt);
SetIntVec($1C,@ClockInterrupt);
WriteLn('Now start counting time ...');
Time:=0;
repeat
until Time>=18.2*5;
WriteLn('5 seconds pasted!');
ReadLn;
SetIntVec($1C,@SaveClockInterrupt);
end.