uses
 crt;

var W1,W2:word;

const
  cBaseTime=$40;

function GetTime:word; assembler;
asm
   push bx
   push dx
   mov  dx,cBaseTime+03h
   mov  al,0F2h
   pushf
   cli
   out  dx,al
   in   al,cBaseTime {}
   in   al,cBaseTime
   mov  bl,al
   in   al,cBaseTime
   mov  bh,al
   popf
   mov  ax,bx
   pop  dx

   pop  bx
end;

begin
  repeat
    W1:=GetTime;
    W2:=GetTime;
{$Q-}
    writeln(W1:5,' ',W2:5,'  ',W1-W2:2);
{$Q+}
  until keypressed;
end.


