memory

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
netster403

memory

Post by netster403 »

how do i check the ammount of memory in asm? above the 1MB limit. Just the Simplest in code.
netster403

RE:memory

Post by netster403 »

bump
Tonik

RE:memory

Post by Tonik »

try int15 eax=E820, if it fails, int15 eax=E801, if it fails, you can try int15,88 or test the memory for read/write
SebS

RE:memory

Post by SebS »

you could do direct probing (be careful about memory holes near 15M-16M)
SebS
Garf

RE:memory

Post by Garf »

What exactly happens when probing memory directly? When you probe an address that is not backed by physical memory, do you get an exception? Does a write just dissappear into the ether and a read just return garbage? What about the memory hole that may exist at 15MB-16MB, does it just mimic the behavior of non-existant memory even if you have more that 16MB of memory?

I have been trying to determine memory size using INT 15 function E820 but I have found that it is not very well supported. (I have tried it on 8 different computers, all of which are less that 1 year old, and none of them supports it) I have also had limited success with INT 15 function E801. I may be using the BIOS calls incorrectly but I don't think so. I could use INT 15 fuction 88 (it has worked consistently on every computer I have tried) but I then have to deal with the 64MB limit on what it can report.

If anyone has had experience with directly probing memory, or has seen that INT 15 functions E820 and E801 works on most machines, I would be interested in finding out about it.
SebS

RE:memory

Post by SebS »

Hello Garf,

Here u have my system routines which direct probe your ram resources.

;=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=
; system_routine_05 - GetAmountOfRam
;
; IN - AL= 5,
; OUT - EAX= Bytes available (Ram)
;=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-= ; all non input registers are safe ;)))
system_routine_05:
push ebx
push ecx
push edx
push es


mov ax, flat32_select
mov es, ax
xor eax, eax
cli
@loop05:
add eax, 100000H            ; 1MB
mov ebx, [es:eax]
mov edx, ebx
not ebx
mov [es:eax], ebx
mov ecx, [es:eax]
mov [es:eax], edx
cmp ebx, ecx
je @loop05
sti

pop es
pop edx
pop ecx
pop ebx
iret

I`m using this functions succesfully on all my testing machine (from 80486 to 80686).
You will get exception if u will use a descriptor which doesn`t cover all probed memory. Memory hole at 15-16M is used as memory buffer by some vga chips (at least I think is it true) - similar to memory at 0xa0000. Above that (in most cases) you can simply switch this function off in BIOS.
I`ve been studing INT 15 - and I noticed that this function depends on chips version of mother board - so that`s why I decided to write my function ;)

Hope that helps,
SebS
netster403

RE:memory

Post by netster403 »

i may just be an idiot, but what is flat32_select??
netster403

RE:memory

Post by netster403 »

bump ;)
carbonBased

RE:memory

Post by carbonBased »

Uhm... well, seeing as though it's being loaded into es, I would assume it's a data selector for 32-bit flat memory.

In otherwords, a selector pointing to a descriptor with base 0, and size 0xfffff pages (ie, 4.2949 billion bytes).

Jeff
SebS

RE:memory

Post by SebS »

Thx Jeff, I had my vacation - so I can`t post answer - I confirm that it was selector for 32-bit flat data(r/w) memory.

SebS
Post Reply