Uses Objects,Graph;
Procedure EGAVGADriver;external;
Function KeyPressed:boolean;assembler;
asm
  mov ah, 1
  int 16h
  mov al, 0
  jz @@2
  mov al, 1
@@2:
end;
var
  Wrld   : PWorld;
  Timer  : LongInt Absolute $0040:$006c;
  Last,i : Longint;
  MyRAH  : pRAH;
  MyStinger : pSting;
  mP     : TParams;
  Page   : byte;
  gD,gM : integer;
begin
  {$L EGAVGA.OBJ}
  RegisterBGIDriver(@EGAVGADriver);
  Gd:=VGA;
  Gm:=VGAHi;
  INitGraph(gD,gM,'');
  New(Wrld,Init('BG.dat'));
  With mP do begin
    Pos.x:=75.0;
    Pos.y := 400.0;
    Speed.X := 20.0;
    Speed.Y := 0.0;
    Accel.X := 0.02;
    Accel.Y := -0.01;
  end;
  New(MyRAH,Init('rah-66-2.dat',mP,100));
  Wrld^.AddObject(MyRAH);

  With mP do begin
    Pos.x:=320.0;
    Pos.y := 50.0;
    Speed.X := -2;
    Speed.Y := 30;
    Accel.X := 0.0;
    Accel.Y := -0.9;
  end;
  New(MyStinger,Init('stinger.dat',mP,110));
  Wrld^.AddObject(MyStinger);

  TIME_FACTOR := 0.1;
  FPS         := 1;
  FIELD_X     := 600;

  Last := timeR;
  i:=0;
  page:=0;
  Wrld^.Draw;
  while not (Wrld^.Ending or KeyPressed)  do
  begin
{    SetActivePage(Page); }
    Wrld^.Draw;
{    SetVisualPage(Page);
    Page:=1-Page;         }
    repeat until (Timer-Last) <> 0;
{    Wrld^.Frame(Timer-Last);}
    Wrld^.Frame(1);
    Last := timeR;
{    Write(#13,i,' ',Timer);}
    Inc(i);
  end;
  CloseGraph;
end.