home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / windows / infop141.zip / PAGE_03.PAS < prev    next >
Pascal/Delphi Source File  |  1990-12-08  |  9KB  |  312 lines

  1. procedure page_03;
  2. type
  3.   string2 = string[2];
  4.  
  5. const
  6.   EMMint = $67;
  7.   qEMMdrvr = 'EMMXXXX0';
  8.   EMMerrs : array [$80..$A4] of string[55] = (
  9.         {80} 'internal error in EMM software',
  10.              'malfunction in expanded memory hardware',
  11.              'memory manager busy',
  12.              'invalid handle',
  13.              'undefined function',
  14.              'no more handles available',
  15.              'error in save or restore of mapping context',
  16.              'not enough physical pages available',
  17.         {88} 'not enough free pages available',
  18.              'no pages requested',
  19.              'logical page outside range assigned to handle',
  20.              'invalid physical page number',
  21.              'page map hardware state save area full',
  22.              'mapping context already in save area',
  23.              'mapping context not in save area',
  24.              'undefined subfunction parameter',
  25.         {90} 'attribute type not defined',
  26.              'feature not supported',
  27.              'src & dest overlap;move done, but source overwritten',
  28.              'length for src or dest longer than allocated',
  29.              'conventional and EMS memory overlap',
  30.              'offset outside logical page',
  31.              'region length >1M',
  32.              'src & dest overlap;not moved',
  33.         {98} 'src & dest types undefined',
  34.              'unused erro code',
  35.              'Alt map or DMA supported, but specified set isn''t',
  36.              'Alt map or DMA supported, but all allocated',
  37.              'Alt map or DMA not suported, specified set <> 0',
  38.              'Alt map or DMA suported, specified set <> 0',
  39.              'Dedicated DMA channels not supported',
  40.              'Dedicated DMA channels supported, but not specified one',
  41.         {A0} 'No handle found for specified name',
  42.              'handle with same name already exists',
  43.              '???',
  44.              'invalid pointer passed, or contents of source corrupted',
  45.              'access to function denied');
  46.  
  47. var
  48.   EMMarray : array[$000..$3FF] of word;
  49.   xlong : longint;
  50.   xword1 : word;
  51.   xword2 : word;
  52.   numhandles: word;
  53.   xstring : string;
  54.   EMMver, j: byte;
  55.   EMMname: array[1..8] of char;
  56.   isdpmi: boolean;
  57.  
  58.   procedure EMMerr(a : byte);
  59.     begin
  60.     if (a >= $80) and (a <= $8F) then
  61.       Writeln(EMMerrs[a])
  62.     else
  63.       unknown('expanded memory error', a, 2)
  64.     end; {EMMerr}
  65.  
  66.   procedure showbcd(x: word);
  67.     var
  68.       c: char;
  69.  
  70.     begin
  71.     c:=Chr((x shr 12) + 48);
  72.     if c <> '0' then
  73.       Write(c);
  74.     Write(Chr(((x and $0F00) shr 8) + 48), decimal,
  75.       Chr(((x and $00F0) shr 4) + 48), Chr((x and $000F) + 48))
  76.     end; {showbcd}
  77.  
  78.   begin (* procedure page_03 *)
  79.   caption2('Total conventional memory (bytes)  ');
  80.   Writeln(DOSmem: 6, ' (', DOSmem div 1024, 'K)');
  81.   caption2('Free conventional memory (bytes)   ');
  82.   xlong:=DOSmem - (longint(PrefixSeg) shl 4);
  83.   Writeln(xlong: 6, ' (', xlong div 1024, 'K)');
  84.   caption2('Extended memory (from BIOS call) ');
  85.   with regs do begin
  86.     AH:=$88;
  87.     intr($15, regs);
  88.     if nocarry then
  89.       writeln(longint(AX) shl 10: 8, ' (', (longint(AX) shl 10) div 1024, 'K)')
  90.     else
  91.       writeln('     N/A')
  92.   end;
  93.   caption2('XMS driver present ');
  94.   with regs do
  95.     begin
  96.     AX:=$4300;
  97.     Intr($2F, regs);
  98.     if AL <> $80 then
  99.       Writeln('no')
  100.     else
  101.       begin
  102.       Writeln('yes');
  103.       AX:=$4310;
  104.       Intr($2F, regs);
  105.       xlong:=longint(ES) shl 16 + BX;
  106.       caption3('XMS version');
  107.       AX:=0;
  108.       longcall(xlong, regs);
  109.       if AX <> 0 then
  110.         begin
  111.         showbcd(AX);
  112.         caption3('XMM version');
  113.         showbcd(BX);
  114.         caption3('HMA');
  115.         yesorno2(DX = 1);
  116.         end
  117.       else
  118.         Write('ERROR');
  119.       caption3('A20 is');
  120.       AX:=$0700;
  121.       longcall(xlong, regs);
  122.       if (AX <> 0) or ((AX = 0) and (BL = 0)) then
  123.         case AX of
  124.           0: Writeln('disabled');
  125.           1: Writeln('enabled');
  126.         else
  127.           Writeln('unknown');
  128.         end
  129.       else
  130.         Writeln('ERROR');
  131.       caption3('Total free XMS memory');
  132.       AX:=$0800;
  133.       longcall(xlong, regs);
  134.       if (AX <> 0) or ((AX = 0) and ((BL = 0) or (BL = $A0))) then
  135.         begin
  136.         Write(DX, 'K');
  137.         caption3('Largest available block');
  138.         Writeln(AX, 'K');
  139.         end
  140.       else
  141.         Writeln('ERROR');
  142.       end
  143.     end;
  144.   isdpmi:=false;
  145.   caption2('DPMI driver present');
  146.   with regs do
  147.     begin
  148.     AX:=$1687;
  149.     Intr($2F, regs);
  150.     if AX <> 0 then
  151.       Writeln('no')
  152.     else
  153.       begin
  154.       Writeln('yes');
  155.       isdpmi:=true;
  156.       caption3('version');
  157.       Write(DH, decimal, DL);
  158.       caption3('CPU');
  159.       case CL of
  160.         2: Write('286');
  161.         3: Write('386');
  162.         4: Write('486')
  163.       else
  164.         Write('???')
  165.       end;
  166.       caption3('switch mode entry');
  167.       segofs(ES, DI);
  168.       Writeln
  169.       end
  170.     end;
  171.   caption2('Expanded memory');
  172.   if longint(intvec[EMMint]) <> $00000000 then
  173.     begin
  174.     writeln;
  175.     caption3('Interrupt vector');
  176.     xlong:=longint(intvec[EMMint]);
  177.     xword1:=xlong shr 16;
  178.     xword2:=xlong and $0000FFFF;
  179.     segofs(xword1, xword2);
  180.     writeln;
  181.     caption3('Driver');
  182.     xstring:='';
  183.     for i:=$000A to $0011 do
  184.       xstring:=xstring + showchar(chr(mem[xword1 : i]));
  185.     write(xstring);
  186.     if xstring = qEMMdrvr then
  187.       begin
  188.       caption3('status');
  189.       with regs do
  190.         begin
  191.         AH:=$40;
  192.         intr(EMMint, regs);
  193.         if AH = $00 then
  194.           writeln('available')
  195.         else
  196.           EMMerr(AH);
  197.         caption3('EMM version');
  198.         AH:=$46;
  199.         intr(EMMint, regs);
  200.         if AH = $00 then
  201.           writeln(AL shr 4, decimal, AL and $0F)
  202.         else
  203.           EMMerr(AH);
  204.         EMMver:=AL shr 4;
  205.         caption3('Page frame segment');
  206.         AH:=$41;
  207.         intr(EMMint, regs);
  208.         if AH = $00 then
  209.           writeln(hex(BX, 4))
  210.         else
  211.           EMMerr(AH);
  212.         caption3('Total EMS memory');
  213.         AH:=$42;
  214.         intr(EMMint, regs);
  215.         if AH = $00 then
  216.           begin
  217.           write(longint(16) * DX, 'K');
  218.           caption3('available');
  219.           if AH = $00 then
  220.             writeln(longint(16) * BX, 'K')
  221.           else
  222.             EMMerr(AH)
  223.           end
  224.         else
  225.           EMMerr(AH);
  226.         if EMMver >= 4 then
  227.           begin
  228.           caption3('VCPI capable');
  229.           {skip VCPI if DPMI found, DPMI takes precedence over VCPI}
  230.           if not isdpmi then
  231.             begin
  232.             {must make sure 1 page is allocated to be sure that EMS}
  233.             {driver is ON. VCPI is not detectable if EMS driver is OFF}
  234.             {16K of EMS needed for this test to work properly}
  235.             AH:=$43;
  236.             BX:=1;
  237.             Intr(EMMint, regs);
  238.             if AH <> 0 then
  239.               Writeln('error: need 16K available EMS to detect')
  240.             else
  241.               begin
  242.               xword1:=DX; {handle}
  243.               AX:=$DE00;
  244.               Intr(EMMint, regs);
  245.               if AH <> 0 then
  246.                 Writeln('no')
  247.               else
  248.                 begin
  249.                 Write('yes');
  250.                 caption3('VCPI version');
  251.                 Writeln(BH, decimal, BL);
  252.                 end;
  253.               AH:=$45; {release our handle}
  254.               DX:=xword1;
  255.               Intr(EMMint, regs)
  256.               end
  257.             end
  258.           else
  259.             Writeln('no');
  260.           end;
  261.         caption1('  Handle   Size  Name');
  262.         Writeln;
  263.         AH:=$4D;
  264.         ES:=seg(EMMarray);
  265.         DI:=ofs(EMMarray);
  266.         Intr(EMMint, regs);
  267.         if AH = $00 then
  268.           if BX > $0000 then
  269.             begin
  270.             window(3, wherey + hi(windmin), twidth, tlength - 2);
  271.             numhandles:=BX;
  272.             for i:=1 to numhandles do
  273.               begin
  274.               pause2;
  275.               if endit then
  276.                 Exit;
  277.               xlong:=longint(16) * EMMarray[2 * i - 1];
  278.               if xlong > 0 then
  279.                 begin
  280.                 write(hex(EMMarray[2 * i - 2], 4), '   ', xlong:5, 'K  ');
  281.                 if EMMver >= 4 then
  282.                   begin
  283.                   AX:=$5300;
  284.                   DX:=EMMarray[2 * i - 2];
  285.                   ES:=Seg(EMMname);
  286.                   DI:=Ofs(EMMname);
  287.                   Intr(EMMint, regs);
  288.                   if AH = 0 then
  289.                     for j:=1 to 8 do
  290.                       if EMMname[j] <> #0 then
  291.                         Write(EMMname[j]);
  292.                   end;
  293.                 Writeln;
  294.                 end
  295.               end
  296.             end
  297.           else
  298.             writeln('  (no active handles)')
  299.         else
  300.           EMMerr(AH)
  301.         end
  302.       end
  303.     else
  304.       begin
  305.       Writeln;
  306.       dontknow
  307.       end
  308.     end
  309.   else
  310.     writeln('(none)')
  311.   end;
  312.