Using Resource

By Spellshaper


RESOURCE is an assembly program designed to make your programming life easier by being able to copy programs to RAM, whether it resides in the ROM or not.

With RESOURCE comes the prgmLDSOURCE, which is recommended to be used by users. In my opinion, prgmLDSOURCE is not necessary, anyone but real noobs can understand the Syntaxes to use prgmRESOURCE directly, which I´m going to explain now.

Usable Syntaxes

Note: Text in white came from the original forum post, text in this color means this is an addition by TI-Freakware to help assure you understand what is being said. This also can just mean a deeper explanation of why it has to be the way it is.

Syntax 1:


This copies the code of prgm[NAME] to RAM into prgmTEMP[X] (the [X] specifies the numberof the prgm: if there´s no prgm named prgmTEMP1, prgm[NAME] will be copied as prgmTEMP1, if prgmTEMP1 already exists and prgmTEMP2 is undefined, it will be created as prgmTEMP2 and so on, up to prgmTEMP9).

If you tried the above, but it did not work, make sure that you do not have the following syntax: :"0[NAME]:Asm(prgmRESOURCE. What you are doing here is storing the entire line into variable Ans as a string, and the calculator will there for assume it is a string to be used, not commands that need to be executed. If you want to keep things like that, it will take an extra byte, but you would need to do this: :"0[NAME]":Asm(prgmRESOURCE. Also, you do not need to add the prgm token that would be automatically displayed if pulling from the EXEC menu. It just needs to be the programs name.

Assuming that this is your first use of Resource, here is an example of code:


prgmTEMP1 will now contain the code that prgmTEST has, without unarchiving.

Syntax 2:


This syntax deletes the prgmTEMP[X] with the highest number and links prgmTEMP to the prgmTEMP[X] with the now highest number, but never links prgmTEMP to prgmTEMP0.

Basically, if you have prgmTEMP1-TEMP5, it will delete prgm TEMP5, rewrite prgmTEMP so that it can remember that prgmTEMP4 is now the highest numbered TEMP program.

Syntax 3:


With this syntax, all prgmTEMP files are deleted (prgmTEMP, prgmTEMP0-9) and prgm[NAME] is copied to RAM as prgmTEMP0 (an existing prgmTEMP0 will be overwritten).

If you just want to make things easier, and you do not have a program calling a program calling a program, so it won't cause an error when it needs to return to the first caller program, you can use this. Using this syntax will make everything run from prgmTEMP0.

Syntax 4:

:" "

When you input an empty string, all TEMP-prgms will be deleted! Only use this syntax as a "cleanup"-function at the very end of your program!

Basically use this to clean up all the progs that RESOURCE leaves behind. One of the most important things a programmer needs to do for his games/programs is to make sure it cleans up after itself.

Misc notes:

If you do not use one of the above syntaxes, RESOURCE will simply ignore the string.

Syntaxes 1) - 3) also create (and overwrite if it already exists) prgmTEMP, which is just a link to the latest created prgmTEMP[X] with the Asm(-command already implemented if the copied prgm was Asm.

What this means is, you can create prgmTEMP1-9, running prgmTEMP will run prgmTEMP9. If you use syntax 3, then it will run prgmTEMP0, and if TEMP0 is an asm program, it will automatically insert Asm( for you. This can save memory in the long run. :)


I use the syntax 3) in my main prgm for the major subroutines. For subroutines within subroutines I just use syntax 1) and clean up the last prgm with syntax 2).

If you create a program specifically for deleting unimportant variables once the program is shutting down, you should include the fourth syntax near the end, to get rid all the prgmTEMPs.

The Resource file can be found here.