by David Dynes
I'm David Dynes, a.k.a. XaVIëR, and I am a proud owner of a TI-82 and TI-85,
and saving up for a TI-86. I have had my calculators for close to a year now,
and although I program for both, this column is going to focus on the TI-82.
I. Saving Space without Sacrificing Performance
Being a TI-82 programmer, I understand that our dear TI-82 has only 29003
bytes of free space. When you have a program involving quotes or parentheses
used frequently, it adds up. On a command such as
:Disp "HI. I AM TI-82."
:Output(3,1,"HI. I AM TI-82.")
:For(A,1,1000,2)
You can chop off the final parenthesis and/or quote, and have it still work.
:Disp "HI. I AM TI-82.
:Output(3,1,"HI. I AM TI-82.
:For(A,1,1000,2
Try it, you'll like it. Also, if you want to multiply large things, such as
2*B*C+B*(3*A)²
which is 14 bytes. This can also be reduced by about a third!
2BC+B(3A)²
II. The Gold Mine brought to you by L1-L6
The TI-82, granted, has 27 registers (called variables) , A through Theta,
by which you can store real numbers. There are three downsides to this:
- By using certain variables in a program, you risk interfering with
permanent saving in another program.
- By using the variables, you risk another program interfering with
the permanent saving in the present program.
- There is only 27 variables, at that. Very limited for complex, full programs.
Mow, I'll tell you the advantages in the statistical list.
- In a TI-82 statistical list, you can have up to 99 numbers. And, you
have 6 lists to choose from. That's close to 600 variables that you can use.
Tell me that you can't use 600 variables to extend a program beyond means.
You don't have to consume any of the precious variables.
- Stat lists do not have to linger around when you finish. When you use
a register such as R, and you store a number to it, then you still have it
around, hogging 15 bytes which could be otherwise used to finish that
equation you're computing on the Home screen or that graph on the Y= screen.
By inputting the code 0/->/dim L1, in essence, you put away your toys.
If you store 900 bytes' worth of data into one list, then by erasing the list,
you have that many more bytes to use!
III. Ways to Improve Speed Without A Soldering Iron and A $50 Microchip
While Lbl's are quite useful, and Goto is quite a useful tool, I have
discovered that you can improve speed two ways. Like the variables, you
are limited to 37 Lbl's: A-Z, 0-9, and Theta.
- If you have Lbl's A,B,C in sequence, and A goes to B and B goes to C,
you don't need a Goto B after the end of Lbl A. By just letting it read the
next line of code (Lbl B), you improve speed, for now the program doesn't have
to search the ENTIRE program looking for Lbl B.
- You can also improve speed by using the Ans function. It is so much easier
to just recall the Ans then to store to a variable.
For example:
:getKey/->/K
:If K=24
:*instruction*
:If K=26
:*instruction*
By using Ans, you not only improve speed, but you also save the 15 bytes
of using another variable, and the 2 bytes of the /->/K. It's only 2 bytes but it
all adds up.
Example, remodeled using Ans:
:getKey
:If Ans=24
:*instruction*
:If Ans=26
:*instruction*
IV: Program Fatigue
T
hat's what I call it. Program fatigue. While running a program continuously on a calculator,
the time that the program takes to recall that code slows down. It's much, much worse on the
TI-85 than on the 82, and I don't know why it occurs. I have developed a solution on games that save.
On a game that saves, like my masterpiece-in-the-works Zepthor, when you notice the 'program fatigue'
beginning to take effect, save, and just exit the program. Then restart the program, and load your
game. On a complex game, the fatigue can be drastic. Timer programs are the worst.
I haven't found a solution for a game that doesn't save, like an arcade-style game like my Missiles,
which is on the BallisTiC Software homepage. I hope one of you faithful users of our "relics" can find a solution.
V. Final Words
If you have anything to add to this, or if you would merely like to comment, please let me know,
or if you have anything which is better than I have already posted (without needing to remove
the casing) please respond. You can email!
|