Code: Select all
detect_mem: ; 0x7e0:0 is dword # of entries, first entry starts at 0x7e0:4
mov eax, 0x7e0
mov gs, eax
mov es, eax
mov [gs:0], dword 0
.loop:
mov eax, [gs:0]
mov ebx, 20
mul bx
add ax, 4
mov di, ax
mov ebx, [gs:0]
mov edx, 0x534d4150
mov eax, 0x0000e820
int 0x15
jc .error
cmp ebx, 0
je .done
mov [gs:0], ebx
jmp .loop
.error:
mov ax, -1
ret
.done:
mov ax, 0
ret
the first 3 contain vailid data.. My results are:
[pre]
Base 0 Length 654336 Available
Base 654336 Length 1024 Reserved
Base 1048576 Length 32505856 Available
(the next 4 are Base 0 Length 0)
[/pre]
(I have 32mb in my test system)
My questions:
why are the last 4 entries empty?
how many entries can I put at 0x7e04 (at 20 bytes each)
(I was hoping this little pgm would tell me, but it only reports the above 3 areas..)