[A83] Re: allocating uninitialized memory? + _insertmem


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

[A83] Re: allocating uninitialized memory? + _insertmem



theres no way to assure that the user has enough free ram?  thats bullcrap.  you can check to see if you have enough free ram to create a program before creating it.  or if you don't like that idea, you can use error handlers to catch errors when you creation routine fails.  or if you want to make sure the user has say 1k of free ram afterward... make a routine to do the math first!
 
brandon sterner
----- Original Message -----
From: MyOwnLittlWorld@aol.com
To: assembly-83@lists.ticalc.org
Sent: Saturday, May 31, 2003 7:30 PM
Subject: [A83] Re: allocating uninitialized memory? + _insertmem

Actually, the first line of page 7 of the SDK guide says that you should never use the free ram area to store data (exactly what you're doing by creating a temp program to store data), for the reasons cited before, that it changes the vat, and that there's no way to assure that the user has enough ram free (...what if the end user is a user like me?  It could happen.)...  It goes on to suggest that you should use:

"Safe RAM Locations for Application Use
If the amount of RAM an application needs is not too great, use safe pieces of RAM that exist in the System RAM area. These are chunks of RAM that are not used by system routines except under rare circumstances. They are, therefore, available as scratch RAM for the application.


saveSScreen (86ECh)
This is 768 bytes used by the system code only if the calculator automatically powers down (APD).  This RAM is safe to use as long as an APD . cannot occur.  See the Keyboard and Automatic Power Down . (APD .) sections.

statVars (8A3Ah)
This is the start of 531 bytes of RAM used to store statistical results. If you use this area, do not compute statistics in your ASM program. Make this B_CALL to invalidate statistics, as well.
B_CALL DelRes

appBackUpScreen (9872h)
This is the start of 768 bytes of RAM not used by the system. It is intended for ASM and applications. Its size is large enough to hold a bit image of the display, but it can be used for whatever you want.

tempSwapArea (82A5h)
This is the start of 323 bytes used only during Flash ROM loading. If this area is used, avoid archiving variables.

WARNING: The RAM is safe to use only until the application exits. Data in any of these areas of RAM may be destroyed between successive executions of an application. Therefore, any data that must remain between executions cannot be kept in these areas. This RAM is only for the variables that can be discarded when the application exits" (sdk83guide.pdf 7-8).

...That's 2390 spare bytes to play with, assuming you don't plan on using stats, archiving, APDing, or using the backup screen...

Nick

References: