Programming Notes For the TI-89/92(+) Calculator

Internal Documentation of Functions and Programs

Frank P. Westlake, November 30, 1999


General

So that there will always be someplace for a user to find help I suggest placing essential information in the program code. Texas Instrument's Advanced Mathematics Software Version 2 and greater allow help information to be displayed from the catalog. This paper discusses a procedure for including help information that will be compatible with all current versions and recommends a standard format to be used.
 


Formatting Text for the VAR-LINK Viewer

The display should be formatted with the most useful information at the top. I recommend a format prioritized as follows:

Start the line immediately following the Func or Prgm statement with a comment marker (©), then include the first line of the help information. At the end of each line of help, insert a linefeed character (). To do this, go to the home screen and enter char(10). Cursor up to the character and copy it to the clipboard, then paste it into your program. Delete the quote characters from before and after the linefeed character.

Example:

:mysolve(e1,e2,v)
:Func
:MySolve(e1,e2,v)->eSolves expressions, v1.0e1: First expressione2: Second expressionv:  Variable to solve fore:  The solution
:
:Return solve(0=e1 AND 0=e2,v)
:EndFunc

To be 100% compatible with the latest version of Graphlink for Windows (v0.16, Oct 14, 1999) you can have only one line and no linefeed codes. The reason is because Graphlink converts the linefeed codes into actual linefeeds which produces uncommented text that the calculator tries to interpret as commands. This will never be a problem if you don't use a Graphlink program editor window to save or transfer the variable. To avoid the problem, add the help information to the variable with the calculator's program editor and always use Graphlink's Link|Send menu to transfer. If you will be distributing the program it is best to individually comment each line of help. Only the top line will be visible in the catalog.

Example:

:mysolve(e1,e2,v)
:Func
:©MySolve(e1,e2,v)->e
:©Solves expressions, v1.0
:©e1: First expression
:©e2: Second expression
:©v:  Variable to solve for
:©e:  The solution
:
:Return solve(0=e1 AND 0=e2,v)
:EndFunc


TI Hungarian Notation

Since the amount of text that can be viewed is limited to only one screen, a modified Hungarian Notation (used in some programming languages) will help to increase the amount of information displayed. To avoid confusion with TI's file type indicator codes I recommend adopting them without change for all variable types. The following chart identifies those codes.

ASM z
DATA c
EXPR e
FIG a
FUNC f
GDB d
LIST l
MAC x
MAT m
NUM (real) n
OTHER o
PIC i
PRGM p
STR s
TEXT t
VAR (name of) v

At the time of this writing many of the above listed variables could not be accessed by a program or function, but TI may decide to change this at some time in the future so they should not be reused. If someone has some good suggestions for the remaining letters of the alphabet (b, g, h, j, k, q, r, u, w, y) I will add them to this document. Some ideas I have are:

q = Complex number.
r = Vector.

Since this information is being used for display only, it is not necessary that valid variable names be used, a more descriptive syntax can be used instead. If multiple codes are used, the right-most code should indicate the basic variable type.

Examples

n         A number
nInt      An integer
m[2x3]    A 2x3 matrix
l{X,Y}    A list representing a coordinate
i16x16    A 16x16 image.
vDepen    Name of dependent variable.
sCh       A character
zsAPD     An ASM string for Exec.
e         An expression.
eODE      An ordinary differential equation.
e=        An equation.