Program BootWindows;

        {  Outputs MSDOS errorlevel 0 to go to MS-Windows  }
        {  errorlevel 1 to go to MS-DOS  }

uses Dos, Crt;

var
   SendToDos:  word;
   Counter:  integer;
   GetKey:  char;

Procedure Timer;

begin

      Delay (1000);
      Inc (Counter);
      if Counter >= 180 then SendToDos :=0;

end;

Procedure Waiting;

begin

     if not KeyPressed then exit;
     Getkey := ReadKey;
     if GetKey = '1' then SendToDos :=0;
     if GetKey = 'w' then SendToDos :=0;
     if Getkey = 'W' then SendToDos :=0;
     if GetKey = '2' then SendToDos :=1;
     if GetKey = 'm' then SendToDos :=1;
     if GetKey = 'M' then SendToDos :=1;
     if GetKey = 'd' then SendToDos :=1;
     if GetKey = 'D' then SendToDos :=1;
     end;

begin

     SendToDos := 4;
     Counter := 0;
     writeln;
     writeln ('Press:        for:');
     writeln;
     writeln ('  1           Microsoft Windows');
     writeln;
     writeln ('  2           MS - DOS');
     writeln;
     writeln;
     writeln ('  MS-Windows will start in 3 minutes');

     repeat

           Timer;
           Waiting;

     until SendToDos <> 4;

     Halt (SendToDos);

end.
