home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / PASCAL / PARADIS1 / EXEHEAD.PAS < prev    next >
Pascal/Delphi Source File  |  1992-03-26  |  2KB  |  57 lines

  1. (4756)  Sun 22 Mar 92 11:12
  2. By: Joseph Crea
  3. To: Gerald Gutierrez
  4. Re: memory allocation woes
  5. St:
  6. ---------------------------------------------------------------------------
  7. @PID: QE 2.75
  8.   Gerald, here's that program for trimming the memory requirements of
  9. executable programs.  It's particualarly useful when you are using
  10. TASM and want to use DOS function $48 to control memory allocation
  11. yourself.  Enjoy.  (Written and tested under Turbo Pascal 5.0)
  12.  
  13. program trim_exe;
  14.  
  15. type  exeheader_rec = record
  16.                     exsignature  : word; { $5a4d }
  17.                     exExtraBytes : word;
  18.                     exPages      : word;
  19.                     exRelocItems : word;
  20.                     exHeaderSize : word;
  21.                     exMinAlloc   : word;
  22.                     exMaxAlloc   : word;
  23.                     exInitSS     : word;
  24.                     exCheckSum   : word;
  25.                     exInitIP     : word;
  26.                     exInitCP     : word;
  27.                     exRelocTable : word;
  28.                     exOverlay    : word;
  29.                   end;
  30.  
  31.  
  32. var
  33.    f : file of exeheader_rec;
  34.    x : exeheader_rec;
  35.  
  36. begin
  37.  
  38.   assign( f, paramstr(1) );
  39.   reset(f);
  40.   read(f, x);
  41.   if x.exsignature = $5A4D  then
  42.     begin
  43.       with x do
  44.         exmaxalloc := exminalloc;
  45.       reset(f);
  46.       write(f, x);
  47.     end;
  48.   close(f);
  49. end.
  50.  
  51.                                         Joe Crea
  52.  
  53. --- QuickBBS 2.76 (Gamma-1)
  54.  * Origin: 221B Baker Street * Panama City FL * 904-871-6536 (1:3608/3)
  55.  
  56. @PATH: 3608/1 123/19 396/1 170/400 512/0 1007 
  57.