home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / zcpr33 / s-z / showtype.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-07-13  |  3.5 KB  |  119 lines

  1. program showtype;
  2.  
  3. { 4/10/88 - Al Heynneman, creation date
  4.  
  5.             70110,611 on CompuServe
  6.             HEYNNEMAN on Genie
  7.             CL0798 on the Source
  8.  
  9.             NOTE: Also download my Z3INS version 1.5 if you
  10.                   are still running ZCPR30 and wish to use the
  11.                   newer ZCPR33 utilities.
  12. }
  13.  
  14. const version  = '1.0';
  15.  
  16. type   z3header = record
  17.                     jump_type   : byte;
  18.                     filler1     : byte;
  19.                     filler2     : byte;
  20.                     z3env       : array[1..5] of byte;
  21.                     env_type    : byte;
  22.                     filler3     : array[1..119] of byte; {make it 128 bytes}
  23.                   end;
  24.  
  25. var    comfile  : file;
  26.        header   : z3header;
  27.        IOstatus : integer;
  28.  
  29. begin
  30.   if (paramcount =0) or (paramstr(1) = '//') then
  31.   begin
  32.     clrscr;
  33.     writeln('SHOW_TYPE Version ',version);
  34.     writeln;
  35.     writeln('Displays ZCPR compatibility information for a selected .COM file.');
  36.     writeln;
  37.     writeln('ZCPR30 type programs need to be installed with Z3INS or Z-RIP to');
  38.     writeln('run under ZCPR30.');
  39.     writeln;
  40.     writeln('ZCPR33 type programs do not need installation to run under ZCPR33,');
  41.     writeln('but require installation with Z3INS version 1.5 to run under ZCPR30.');
  42.     writeln('The bell will ring when a ZCPR33 compatible file is found.  This is');
  43.     writeln('useful when performing a search like "W SHOWTYPE *.COM" using the');
  44.     writeln('W20 shell to find all ZCPR33 .COM programs.');
  45.     writeln;
  46.     writeln('syntax : showtype');
  47.     writeln('         showtype //');
  48.     writeln('         showtype <filename> [/options]');
  49.     writeln('options:');
  50.     writeln('         B = disable the bell when a ZCPR33 type file is found.');
  51.     writeln('         D = debug mode, print bytes that we use in SHOW_TYPE.');
  52.     exit;
  53.   end;
  54.  
  55.   if (pos('COM',paramstr(1)) = 0) then
  56.   begin
  57.     writeln;
  58.     writeln(paramstr(1),' is not a .COM file, try again.');
  59.     exit;
  60.   end;
  61.  
  62.   assign(comfile,paramstr(1));
  63.   {$I-}
  64.   reset(comfile);
  65.   {$I+}
  66.   IOstatus := IOresult;
  67.   if not (IOstatus = 0) then
  68.     begin
  69.       close(comfile);
  70.       writeln;
  71.       if (IOstatus = 1) then
  72.         writeln(paramstr(1),' file not found.')
  73.         else
  74.         writeln('SHOW_TYPE abort, IOerror # ',IOstatus);
  75.       exit;
  76.     end;
  77.  
  78.   blockread(comfile,header,1); {read 1 128 block}
  79.  
  80.   writeln;
  81.  
  82.   if (pos('D',paramstr(2)) <> 0) then
  83.   begin
  84.     writeln('jump byte value is ',header.jump_type);
  85.     writeln('z3env byte[1] is ',header.z3env[1]);
  86.     writeln('z3env byte[2] is ',header.z3env[2]);
  87.     writeln('z3env byte[3] is ',header.z3env[3]);
  88.     writeln('z3env byte[4] is ',header.z3env[4]);
  89.     writeln('z3env byte[5] is ',header.z3env[5]);
  90.     writeln('environment byte is ',header.env_type);
  91.     writeln;
  92.   end;
  93.  
  94.   if (header.z3env[1] = 90) and
  95.      (header.z3env[2] = 51) and
  96.      (header.z3env[3] = 69) and
  97.      (header.z3env[4] = 78) and
  98.      (header.z3env[5] = 86) then
  99.   begin
  100.     if (header.jump_type = 24) then
  101.     begin
  102.       writeln(paramstr(1),' is a ZCPR33 compatible program.');
  103.       if not (pos('B',paramstr(2)) <> 0) then write(chr(7));
  104.     end;
  105.     if (header.jump_type = 195) then
  106.     begin
  107.       writeln(paramstr(1),' is a ZCPR30 compatible program.');
  108.     end;
  109.   end
  110.  
  111.   else
  112.  
  113.   begin
  114.     writeln(paramstr(1),' is not a ZCPR program.');
  115.     exit;
  116.   end;
  117.  
  118.   close(comfile);
  119. end.