home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR10 / CD_PAS.ZIP / CARRIER.PAS < prev    next >
Pascal/Delphi Source File  |  1993-07-29  |  1KB  |  48 lines

  1. Uses Dos;
  2.  
  3. Var Key:Char;
  4.     Parameter:String;
  5.     Regs:Registers;
  6.  
  7. Function CD (Comport:Byte) : Boolean; (** Carrier Detected (CD) **)
  8.  Begin
  9.   With Regs do
  10.   Begin
  11.     AH := 3;                      {Interrupt 14H - Serial communication}
  12.     DX:=Comport-1;                {Function 3 - Detect carrier         }
  13.     Intr ($14, Regs);
  14.     CD := ((AL AND 128) = 128);
  15.   end;
  16. end;
  17.  
  18. Procedure Help;
  19.   Begin
  20.    Writeln ('Batch file Carrier Detector v1.0 - (c) Copyright 1993 Lavi Tidhar');
  21.    Writeln;
  22.    Writeln ('Usage: Carrier [Comport number]');
  23.    Writeln;
  24.    Writeln ('Com ports supported : 1-4');
  25.    Writeln ('Errorevels:');
  26.    Writeln ('~~~~~~~~~~~');
  27.    Writeln ('10 = error in execution, will result in this help screen');
  28.    Writeln (' 1 = Carrier Detected');
  29.    Writeln (' 0 = NO CARRIER');
  30.    Writeln;
  31.    Writeln ('May the force be with you!');
  32.    Halt (10);
  33.   End;
  34.  
  35. Begin (** Main **)
  36.  
  37.  If ParamCount<>1 then help; {If number of parameters isn't 1 then run the}
  38.  Parameter:=Paramstr(1);     {Help screen                                 }
  39.  Key:=Parameter[1];
  40.  Case key of
  41.  '1': If CD (1) then halt (1) else Halt (0);
  42.  '2': If CD (2) then halt (1) else Halt (0);
  43.  '3': If CD (3) then halt (1) else Halt (0);
  44.  '4': If CD (4) then halt (1) else Halt (0);
  45.  End;
  46.  
  47. End.
  48.