Re: A86: Getting free mem size on the calc


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

Re: A86: Getting free mem size on the calc




hmm are there calls to get the bytes taken up by a file type?

-----Original Message-----
From: Pat Milheron <pmilheron@ti.com>
To: assembly-86@lists.ticalc.org <assembly-86@lists.ticalc.org>
Date: Thursday, January 15, 1998 9:10 AM
Subject: 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...