home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / patchldr.zip / MEMTEST.C < prev    next >
C/C++ Source or Header  |  1999-11-14  |  2KB  |  75 lines

  1. #include <stdio.h>
  2. #include "mem.h"
  3.  
  4. int main (int argc, char *argv[]) {
  5.     unsigned long size, size1;
  6.     static struct {
  7.         unsigned long cont;
  8.         unsigned long base;
  9.         unsigned long base1;
  10.         unsigned long len;
  11.         unsigned long len1;
  12.         unsigned long type;
  13.     } desc;
  14.     static struct {
  15.         unsigned short size;
  16.         unsigned long local, local16;
  17.         unsigned long system, system16;
  18.         unsigned long cacheable, cacheable16;
  19.         unsigned long nonsys, nonsys16;
  20.         unsigned short x1, x2;
  21.         unsigned long res;
  22.     } desc1;
  23.  
  24.     size = Int12();
  25.     printf ("Int12        returns: %ld KBytes\n", size);
  26.     size = Int1588();
  27.     if (size == -1)
  28.         printf ("Int15 (88)   returns: not supported\n");
  29.     else
  30.         printf ("Int15 (88)   returns: %ld KBytes above 1M\n", size);
  31.     size = Int158A();
  32.     if (size == -1)
  33.         printf ("Int15 (8A)   returns: not supported\n");
  34.     else
  35.         printf ("Int15 (8A)   returns: %ld KBytes above 1M\n", size);
  36.     size = Int15C7 (&desc1);
  37.     desc1.local     += desc1.local16;
  38.     desc1.system    += desc1.system16;
  39.     desc1.cacheable += desc1.cacheable16;
  40.     desc1.nonsys    += desc1.nonsys16;
  41.     if (size == -1)
  42.         printf ("Int15 (C7)   returns: not supported\n");
  43.     else {
  44.         printf ("Int15 (C7)   returns memory table:\n");
  45.         printf ("  local  memory: %ld KBytes above 1M\n", desc1.local);
  46.         printf ("  system memory: %ld KBytes above 1M\n", desc1.system);
  47.         printf ("  cacheable mem: %ld KBytes above 1M\n", desc1.cacheable);
  48.         printf ("  address space: %ld KBytes above 1M before non-system memory\n", desc1.nonsys);
  49.     }
  50.     size = Int15DA88();
  51.     if (size == -1)
  52.         printf ("Int15 (DA88) returns: not supported\n");
  53.     else
  54.         printf ("Int15 (DA88) returns: %ld KBytes above 1M\n", size);
  55.     size = Int15E801(0);
  56.     size1= Int15E801(1);
  57.     if (size == -1)
  58.         printf ("Int15 (E801) returns: not supported\n");
  59.     else
  60.         printf ("Int15 (E801) returns: %ld KBytes above 1M available\n                      %ld KBytes above 1M configured\n", size, size1);
  61.     printf ("Int15 (E820) returns memory list:\n");
  62.     desc.cont = 0;
  63.     do {
  64.         Int15E820 (&desc);
  65.         if (desc.type == 1)
  66.             printf ("  %8lu KBytes @ %lu K\n", desc.len >> 10, desc.base >> 10);
  67.     } while (desc.cont != 0);
  68.     size = Int15E881();
  69.     if (size == -1)
  70.         printf ("Int15 (E881) returns: not supported\n");
  71.     else
  72.         printf ("Int15 (E881) returns: %ld KBytes above 1M\n", size);
  73.  
  74.     return (0);
  75. }