Page 1 of 1

main memory size

Posted: Thu Mar 03, 2016 2:46 pm
by ammar
HI

Please, my brothers programmers

I need code to display all the details of main memory abut size & free space & the manufacture company & memory material in device

this code display memory size 670k. why? modification code

Code: Select all

prnstr macro msg
        mov ah, 09h
        lea dx, msg
        int 21h
        endm

data segment
        ans db 6 dup(' '), '$'
        buf1 db "Memory available : $"
        buf2 db " Kilobytes$"
data ends

code segment
        assume cs:code, ds:data
start :
        mov ax, data
        mov ds, ax
        mov es, ax

        mov ax, 0000h
        int 12h

        mov cx, 000ah
        mov si, offset ans + 5
again :
 mov dx, 0000h
        div cx
        add dl, 30h
        mov byte ptr [si], dl
        dec si
        cmp ax, 0000h
        jnz again

        prnstr buf1
        prnstr ans
        prnstr buf2

        mov ax, 4c00h
        int 21h
code ends
        end start

Re: main memory size

Posted: Thu Mar 03, 2016 6:15 pm
by azblue
ammar wrote:HI

Please, my brothers programmers

I need code to display all the details of main memory abut size & free space & the manufacture company & memory material in device

this code display memory size 670k. why? modification code
670K actually sounds a little high. You're asking the BIOS to give you max conventional memory; what you probably wanted was int 15h, E820h.

I don't think there's anyway to get all the detailed info like manufacturer.

Re: main memory size

Posted: Thu Mar 03, 2016 7:24 pm
by SpyderTL
https://en.m.wikipedia.org/wiki/Serial_presence_detect

I don't see anything about it on the osdev wiki. It sounds pretty motherboard specific, but let us know if you find any more information.

Edit: It looks like you might be able to get the information from SMBIOS as well.

Re: main memory size

Posted: Fri Mar 04, 2016 12:37 am
by Brendan
Hi,
ammar wrote:I need code to display all the details of main memory abut size & free space & the manufacture company & memory material in device
For free space, it depends on how you define "free space". If you're running any OS then "free memory that applications can use" would require asking the OS. For "free memory that the OS can use" you have to ask the firmware - e.g. the "int 0x15, eax=0xE820" BIOS function, or the "get physical memory map" function provided by UEFI.

For the rest of the information you'd want to start with System Management BIOS, which is designed/intended to make it easier for people to manage hardware (e.g. find out what is in each computer and plan hardware upgrades, etc).

"Serial presence detect" would give you more detailed information about each specific RAM chip than System Management BIOS, but won't tell you where it's plugged in and will require chipset specific drivers.
ammar wrote:this code display memory size 670k. why?
I'd assume it's reporting the amount of free memory that DOS can access; which is limited by real mode. More specifically; I'd assume it's about 636 KiB of RAM at 0x00000000 plus almost 64 KiB above 1 MiB (at "0xFFFF:0x0010" in real mode), minus the BDA (about 1.5 KiB) and minus whatever DOS itself consumes (maybe 28.5 KiB).


Cheers,

Brendan