home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c005 / 4.ddi / C / MMTOTAL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1987-04-13  |  1.3 KB  |  52 lines

  1. /**
  2. *
  3. * Name        mmtotal -- Report total installed memory on IBM hardware.
  4. *
  5. * Synopsis    ext_mem = mmtotal(pmain_mem);
  6. *
  7. *        int ext_mem      Amount of extended memory (in 1024-byte
  8. *                  units)
  9. *        int *pmain_mem      Returned amount of main memory (in
  10. *                  1024-byte units)
  11. *
  12. * Description    MMTOTAL reports how much memory is installed on an
  13. *        IBM-compatible computer.
  14. *
  15. *        The value returned as ext_mem can only be nonzero on an
  16. *        IBM PC-AT (or compatible) with extended memory.
  17. *
  18. * Returns    ext_mem       Amount of extended memory (in 1024-byte
  19. *                  units)
  20. *        *pmain_mem      Amount of main memory (in 1024-byte units)
  21. *
  22. * Version    3.0  (C)Copyright Blaise Computing Inc.  1986
  23. *
  24. * Version    3.02 March 24, 1987
  25. *        Removed a strong typing warning (no change in object
  26. *            code).
  27. *
  28. **/
  29.  
  30. #include <bmemory.h>
  31. #include <bquery.h>
  32.  
  33. int mmtotal(pmain_mem)
  34. int *pmain_mem;
  35. {
  36.     int ax,bx,cx,dx,flags;
  37.     int ext_mem;
  38.                       /* Get amount of main memory    */
  39.     bios(18,pmain_mem,&bx,&cx,&dx,&flags);
  40.  
  41.     if (qymodel() == IBM_AT)
  42.     {
  43.     ax = (int) 0x8800;          /* Get amount of extended       */
  44.     bios(21,&ax,&bx,&cx,&dx,&flags);    /* memory              */
  45.     ext_mem = ax;
  46.     }
  47.     else                  /* Not an AT:              */
  48.     ext_mem = 0;              /* no extended memory.          */
  49.  
  50.     return ext_mem;
  51. }
  52.