home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ZSYS / SIMTEL20 / ZSIG / LUP11.PQS / LUP11.PAS
Pascal/Delphi Source File  |  2000-06-30  |  8KB  |  236 lines

  1. Program LUP;
  2.   {[A+,T=3] Instructions to PasMat.}
  3.  
  4.   {$C-  <--- These are to  }
  5.   {$W0  <--- optimize the  }
  6.   {$X+  <--- compiler.     }
  7.  
  8. {
  9.                       LUP (Library Utility in Pascal)
  10.                                   1/02/85
  11.  
  12.    The program help users use the following program, without, having
  13.    to type the LONG commands associated with library files:
  14.  
  15.                   DIR   (SD 11.0)           XMODEM L  (XMDM 11.7)
  16.                   LTYPE (TYPEL 3.6)         XMODEM LK (XMDM 11.7)
  17.  
  18.    It also, like LUX, allows you to get to another library file with
  19.    the command LUP filename[.LBR].  But unlike LUX, you may NOT use
  20.    wildcards when specifing a file name to TYPE, which is because of
  21.    the LTYPE program which I'm using.  If you'll notice, that all
  22.    the above files, are (almost) a MUST for any RCP/M (or Z-NODE)
  23.    type system, so the only extra file, would be LUP.COM.  LUX, as I
  24.    understand requires you to have a seperate file for all the command,
  25.    PLUS LUX, and for a small system, thats a lot of space.  Another
  26.    advantage of LUP, over LUX, is that LUP doesn't require warm-booting
  27.    (if you run TPFIX, see below), which (some people) say is bad for
  28.    the drives (I'm not one of them, but it does speed things up a bit).
  29.  
  30.    This program requires ZCPR3, to run, because, it uses the command
  31.    line.  You should check to see where the location of your command
  32.    line is, by using the Z3LOC.COM program, supplied with ZCPR3, and
  33.    place that value at the constant variable CommandLineLocation.
  34.  
  35.    After you compile this program, I suggest that you use a program called
  36.    TPFIX, to inhibit the program from warm-booting, in order to speed
  37.    up the operations of this program.
  38.  
  39.    If you have any questions or comments, please feel free to call my
  40.    RCP/M at (312) 386-9271.
  41.  
  42.                                                   Thank you,
  43.  
  44.  
  45.                                                   Cyrus Patel
  46.                                           SYSOP - The Master Silicone
  47.    Version 1.1  (01/06/86)
  48.            Added Wheel check and NULU support (Wheel set), changed
  49.            to KMD for transfers, LDIR for faster DIR support, Q option
  50.            for easier quit...
  51.                                                   Norman Beeler
  52.                                                   Sysop
  53.                                                   ZeeMachine
  54.                                                   408-245-1420
  55.  
  56. }
  57.  
  58.    Const
  59.       Version = '1.0';
  60.       CommandLineLocation = $FF00;
  61.  
  62.    Type
  63.       String14 = String [14];
  64.       String80 = String [80];
  65.  
  66.    Var
  67.       CommandLine: String80;
  68.       LBRName, FileName: String14;
  69.       MemTop: Integer Absolute $6;
  70.       Wheel: Byte Absolute $4B;
  71.  
  72.    Procedure Instructions;
  73.  
  74.       Begin
  75.          WriteLn;
  76.          Write('Usage: LUP Filename[.LBR]');
  77.          Halt
  78.       End;
  79.  
  80.  
  81.    Procedure GetLBRName(Var LBRName: String14);
  82.  
  83.       Var
  84.          InFile: File;
  85.          Index: Integer;
  86.          CommandLine: String14 Absolute $80;
  87.  
  88.       Begin
  89.          If CommandLine = '' then
  90.             Instructions
  91.          else
  92.             LBRName := Copy(CommandLine, 2, Length(CommandLine));
  93.          If (LBRName <> '') and (Pos('.', LBRName) > 0) then
  94.             LBRName := Copy(LBRName, 1, Pos('.', LBRName) - 1);
  95.          If LBRName = '' then
  96.             Instructions;
  97.          For Index := 1 to Length(LBRName) do
  98.             LBRName[Index] := UpCase(LBRName[Index]);
  99.          LBRName := LBRName + '.LBR';
  100.          Assign(InFile, LBRName);
  101.          {$I-}
  102.          Reset(InFile);
  103.          If IOResult <> 0 then
  104.             Begin
  105.             WriteLn;
  106.             WriteLn('File: ', LBRName, ' does not exist.');
  107.             Close(InFile);
  108.             Instructions
  109.             End;
  110.          Close(InFile);
  111.          {$I+}
  112.          WriteLn
  113.       End;
  114.  
  115.  
  116.    Procedure PutOnCommandLine(Line: String80);
  117.  
  118.       Var
  119.          Index: Integer;
  120.  
  121.       Begin
  122.          Line := Line + ';A0:LUP ' + LBRName;
  123.          Mem[CommandLineLocation] := 4;
  124.          Mem[CommandLineLocation + 1] := $FF;
  125.          Mem[CommandLineLocation + 2] := $C8;
  126.          Mem[CommandLineLocation + 3] := Length(Line);
  127.          For Index := 1 to Length(Line) do
  128.             Mem[CommandLineLocation + Index + 3] := Ord(Line[Index]);
  129.          Mem[CommandLineLocation + Length(Line) + 4] := $00;
  130.          Mem[CommandLineLocation + Length(Line) + 5] := $00
  131.       End;
  132.  
  133.  
  134.    Procedure Help;
  135.  
  136.       Begin
  137.          WriteLn;
  138.          WriteLn('': 22, 'LUP (Library Utility in Pascal)');
  139.          WriteLn;
  140.          WriteLn('': 16, '  BYE - Logoff computer.');
  141.          WriteLn('': 16, '  DIR - Directory of library.');
  142.          WriteLn('': 16, 'FILES - Get list of library files.');
  143.          WriteLn('': 16, ' HELP - This list.');
  144.          WriteLn('': 16, '  LUP - Get library of another file.');
  145.          WriteLn('': 16, '           LUP Filename[.LBR]');
  146.          WriteLn('': 16, '    Q - Exit LUP.');
  147.          WriteLn('': 16, ' QUIT - Exit LUP.');
  148.          WriteLn('': 16, '    S - Send file with KMD (128 byte block).');
  149.          WriteLn('': 16, '           S Filename.typ');
  150.          WriteLn('': 16, ' SEND - Send file with KMD (128 byte block).');
  151.          WriteLn('': 16, '           Send Filename.typ');
  152.          WriteLn('': 16, '   SK - Send file with KMD (1K byte block).');
  153.          WriteLn('': 16, '           SK Filename.typ');
  154.          WriteLn('': 16, 'SENDK - Send file with KMD (1K byte block).');
  155.          WriteLn('': 16, '           SendK Filename.typ');
  156.          WriteLn('': 16, ' TYPE - Type a file from library.');
  157.          WriteLn('': 16, '           Type Filename.typ');
  158.          If Wheel > 0 then
  159.          Begin
  160.               WriteLn('': 16, '   -L - Enter NULU Command mode and List files.');
  161.               WriteLn('': 16, '   -F - Enter NULU Sweep mode.')
  162.          End;
  163.               WriteLn;
  164.          CommandLine := ''
  165.       End;
  166.  
  167.  
  168.    Procedure GetCommand;
  169.  
  170.       Var
  171.          Index: Integer;
  172.  
  173.       Begin
  174.          Write('LUP: [' + LBRName + ']>');
  175.          ReadLn(CommandLine);
  176.          If Pos(' ', CommandLine) > 0 then
  177.             Begin
  178.             FileName := Copy(CommandLine, Pos(' ', CommandLine),
  179.                              Length(CommandLine));
  180.             For Index := 1 to Length(FileName) do
  181.                FileName[Index] := UpCase(FileName[Index]);
  182.             CommandLine := Copy(CommandLine, 1, Pos(' ', CommandLine) - 1)
  183.             End
  184.          else
  185.             FileName := '';
  186.          For Index := 1 to Length(CommandLine) do
  187.             CommandLine[Index] := UpCase(CommandLine[Index])
  188.       End;
  189.  
  190.  
  191.    Procedure ProcessCommand;
  192.  
  193.       Begin
  194.          If CommandLine = 'BYE' then
  195.             CommandLine := 'A0:BYE'
  196.          else If CommandLine = 'DIR' then
  197.             CommandLine := 'A0:LDIR ' + LBRName
  198.          else If CommandLine = 'FILES' then
  199.             CommandLine := 'A0:DIR *.LBR'
  200.          else If (CommandLine = 'HELP') or (CommandLine = '?') then
  201.             Help
  202.          else If CommandLine = 'LUP' then
  203.             CommandLine := 'A0:LUP' + FileName
  204.          else If (CommandLine = 'QUIT') or (CommandLine = 'Q') then
  205.             Halt
  206.          else If (CommandLine = 'S') or (CommandLine = 'SEND') then
  207.             CommandLine := 'A0:KMD L ' + LBRName + FileName
  208.          else If (CommandLine = 'SK') or (CommandLine = 'SENDK') then
  209.             CommandLine := 'A0:KMD LK ' + LBRName + FileName
  210.          else If CommandLine = 'TYPE' then
  211.             CommandLine := 'A0:TYPE ' + LBRName + FileName
  212.          else If (CommandLine = '-F') and (Wheel > 0) then
  213.             CommandLine := 'NULU ' + LBRName + ' -F '
  214.          else If (CommandLine = '-L') and (Wheel > 0) then
  215.             CommandLine := 'NULU ' + LBRName + ' -L '
  216.          else If CommandLine <> '' then
  217.             Begin
  218.             WriteLn;
  219.             CommandLine := '';
  220.             WriteLn('Invalid command, type ? for help, QUIT to exit.');
  221.             WriteLn
  222.             End
  223.       End;
  224.  
  225.    Begin
  226.       StackPtr := MemTop - $826;
  227.       RecurPtr := StackPtr - $400;
  228.       HeapPtr := $300F;
  229.       GetLBRName(LBRName);
  230.       Repeat
  231.          GetCommand;
  232.          ProcessCommand
  233.       Until CommandLine <> '';
  234.       PutOnCommandLine(CommandLine)
  235.    End.
  236.