home *** CD-ROM | disk | FTP | other *** search
- {$S-,I-,R-}
- {$M 2048,0,655360}
- Program HelloWorld;
- Uses Dos,opstring,opInt,OpTsr,Opinline,OpCrt;
- Const
- OneHour=60*60*18.2;
- OneMinute=60*18.2;
- HotKey=$080F;
- WaitForDos = True;
- TimerTic:LongInt=0;
- BootTic:LongInt=0;
- MyIsrHandle = 16;
- IntNumber = $08;
- code:Integer=0;
- Delim:Charset=[':',' '];
-
- Var
- Hours,Minutes:Integer;
- WordC:Byte;
-
- {$F+}
- Procedure Ticker(BP:Word); Interrupt;
- Var Regs:IntRegisters absolute BP;
- Begin
- Inc(TimerTic);
- If TimerTic>BootTic then Reboot;
- ChainInt(Regs, IsrArray[MyIsrHandle].Origaddr);
- end;
-
- Procedure PopUpEntryPoint(Var Regs:Registers);
- Begin
- FastWrite('Tics until boot='+Long2Str(BootTic-TimerTic)+' ',
- 1,45,$1F);
- end; {$F-}
-
- Procedure Instructions;
- Begin
- Writeln('TIMEBOMB expects its parm in the HH:MM format');
- Writeln('You may also enter TIMEBOMB TEST to cause a');
- Writeln('boot in 1 minute for testing purposes');
- end;
-
- Begin
- If ParamCount=0 then Begin
- Instructions;
- Exit;
- end
- else Begin
- If StUpCase(ParamStr(1))='TEST' then BootTic := Trunc(oneMinute)
- else Begin
- WordC := Wordcount(ParamStr(1),Delim);
- If WordC < 2 then Begin
- Instructions;
- Exit;
- end
- Else begin
- VAL(ExtractWord(1,ParamStr(1),Delim),Hours,code);
- If Code>0 then Begin
- Writeln('Invalid parameter to TimeBomb ',ParamStr(1));
- Instructions;
- Exit;
- end
- else Begin
- VAL(ExtractWord(2,ParamStr(1),Delim),Minutes,code);
- If Code>0 then Begin
- Writeln('Invalid parameter to TimeBomb ',ParamStr(1));
- Instructions;
- Exit;
- end
- else Begin
- If (Hours > 24) or (Hours<0) then Begin
- Writeln('Parameter out of range 0-24 hours is valid');
- Instructions;
- Exit;
- end
- else if (minutes > 59) or (Minutes<1) then Begin
- Writeln('Parameter out of range 1-59 minutes is valid');
- Instructions;
- Exit;
- end
- else begin
- BootTic := Trunc((Hours*oneHour)+(Minutes*OneMinute));
- Writeln('TimeBomb going Resident with ',BootTic:10,
- ' tics until boot');
- end;
- end;
- end;
- end;
- end;
- end;
- If Initvector(IntNumber,MyIsrHandle,@Ticker) then {};
- If DefinePop(HotKey, PopUpEntryPoint, Ptr(SSEG,SPTR), WaitForDos) then
- Begin
- Writeln('TIMEBOMB Ticking, Press <Alt><Tab> for Tics to Boot Report');
- PopUpsOn;
- StayRes(ParagraphsToKeep, 0);
- end;
- Writeln('TimeBomb failed to go resident');
- end.
-