home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1994 February / psl_9403.zip / psl_9403 / DOS / UT_SYSTM / HMA.ZIP / FREEXMS.C < prev    next >
C/C++ Source or Header  |  1993-06-29  |  1KB  |  44 lines

  1.  /*----------------------------------------------------------------
  2.    Report on DOS managed free space in HMA (unlike XMS managed
  3.    by HIMEM.SYS).
  4.  
  5.    When DOS 5/6 are loaded with DOS=HIGH, the DOS kernel
  6.    manages the "slack" space left over.  This little utility
  7.    reports on the amount of HMA space left over.  With
  8.    typical configurations this space will be in the 12-19K
  9.    range and is available for allocation by TSR's and device
  10.    drivers via the quasi-doc'd Int 2F fn 4A02 API documented 
  11.    in Kyle & Brown's PC Interrupts book.
  12.  
  13.    This utility reports on the free HMA available by using
  14.    the quasi-doc'd Int 2F fn 4A01 that reports on this memory.
  15.  ------------------------------------------------------------------
  16.  Compile me with TC or BC++ (small model)
  17.  ----------------------------------------------------------------*/
  18.  #include <dos.h>
  19.  #include <stdio.h>
  20.  
  21.  void _setenvp(void){} /* minimize EXE size */
  22.  void _setargv(void){} /* minimize EXE size */
  23.  
  24.  void main(void)
  25.    {
  26.    unsigned FreeHMA, es, di;
  27.  
  28.    _AX = 0x4A01;
  29.    geninterrupt(0x2F);
  30.    FreeHMA = _BX;
  31.    es = _ES;
  32.    di = _DI;
  33.  
  34.    if (FreeHMA)
  35.       {
  36.       printf("There are [%u] bytes available in the HMA\n", FreeHMA);
  37.       printf("HMA pointer is %04.2X:%04.2X\n", es, di);
  38.       }
  39.    else
  40.       {
  41.       printf("There's no room in the HMA, or DOS=LOW\n");
  42.       }
  43.    }
  44.