Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Memory Size

Memory Size

Memory Size

How do you find out memory size in assembly?
I know there are the bios interrupts 11 and 12, but they only work in kb, which isn't very good if you have for example 20M. Also these don't include extended memory.
Does anyone have any ideas ?

RE: Memory Size

If your program works on Windows,you can use API.
I'm sorry, I don't know how to accomplish it under DOS.

RE: Memory Size


getting memory sizes
>is here any good way to count a system's memory?
>something that might be easily portable to other architectures?

To get PC extended memory size, start with BIOS interrupts,
in this order:
- INT 15h AX=E820h (look for type 1 memory)
- INT 15h AX=E801h
- INT 15h AH=88h

If none of those work, read extended memory size from CMOS
    ; get extended memory size from CMOS -- won't
    ; report more than 63.999 meg (65535/1024)
        mov al,18h
        out 70h,al
        in al,71h
        mov ah,al
        mov al,17h
        out 70h,al
        in al,71h
        mov [ext_mem_size],ax ; in K

Direct probing is fraught with problems:
- Address "aliasing" caused by unconnected high-order address
  lines. I have a 486 system in which addresses 64 meg, 128 meg,
  192 meg, etc. "wrap around" to address 0.
- Memory mapped hardware that causes the computer to freeze
  when your memory probe steps on it.
- PC might have a bizarre and unique method of turning on the
  A20 gate; a method not supported by your direct probing code.
- C memory probing code that does not use 'volatile', or buggy
  compiler (Borland C++ 3.1) for which 'volatile' does not work
- Bus float causes the memory test to succeed even if there's
  no memory

RE: Memory Size

Thanks OSProgrammer Very Useful comments and some source code as well.
Are you currently writing an OS ?

The mind is like a parachute - it works better when open...

RE: Memory Size

Hi adholioshake!

Yes.I'm Trying to make an OS All With Assembly, And Currently I am Working on It's Graphic User Interface.

Best Wishes...

RE: Memory Size

I highly recommend Micahel Abrash for graphic at assembly level. I've read his "black book" on graphics and his "Zen on graphics". Both books are very good, but I tend to get a bit lost in it. He talks about how he created the quake graphics engine...

The mind is like a parachute - it works better when open...

RE: Memory Size

Thanks adholioshake For Your Guide!

How about you? What do you do with assembly!!?

RE: Memory Size

I just like to program a bit more deeply... I am currently an undergrad on an electronic engineering course. I would love to create my own OS, but at the moment my time goes on other things (like work and play). I have started working on a few low level OS designs on random floppys, but haven't got as far as the kernel yet. The way I see it, if I design an OS I wan't it to be compatible with the other more common OS's, so as a result much of the file system will be the same. My OS would probably be a small version of linux, another one on the shelf for the much larger linux community

I enjoy helping people stuck on assembly mostly, because a) It gives me a problem to solve and b) they learn more (hopefully). Happy programming...

The mind is like a parachute - it works better when open...

RE: Memory Size

Hi adholioshake!

If You Want to write an os like linux You Can Use C/C++/Djgpp Programming.

This site has good tutorial for WRITING YOUR OWN OS.

Best Wishes

Hamidreza Vakilian(Iran)
Email: vakilian@go.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close