program Rozjezd;

          {ษอออออออออออออออออออออออออออออออออออออออออออออออออออออออออป}
          {บ                                                         บ}
          {บ  Hlavni program pro Rozjezd aplikace s Term_10          บ}
          {บ                                                         บ}
          {บ                                                         บ}
          {ศอออออออออออออออออออออออออออออออออออออออออออออออออออออออออผ}

{$I Sets.inc}


uses
{$ifdef DebGraph}
  Graph,
  GraphWin,
{$endif}
{$ifdef Deb_Crt}
  Crt,
  CrtWin,
{$endif}
{$ifdef Tick}
  Tick,
{$endif}
  uMAke,
  Kernel,        { operacni system ReTOS }
  ProcMenu,      { aplikacni menu }
  uInit,         { Inicializace promenych a HW }
  G240X128,
  LocGlb,
  uNMInt,
  uExit;         { Ukonceni programu }


{------------------hlavni program----------------------------}
begin
  {nacteni a kontrola Glb}
  ReadGlb;

  pInit;   {inicializace bez o.s.ReTOS}

  {nastaveni vlastni ExitProc}
  SetAppExitProc;

  {inicializace o.s.ReTOS}
  StartMain(MainSPrio,MainDPrio);
  InitInterruptStack(1,254);
  StartTimeSlicing(8);

{$ifdef Tick}
  {inicializace systemoveho casovace a jeho zrychleni na 11ms}
  InitTickI;
  SetTickDivider(5);
{$endif}

{$ifdef DebGraph}
  GraphInit;
{$endif}

{$ifdef Deb_Crt}
  CrtInit;
{$endif}


  UserMenu;     { spusteni uzivatelskeho menu}

  {$ifdef Deb}
  pDeb;
  {$endif}

  TermLEDtimer.SaveTime;

  repeat
    {telo hlavniho procesu,
     zatim prakticky prazdne, obvykle zde byva hlavni ridici automat}
    if TermLEDtimer.TstTime(500) then
    begin
      TermLEDtimer.SaveTime;
      Term10LED:=not Term10LED;
      if MyTerm<>nil then
        MyTerm^.LedSign(Term10LED,not Term10LED);
    end;

    Wait(1);
  until FlEnd;

  Abort('*');
  TerminateMain;

  AppExit;   { ukonceni programu a HW }
end.
