[A86] Re: Problem with free mem


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

[A86] Re: Problem with free mem




I'm not sure if this will help but if whenever I want to print the free mem I use this:

_get_free_mem equ 0D29Dh ; available user memory

to calculate the amount of free mem...and this:

_pause =$4D40

.org _asm_exec_ram

 call _clrScrn
 call _homeup
 call _get_free_mem
 call _dispAHL
 ld hl,str
 call _puts
 call _pause
 ret

str:
 .db "bytes free",0

.end

to display it... Hope that helped....


 rabidcow@juno.com wrote:


On Tue, 3 Sep 2002 17:15:17 +0300 =?iso-8859-1?Q?Leif_=C5strand?=
writes:
> 
> My problem is that when a program is run from the TI-OS the amount 
> of free ram is recalculated.
> 
> This doesn't happen when an [sqrt] program is run; calling _chkmem =
> returns 0 as free memory, and trying to create a var will give an 
> "error 15 memory" message.=20

What you're seeing is that while at the home screen, the '#' variable (or
is it the '!' variable?) is open for editing, so that all keys can be
inserted fairly quickly. Any variable open for editing takes all free
memory.

When the enter key is pressed, the variable is closed and then executed,
this is why it works for normal asm progs. You'll probably have to close
the open var yourself, or replace the contents with the correct sequence
to restart your shell and send a kEnter to the homescreen.

I think your best bet would be to do a context switch. (ie, load your
own app) Unfortunately, I don't think there's a lot of info on that, and
I'm in far too great a need of sleep to explain the details atm, and it
might require some annoying changes. (I think Clem's done some examples
with 'em) You could try just using _closeEditEqu, but then you'd
probably have to reopen the var before you quit and possibly some other
things.

Or you could do halfway in between:
_PPutAway equ 40BDh
_PutAway equ 40C1h
call _PPutAway ;put away homescreen cx
call _PutAway
Now you should have free memory, but there's no app context set up, so I
don't think you can just return at this point. (not sure about exec'ing
basic progs either) _jForceCmdNoChar should work to exit back to the
homescreen.

I would love to see a shell done as a proper app tho.

-rabidcow






________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today! For your FREE software, visit:
http://dl.www.juno.com/get/web/.



---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes




References: