大榕树 \ Pascal语言 \ Pascal练习
简单的时钟控制子程序
原文链接:http://www.mydrs.org/program/list.asp?id=204
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.
作者:陈世熹
来源:陈世熹的Pascal
时间:2001-09-02上一篇:简单的Ctrl-Break控制子程序
下一篇:简单的按键检测子程序
大榕树 版权所有 ©1999-2006