Пример #1
0
void get_mem_info( void )
/***********************/
{
#ifdef __OS2__
    ULONG       mem;

    DosMemAvail( &mem );
    techoutput( "\nAmount of free memory %ld bytes\n", (ULONG) mem );
#else
    union REGS          regs;
    unsigned long       mem;

    regs.h.ah = 0x88;
    int86( 0x15, &regs, &regs );
    techoutput( "\nAmount of extended memory is: %dK\n", regs.x.ax );
    int86( 0x12, &regs, &regs );
    techoutput( "Amount of base memory is: %dK\n", regs.x.ax );
    regs.h.ah = 0x48;
    regs.x.bx = 0xffff;
    int86( 0x21, &regs, &regs );
    if( regs.w.cflag != 0 ) {
        mem = regs.x.bx;
        mem *= 16;
        techoutput( "Amount of free base memory is: %l bytes\n", mem );
    }
#endif
}
Пример #2
0
        unsigned cdecl coreleft(void)
      #endif
        {
          unsigned long ul;

          DosMemAvail(&ul);

          if (ul < 0x10000L)
            ul = 0x10000L;    /* Lie, just in case we are using coreleft() as
                               * the basis for a malloc() call. OS/2 will make
                               * room for us if need be
                               */
          return(ul);
        }