main memory size

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
ammar
Posts: 14
Joined: Thu Feb 11, 2016 10:55 am
Libera.chat IRC: ammars6

main memory size

Post 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
Last edited by Combuster on Thu Mar 03, 2016 3:21 pm, edited 1 time in total.
Reason: removed 2 excess thread creations, added code tags, removed ~100 spammy symbols
azblue
Member
Member
Posts: 147
Joined: Sat Feb 27, 2010 8:55 pm

Re: main memory size

Post 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.
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: main memory size

Post 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.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: main memory size

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply