home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / MEM428.ZIP / MEMBIOS.C < prev    next >
C/C++ Source or Header  |  1992-04-28  |  1KB  |  46 lines

  1. /****************************************************************************
  2.  
  3.     MemBios.C - Module to display BIOS extended memory available
  4.  
  5.     This module queries and reports the number of bytes of Extended
  6.     memory that the BIOS INT 15, Function 88 reports.
  7.  
  8.     Note that this program should be run only when no memory
  9.     manager is present.  It should also not be run in an OS/2 VDM.
  10.  
  11.     history
  12.     04-28-92 ras - CR P920026, initial entry
  13.  
  14. ****************************************************************************/
  15. #include <dos.h>            // DOS general defines
  16. #include <stdlib.h>            // standard functions
  17. #include <stdio.h>            // standard i/o
  18.  
  19. // start function
  20. int    main( )
  21.     
  22.   {    // define automatics
  23.     union    REGS    Regs;            // intdos regs
  24.  
  25.     // ask BIOS for extended memory count
  26.     // using INT 15, function 88
  27.     // which returns kb available in ax
  28.     Regs.x.ax = 0x8800;
  29.     int86( 0x15, &Regs, &Regs );
  30.  
  31.     // display result
  32.     if ( Regs.x.ax == 0 )
  33.     {   // none available, warn
  34.         printf( "\nNo extended memory available, remove any" );
  35.         printf( "\nDOS Memory Managers and try again." );
  36.     }
  37.     else
  38.     {   // got some memory reported, display it
  39.         printf( "\nINT 15, function 88 reports Extended Memory: %ld", 
  40.             (unsigned long) Regs.x.ax * 1024 );
  41.     }
  42.  
  43.     // exit to caller
  44.     return( 0 );
  45.   }
  46.