Results 1 to 5 of 5

Thread: Detecting Memory

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Location
    England
    Posts
    94

    Detecting Memory

    Does anyone know of a function that detects the amount of physical memory in a machine.

    Cheers
    Peter

    P.S this is to run under windows
    "Let's all join forces, rule with an iron hand...and prove to all the world, metal rules the land..."
    -- Judas Priest

    My email is [email protected]

  2. #2
    jim mcnamara
    Guest
    Code:
    #include <windows.h>
    //return total memory NOT available memory
    long memsize(){
         MEMORYSTATUS  size;
         long i;
         size.dwLength = sizeof(MEMORYSTATUS);
         i=GlobalMemoryStatus(&size);
         return size.dwTotalPhys;
    }

  3. #3
    Hyperactive Member Warmaster199's Avatar
    Join Date
    Aug 2000
    Location
    Canada
    Posts
    306
    Do you know how to do it without using windows.h?(I dislike windows.h) You use interrupts. If you wanted to find the memory on a different platform, say DOS, you would need interrupts. I was just trying to find out how to do this, but at the moment, I can't find the actual Interrupt number you use. Here's the basic framework... :

    #include <dos.h>

    union REGS i, o;
    /* These are basically arguments. Some interrupt numbers have
    * several subfunction numbers... Usually, you only use AX or BX,
    * but, for some functions, you may need the others. */
    i.x.ax = ?;
    i.x.bx = ?;
    i.x.cx = ?;
    i.x.dx = ?;
    int86(intnuminhex, &i, &o);
    var = o.x.ax;

    /* Put the value of ax in var... This would be the amount of RAM if
    * you found the interrupt number you need by searching on the
    * net... */

    There are some interrupt lists which have all of the interrupts out there...
    Designer/Programmer of the Comtech Operating System(CTOS)

  4. #4
    jim mcnamara
    Guest
    WarM -

    You should find abdul's post about using asm, calling 'Interrupts'.

    I have a different point of view from you two, but that's just fine.

  5. #5
    Hyperactive Member Warmaster199's Avatar
    Join Date
    Aug 2000
    Location
    Canada
    Posts
    306
    Why, am I that bad???
    Is it about the int86(int,i,o) thing or is it about my sig?
    Designer/Programmer of the Comtech Operating System(CTOS)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width