home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / pcmag / vol7n20.zip / MEMSIZE.PAS < prev    next >
Pascal/Delphi Source File  |  1988-07-15  |  784b  |  28 lines

  1. {$R+}
  2. PROGRAM MemSizeTest;
  3.  
  4.   FUNCTION MemSize : Integer;
  5.   TYPE
  6.     Regs = RECORD
  7.              AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags : Integer;
  8.            END;
  9.   VAR Registers : regs;
  10.   BEGIN
  11.     Intr($12, Registers);
  12.     MemSize := Registers.AX;
  13.   END;
  14.  
  15.   FUNCTION KAvail : Integer;
  16.   { We multiply the high and low bytes of MemAvail }
  17.   { separately in order to avoid problems when its }
  18.   { value is > 32767.  Turbo will treat an integer }
  19.   { > 32767 as a negative number, but bytes are    }
  20.   { always positive.                               }
  21.   BEGIN
  22.     KAvail := Trunc((Hi(MemAvail)*256.0+Lo(MemAvail))/64.0);
  23.   END;
  24.  
  25. BEGIN
  26.   WriteLn('TOTAL RAM installed is ', MemSize, 'K.');
  27.   WriteLn('TOTAL RAM available within this program is ', KAvail, 'K.');
  28. END.