TI-85 Programming Conventions v1.1

Copyright 1997 Jeff Tyrrill
Distribute freely, unmodified
Last updated 5/10/97

In this document I have compiled some conventions that you can use in your TI-85 programs to make them easier to use for everybody. I use these in my own programs, and I would encourage others to do the same. These apply especially to games, but also to math and utility programs.

This document assumes knowledge of the programming environment; refer to the manual for help if you don't know what something is.

Variables

Whenever your program uses in-program variables, try to use one-letter names, and also store them as empty strings upon the program's exit. Example:

""\->\A

An empty string only takes 7 bytes of memory. Do not use equation-type variables instead of strings; these clutter up the Solver menu.

If the program saves settings, save them in a vector with an easily recognizable name; for example, make the first few letters of the variable match the first few letters of the program name so the user can easily find and delete it. The reason to use a vector is so that the variable does not have to be on the calculator the first time the program is run. Just have the program say:

5\->\dim TESTVECT

TESTVECT will be defined as a 5-element vector if it does not exist; if it exists; it will be resized as a 5-element vector, with its existing elements left unchanged.

Sub-programs

Programs can call other programs as subroutines. If your program uses sub-programs, make them start with a greek character so they will be listed at the end of the Program/Names menu. Also, begin them with the first few letters of the program so the user can easily find and delete or transmit them.

The Graph Screen

If a game (or 3D-Graphing program, etc.) uses the graph screen, you will want to save a Graph-Database (GDB) upon the program starting to save the user's graph settings. Before the program touches the Graph screen, execute this line of code:

StGDB TempGDB

After the program is finished with the graph screen, execute this line of code:

RcGDB TempGDB

This restores all the function, window, and format settings for the user's graph; essentially, they will never know that a game had been screwing with it. Also, use the variable TempGDB. If every program uses this same variable, it will make it easier for the user to go find and delete this var. If you do not want to use this variable, DO NOT use a one-letter variable; other programs like using one-letter variables and if they try to overwrite a GDB with a different type of variable, an ERROR 10 DATA TYPE will occur.

Mode Settings

Remember, for games especially, certain mode settings may have to be set for information to be displayed properly. If numbers are displayed, remember to execute:

Normal
Float
Dec

This is usually undesirable in a math program, where it should be able to use whatever formats the user has on the Mode screen. Also remember to set the settings back to the factory defaults if your program changes them. The factory default is the best guess at what the setting was before the program ran, because there is no way of checking.

System variables (tolerance, etc.)

If your program changes system variables such as the tolerance variables, remember to set them back to what they were before they were changed. Just store them to a backup variable and restore them.

Teacher Key

This applies only to games. All games, if possible, should have teacher keys. The classroom is about the only place where calculator games are played. A teacher key, when pressed, should quickly exit and show a blank home screen. To make a program not display the "Done" message, make the last line of the program:

OutPt(1,1," ")

If the last line is "Stop", just put the OutPt command right before that. The teacher key should be EXIT, ENTER, F1 or F5, because these are easily accessible. Remember to always have a QUIT option when a menu is displayed with the "Menu()" command. Never let there be a time in the game where the user cannot exit in a single keystroke, or possibly two keystrokes.

Edit-locked Programs

Programs can be edit-locked by adding the byte $FF to the last line of the program, and having the STOP command right before it. The $FF byte is obtainable with the ZShell program Popchar. Whenever the program is edited, an ERROR 15 MEMORY occurs. This is harmless. Also, edit-locked programs cannot be RCLed into another program. If they are opened with the TI-Graph Link software, it crashes. If you don't want lame losers changing your name in your program to theirs and then selling it, edit-lock your programs.

I think I covered everything. Any questions, comments, mistakes? Email me.

Revision History

1.1: Fixed a few typos

1