Program Ring_Bell;

{***************************************************
* This program has a two fold benifit. First, is   *
*  to assist when running a time consuming batch   *
*  file and I might be somewhere else within       *
*  hearing range like in the next room, I would    *
*  know immediatly when it finishes.               *
*  Last, it gave me a chance to figure out how     *
*  load parameters from the command line even      *
*  thought it's nothing fancy.                     *
*                                                  *
* The parameter choises are as follows:            *
*  A = Alarm, a steady bell till a key is pressed. *
*  W = Warning, a pause between each bell till a   *
*       key is pressed.                            *
*  B = Bell, a single bell.                        *
*  H = Help, gives something like this.            *
*      ex. A>BELL B                                *
*  Only one space between the second L and the     *
*    parameter.                                    *
*                                                  *
* Version 1.00                                     *
* Kirk Fitzgerald  12 August 1985                  *
***************************************************}

Const
   FCB                = $5d;
   FCBHowLong         = $80;

Var
   CommandLine,
   CommandLineLength:   Byte;
   I:                   Integer;


{*************** Procedures ****************}


Procedure Alarm;
Begin
     While not KeyPressed do
        Write(^G^G);
End;


Procedure Warning;
Begin
     While not KeyPressed do
     Begin
        Write(^G^G^G);
        Delay(1000);
     End;
End;


Procedure Bell;
Begin
     Write(^G^G^G^G^G);
End;


Procedure Help;
Begin
     Writeln('A = Alarm, a steady bell till a key is pressed.');
     Writeln('W = Warning, a pause between each bell till a key is pressed.');
     Writeln('B = Bell, a single bell.');
     Writeln('H = Help, gives something like this.');
     Writeln('  Ex.  A>BELL B');
     Writeln('With only one space between.');
End;



Procedure Read_Interpret_and_Do_Command_Line;
Begin
     CommandLineLength := Mem[FCBHowLong];
     CommandLine := Mem[FCB];

     If commandLineLength = 2 Then
     Begin
          Case Chr(CommandLine) of
             'A': Alarm;
             'W': Warning;
             'B': Bell;
             'H': Help;
          Else
             Bell;
             Help;
          End;
     End
     Else
     Begin
          Bell;
          Help;
     End;
End;


{************* Main Line *************}


Begin
     Read_Interpret_and_Do_Command_Line;
End.




