Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
SYSINFO.PAS
◄Example► ◄Contents► ◄Index► ◄Back►
PROGRAM sysinfo;
{ SYSINFO.PAS demonstrates the use of interrupt calls to DOS and the ROM
BIOS, including the following:
Intr MsDos RunError
This short program determines total RAM installed on a machine, total
RAM available, total space on the current drive, and total available
space on the current drive. Any errors on the DOS interrupt are
handled by RunError.
}
USES
Dos;
CONST
program_name = 'SYSINFO ';
program_desc = ' demonstrates the use of interrupt calls.';
int_memory = $12;
fnc_freedsk = $36;
VAR
regs : Registers;
Mem : LongInt;
disk : LongInt;
Size : LongInt;
BEGIN
Writeln( program_name, program_desc );
Writeln;
{ Make call to ROM BIOS memory function. }
Intr( int_memory, regs );
{ Get number of kilobytes of memory installed. }
Mem := regs.AX;
{ Calculate bytes of memory installed. }
Size := Mem * $0400;
Write( 'Total memory : ' );
Writeln( Size );
{ Get bytes of memory available. }
Size := MemAvail;
Write( 'Available memory : ' );
Writeln( Size );
{ Call DOS function to get current disk information and check for
error returned in AX.
}
regs.AH := fnc_freedsk;
regs.DL := 0;
MsDos( regs );
IF( regs.AX = $FFFF ) THEN
BEGIN
Writeln( 'Error in DOS call!' );
RunError( 1 );
END;
{ Calculate bytes per cluster on disk. }
disk := regs.CX * regs.AX;
{ Calculate total disk space. }
Size := disk * regs.DX;
Write( 'Total disk space : ' );
Writeln( Size );
{ Calculate available disk space. }
Size := disk * regs.BX;
Write( 'Available disk space: ' );
Writeln( Size );
END.