home *** CD-ROM | disk | FTP | other *** search
- { I'm not sure if this is the version I posted elsewhere, but
- at any rate this program uses MS-DOS/PC-DOS calls to
- determine the disk/diskette allocation information for
- your disk drives.
-
- By itself, it's only useful to show the cluster sizes that
- your version of DOS establishes. However, you may find a
- use for portions of the code within your own programs in
- order to determine allocation data.
-
- Scavenge the code any way you like. }
-
- Program AllocationTableInformation;
- Type
- DOSRegs = record
- Case Integer of
- 0: (ax, bx, cx, dx, bp, si, di, ds, es, Flags : Integer);
- 1: (al, ah, bl, bh, cl, ch, dl, dh : Byte );
- End;
- Var
- Registers : DOSRegs;
- ClusterSize : Real;
- DiskSize : Real;
-
- Begin
- LowVideo;
- ClrScr;
-
- Fillchar (Registers, sizeof(DOSRegs), 00);
- Registers.AH := $30;
- Registers.DS := DSeg;
- MsDOS (registers);
-
- If Registers.AL = 0 then
- Begin
- Writeln; Writeln;
- Writeln ('Sorry, this pgm. only works with DOS 2.0 or higher');
- Writeln; Writeln;
- Halt;
- End;
-
- Fillchar (Registers, sizeof(DOSRegs), 00);
- Registers.AH := $1B;
- Registers.DS := DSeg;
- MsDOS (registers);
- Writeln; Writeln;
- Writeln ('':10, 'Allocation Table Information, Default Drive:');
- Writeln;
-
- With Registers Do
- Begin
- Writeln ('# of clusters on disk..........', DX : 5);
- Writeln ('Sectors per cluster............', AL : 5);
- Writeln ('Sector size (bytes)............', CX : 5);
- Writeln;
- ClusterSize := (AL * CX);
- DiskSize := (ClusterSize * DX);
- Writeln ('Size of each cluster...........', ClusterSize:10:0);
- Writeln ('Total disk space...............', DiskSize :10:0);
- End;
-
- Writeln; Writeln;
- Writeln; Writeln;
- End.
-