home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / i / ifp1s156.zip / PAGE_13.PAS < prev    next >
Pascal/Delphi Source File  |  1992-12-30  |  6KB  |  255 lines

  1. unit page_13;
  2.  
  3. interface
  4.  
  5. uses crt, dos, ifpglobl, ifpcomon;
  6.  
  7. procedure page13;
  8.  
  9. implementation
  10.  
  11. procedure page13;
  12. type
  13.   iotbltype = record
  14.                 spclfunc: byte;
  15.                 devtype: byte;
  16.                 devattr: word;
  17.                 cylcount: word;
  18.                 medtype: byte;
  19.                 bpsec: word;
  20.                 secpclus: byte;
  21.                 resvsec: word;
  22.                 fats: byte;
  23.                 rootentries: word;
  24.                 numsecs: word;
  25.                 meddescr: byte;
  26.                 secpfat: word;
  27.                 secptrk: word;
  28.                 numheads: word;
  29.                 numhidden: longint;
  30.                 largesec: longint;
  31.                 reserved: array[$19..$1E] of byte;
  32.               end;
  33.  
  34. var
  35.   i : $00..$2B;
  36.   xbyte : byte;
  37.   xchar : char;
  38.   xFCB : array[$00..$2B] of byte;
  39.   xlong : longint;
  40.   xstring : string;
  41.   xword1 : word;
  42.   xword2 : word;
  43.   xword3, xword4, xword5: word;
  44.   iotable: iotbltype;
  45.   saveX, saveY: byte;
  46.  
  47.   begin
  48.   Caption2('LASTDRIVE');
  49.   if osmajor >= 20 then
  50.     DrvName(lastdrv)
  51.   else
  52.     DrvName(lastdrv - 1);
  53.   Writeln;
  54.   Caption2('Logical drives');
  55.   with regs do
  56.     begin
  57.     for xchar:='A' to 'Z' do
  58.       begin
  59.       AH:=$0E;
  60.       DL:=ord(xchar) - ord('A');
  61.       MSDOS(regs);
  62.       AH:=$19;
  63.       MSDOS(regs);
  64.       if AL = DL then
  65.         drvname(AL)
  66.       end;
  67.     Writeln;
  68.     AH:=$0E;
  69.     DL:=currdrv;
  70.     MSDOS(regs)
  71.     end;
  72.   Caption2('Diskette drives');
  73.   if equip and $0001 = $0001 then
  74.     Writeln(1 + equip and $00C0 shr 6)
  75.   else
  76.     Writeln(0);
  77.   xword1:=longint(intvec[$1E]) shr 16;
  78.   xword2:=longint(intvec[$1E]) and $0000FFFF;
  79.   Caption3('Sectors/track');
  80.   Writeln(Mem[xword1 : xword2 + 4]);
  81.   Caption3('Bytes/sector');
  82.   Writeln(Mem[xword1 : xword2 + 3] shl 8);
  83.   Caption3('On time (ms)');
  84.   Writeln(125 * Mem[xword1 : xword2 + 10]);
  85.   Caption3('Off time (s)');
  86.   Writeln(longint(Mem[xword1 : xword2 + 2]) shl 16 / tick1:0:1);
  87.   Caption3('Head settle time (ms)');
  88.   Writeln(Mem[xword1 : xword2 + 9]);
  89.   if 1 + ((equip and $00C0) shr 6) = 1 then
  90.     begin
  91.     Caption1('  Single drive is now ');
  92.     xbyte:=Mem[BIOSdseg : $0104];
  93.     if xbyte <= ord('Z') - ord('A') then
  94.       begin
  95.       drvname(xbyte);
  96.       Writeln
  97.       end
  98.     else
  99.       if xbyte = $FF then
  100.         Writeln('N/A')
  101.       else
  102.         unknown('status', xbyte, 2);
  103.     end;
  104. (*  Byte 12:12 p.178  *)
  105.   Caption2('Current drive and path');
  106.   GetDir(0, xstring);
  107.   Writeln(xstring);
  108.   with regs do
  109.     begin
  110.     AH:=$52;
  111.     MsDos(regs);
  112.     if (osmajor = 3) and (osminor = 0) then
  113.       begin
  114.       xword1:=MemW[ES:BX + $19];
  115.       xword2:=MemW[ES:BX + $17]
  116.       end
  117.     else
  118.       begin
  119.       xword1:=MemW[ES:BX + $18];
  120.       xword2:=MemW[ES:BX + $16]
  121.       end;
  122.     if (osmajor >= 4) and (osmajor < 10) then
  123.       xword5:=$58
  124.     else
  125.       xword5:=$51;
  126.     if not ((xword1 = $FFFF) and (xword2 = $FFFF)) then
  127.       begin
  128.       xword3:=xword2 + (xword5 * currdrv);
  129.       Caption3('Drive type is');
  130.       case MemW[xword1:xword3 + $43] shr 14 of
  131.         0: Writeln('invalid');
  132.         1: Writeln('physical');
  133.         2: Writeln('network');
  134.         3: Writeln('Installable File System')
  135.       end;
  136.       if (osmajor >= 4) or ((osmajor = 3) and (osminor >= 20)) then
  137.         with regs do
  138.           begin
  139.           AH:=$44;
  140.           AL:=$0D;
  141.           BL:=0;
  142.           CH:=8;
  143.           CL:=$60;
  144.           DS:=Seg(iotable);
  145.           DX:=Ofs(iotable);
  146.           MsDos(regs);
  147.           if Flags and FCarry = 0 then
  148.             with iotable do
  149.               begin
  150.               Caption3('removable');
  151.               if devattr and 1 = 0 then
  152.                 Write('yes')
  153.               else
  154.                 Write('no');
  155.               Caption3('door lock');
  156.               yesorno(devattr and 2 = 2);
  157.               end
  158.           end;
  159.       Caption3('JOIN''d ');
  160.       if MemW[xword1:xword3 + $43] and $2000 = $2000 then
  161.         begin
  162.         Write('yes');
  163.         Caption3('actually');
  164.         xword4:=xword3;
  165.         while Mem[xword1:xword4] <> 0 do
  166.           begin
  167.           Write(Chr(Mem[xword1:xword4]));
  168.           Inc(xword4)
  169.           end;
  170.         Writeln;
  171.         end
  172.       else
  173.         Writeln('no');
  174.       Caption3('SUBST''d');
  175.       if MemW[xword1:xword3 + $43] and $1000 = $1000 then
  176.         begin
  177.         Write('yes');
  178.         Caption3('actually');
  179.         xword4:=xword3;
  180.         while Mem[xword1:xword4] <> 0 do
  181.           begin
  182.           Write(Chr(Mem[xword1:xword4]));
  183.           Inc(xword4)
  184.           end;
  185.         Writeln;
  186.         end
  187.       else
  188.         Writeln('no')
  189.       end;
  190.     end;
  191.   Caption3('Volume label');
  192.   for i:=$00 to $2B do
  193.     xFCB[i]:=$00;
  194.   xFCB[$00]:=$FF;         (* extended FCB *)
  195.   xFCB[$06]:=$08;         (* volume ID attribute *)
  196.   for i:=$08 to $12 do
  197.     xFCB[i]:=ord('?');
  198.   with regs do
  199.     begin
  200.     AH:=$11;
  201.     DS:=seg(xFCB);
  202.     DX:=ofs(xFCB);
  203.     MSDOS(regs);
  204.     case AL of
  205.       $00 : begin
  206.             AH:=$2F;
  207.             MSDOS(regs);
  208.             i:=$08;
  209.             xchar:=char(Mem[ES : BX + i]);
  210.             while (i <= $12) and (xchar > #0) do
  211.               begin
  212.               Write(showchar(xchar));
  213.               inc(i);
  214.               xchar:=char(Mem[ES : BX + i])
  215.               end;
  216.             Writeln
  217.             end;
  218.       $FF : Writeln('(none)')
  219.     else
  220.       unknown('status', AL, 2)
  221.     end {case}
  222.     end;
  223.   with regs do
  224.     begin
  225.     saveX:=WhereX;
  226.     saveY:=WhereY;
  227.     TextColor(LightRed+Blink);
  228.     Write('  *retrieving information*');
  229.     AH:=$1B;
  230.     MSDOS(regs);
  231.     GotoXY(saveX, saveY);
  232.     Write('                          ');
  233.     GotoXY(saveX, saveY);
  234.     media(Mem[DS : BX], AL);
  235.     Caption3('Clusters');
  236.     Writeln(DX);
  237.     Caption3('Sectors/cluster');
  238.     Writeln(AL);
  239.     Caption3('Bytes/sector');
  240.     Writeln(CX)
  241.     end;
  242.   Caption3('Total space (bytes)');
  243.   xlong:=disksize(0);
  244.   if xlong <> -1 then
  245.     Writeln(xlong:9, ' (', (xlong / 1024.0):9:0, 'K)')
  246.   else
  247.     Writeln('(invalid drive)');
  248.   Caption3('Free space (bytes) ');
  249.   xlong:=diskfree(0);
  250.   if xlong <> -1 then
  251.     Write(xlong:9, ' (', (xlong / 1024.0):9:0, 'K)')
  252.   else
  253.     Write('(invalid drive)')
  254. end;
  255. end.