12-08-2007, 10:41 PM
Discuss tips and tricks for optimizing TI-BASIC programs for the z80 calculators...
Let me start off with one of the most basic of optimizations, wherein closing parentheses (")") and end-quotes ('"') can be omitted from the end of a full line of code. In addition, note that parentheses and quotes can be omitted from the left of a "store" operation ("->"), because the code to the left of such an operation is treated as a full line.
Example:
Let me start off with one of the most basic of optimizations, wherein closing parentheses (")") and end-quotes ('"') can be omitted from the end of a full line of code. In addition, note that parentheses and quotes can be omitted from the left of a "store" operation ("->"), because the code to the left of such an operation is treated as a full line.
Example:
Code:
(1-A)/(B/(4+C)+1)->D
Is more optimal as the following (saving one byte):
Code:
(1-A)/(B/(4+C)+1->D
And even better (saving two bytes):
Code:
(1-A)/(1+B/(4+C->D
Note that the aforementioned optimizations do not have a very high yield, but when they are used out of habit when writing code, they do add up, so to speak.