direct probing 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
udarkman

direct probing memory

Post by udarkman »

To get memory size I code a proc. Most times, it works fine. But sometimes couses my computer to crash. What may couse it to crash? (in pmode, a20 enabled)
proc TestMemory
push eax ebx ecx edx esi edi

mov esi, 100000h
xor ecx, ecx

MemCheckLoop:
mov ax,[esi]
mov dx, ax ;storing old value
not ax
mov [esi],ax
mov bx,[esi]
xor bx,ax
jnz MemCheckExit
inc ecx
add esi,1024
jc MemCheckExit
mov [esi], dx ;restoring old value

jmp MemCheckLoop

MemCheckExit:
pop edi esi edx ecx ebx eax
ret
endp TestMemory
And as a second thing. This code finds RAM size mostly even if a20 line is not enabled.Is it normal???
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:direct probing memory

Post by Pype.Clicker »

1. you migt have some memory-mapped devices that will go bad once you write arbitrary ~X in it ...
2. maybe the BIOS did enable the A20 gate at boot up ... some do, others don't.
Post Reply