program Test_Tick;

uses
  Crt,
  Dos,
  HWsyst,
  Tick,
  Timer;

const
  cVerApp = '01.00,15.04.2005'; {verze tohoto testu}

const
  cNumData = 150;
var
  Data:array[1..cNumData]of word;
  I:integer;
  L:longint;
  Max:word;
  Int:word;

{$S-}
procedure MyTick1; far;
begin
  Int:=ReadTimer0;
end;
{$S+}

Begin
  TextMode(CO80+Font8x8);
  ClrScr;
  Max:=0;
  Randomize;

  UserTick1:=MyTick1;
  InitTickI;
  repeat
  {$R-}
   PushfCli;
    for I:=1 to cNumData do
      Data[I]:=ReadTimer0;
   Popf;
  {$R+}
    for I:=1 to cNumData do
    begin
      if I=1 then
        writeln(Data[I]:5)
      else
      begin
        write(Data[I]:5,' ');
        if Data[I-1]>Data[I] then
        begin
          L:=Data[I-1]-Data[I];
        end
        else
        begin
          L:=GetTimer;
          if L=0 then L:=65536;
          L:=L-Data[I]+Data[I-1]
        end;
        if L>Max then Max:=L;
        writeln(L:3,' Max=',Max,' Int=',Int);
      end;
    end;
    writeln;
    Delay(Random(150)+1);
  until keypressed;
End.
