re: A86: Getting free mem size on the calc


[Prev][Next][Index][Thread]

re: A86: Getting free mem size on the calc




You can also call this routine : 

_MEMCHK         equ       46BBh       ; ahl = # bytes of free memory

Later,
Pat

------------------
Original text

From: Grams Family <grams@netcarrier.com>, on 1/14/98 9:55 AM:

I figured out how to get free mem size in a program...
The 3-byte abs. address at $d29a is the end of the VAT, and the abs.
address immediately following, at $d29d, is the end of the variable data
area. So to get free mem size, you just subtract $d29d from $d29a. In asm
it would look something like this:

get_free_mem:
   push bc	;save bc and de
   push de
   ld a,($d29a)	;ahl=end of VAT
   ld hl,($d29b)
   ld b,($d29d)	;bde=end of data
   ld de,($d29e)
   or a		;clear carry flag
   sbc hl,de	;subtract to get free mem size
   sbc a,b
   pop de	;restore bc and de
   pop bc
   ret		;ahl holds free mem size

--Joshua

P.S. I haven't tested this...



References: