This one has puzzled me for a couple days now.

I need a way to detect how much RAM is being used.

I have an address range of:

0x00000500 to 0x00007BFF
0x00007E00 to 0x0007FFFF
0x00080000 to 0x0009FBFF

I tried this:

Code:
proberam: 
	wbinvd  
	mov di, [0x00000500]
	mov si, 0
	mov ax, 0
	cmp di, ax
	je .empty	;Jump if ax is null
	mov si, di ;Else put value in si
	
	ret
	
.empty:
	mov si, 0
	ret
To find out if there was any data in 0x00000500 and it results as 0.

I am not sure how to write data directly into a memory address. If I could do this then it would make testing a great deal easier.

Is there anything really obvious that I am doing wrong?

Also how would I increment a memory address to test a range of addresses?

I thought about doing this:

Code:
add di, 0x00000100
However I don't think that would provide the desired results.