Basic Memory Saving Techniques For TI83 Programs
Items covered in this journal:
Disp, Labels, Quotes, Parentheses, For and While Loops, Advanced If-Then, A+1→A, Pause Statements, getKey, Turing strings into numbers, Output, If and Then Statements, Small Letters, Resetting Vars, Repeated actions, Stop, and Ans.
I know this is big - But its great.


Most people usually just have a pause to stop the screen to display something like this:


While this does what you want it to do, its not the best. Do the following to save memory:

It's smaller and looks better in edit mode Also, sometimes the Disp command is assumed by the calculator. For example:
:Prompt B
:Disp B+1

is the same as
:prompt B



Parentheses are needed in almost all programs. Usually used like the following:

:Output(4,5,"HELLO THIS IS")

To save memory simply drop the closing parentheses, therefore becoming:

:Output(4,5,"HELLO THIS IS


Pause Statements

Pause statements can also be used just like the Disp function- simply place what to display behind it the following:

Pause "HELLO



Output is very useful, but I found out a way to make it much more memory efficient. Take the following for example. (Taken from QUADPRO before and after optimization).


:Output(5,3,"DIVIDE BY ZERO



The output command will display the text it can fit on the line given to it, if their is more text it will spill over to the next line. This can be an enormous space saver.


Resetting Vars.
Never use this to put into a variable, instead use Delvar
Don’t do:

:Delvar A

Now in the program use it as if A=0!



Don’t put it in, that simple. Have a program simply go to a label that is the second to last line of the program. Have the last line read:
This serves three things, one it saves 1 byte, (because stop is not their), the program will return to the program the may have called it (even the Ti homescreen). (This is especially useful when making a SOS compatible program because it will exit and run SOS, same with Aurora, Ashell, etc…), and lastly it will clear out ans. Ans will usually take up about 7 bytes, now it will only take up 2 tops.



To save memory try to use only one character labels. This saves 2 bytes, the first in the Goto statement and the second in the actual label for the Goto


For and While loops

This is a big problem that I see in many programs. I took me a while to master this concept, but in doing so you can save large amounts of memory (100+ bytes is easy!) Take the following For loop for example:

Don't Do this:
:Input "NUMBER? ",B
:Input "NUMBER? ",B
:Input "NUMBER? ",B

Do this:
:Input "NUMBER? ",B

Now, If you don’t understand this loop, READ THE MANNUAL!
Another type of loop is the While loop, It will continue running until its conditions are meet, or a goto gets it out of the loop. For example: (this is the program GETKEY):

:While A(not equal to)105
:If A≠0:Disp A

This program will continue to run, displaying the getkey for all the keys pressed until you press enter.



Getkey is one nice function if you know how to use it. Each key on your Ti-83 has a key code for it, the getkey will get the code of the key being pressed. However it does have one drawback, it will not wait for a key to be pressed. The sample following is a way to make it do just that.

:Repeat A()0


If and Then statements

This is used often in almost all programs, but I to often see the long way of doing them, take the following example and its shorter version.

:If A=1
:Goto A


:If A=1:Goto A

That's It! (you can only place 1 command in this form though.)


Repeated Actions

Try to put a repeatedly used code in to a subroutine, It allows for even less programming. Instead of having a program find the intersection point of two lines in 4 parts of the program. Place that code in another program and call it from the master program with "progNAMEHERE". It will run the subroutine and return to the line immediately after the one it was called from!


Using ans
This is really cool – and it will save 2 bytes each use!

Instead of having:
:Disp E

Do this:
:Disp ans

When doing anything that the program does the math or text will be put into ans (to display text put it inside quotes) and you can display this like any other variable.



Parentheses are needed in almost all programs. Usually used like the following:


To save memory simply drop the closing parentheses, therefore becoming:



Advanced If-Then A+1→A

This is all about the very common If A=2:B+1→A statements. Use = to solve the problem. If the statement is true 1 is returned otherwise it will return 0.

This is a very short and fast example of
:If Z=2:A+1→A


See how it works? If Z=2 it becomes 1, otherwise it becomes 0. So it’s a short version of the example. This is also faster than if-then logic!


Turing strings into numbers

So, you're working on a program to turn a string into numbers? (an encryption program maybe?) Well read this. I've looked at a few encryption programs before and they are usually like this:

:Input "Message? ",Str1
:If Str2="A":1→LMESS(A
:If Str2="B":2→LMESS(A
:If Str2="C":3→LMESS(A
:If Str2="Z":26→LMESS(A

This is so slow and inefficient!

Check this out:

:Input "Message? ",Str1

Isn’t instring great? This is how it works – It takes the letter (or Number) and looks for it in the string, when it finds it it returns its position in the string! So A is still 1, B is 2 et.


Small Letters

Want to know where the small letters are? Look in VARS 5 (statistics). In that menu there are numars small letters, but they each take up two bytes instead of one for the large ones. Use them wisely.

Hope you read and understood it all. Have fun programming!!