EasyManuals Logo
Home>Texas Instruments>Calculator>TI-89

Texas Instruments TI-89 Tip List

Texas Instruments TI-89
507 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #34 background imageLoading...
Page #34 background image
Source code description
The source code for ruler() is shown on the following pages. I have added comments to describe the
operation, but these comments are not in the program in the tlcode.zip file.
ruler() uses local programs and functions so it can be distributed as a single program. This does
require using global variables to pass parameters, since the scope of local variables defined in ruler()
does not extend to the other locally-defined programs. The global variables are stored in the main\
folder, since it is guaranteed to exist on every calculator, and they are deleted before exiting ruler().
Since ruler() needs to change the Graph and Mode settings, they are saved in the beginning of the
program and restored at the end. The Angle mode is set to Radian, so I know that the results of angle
calculations are in radians. To change the Graph and Mode settings, I use the numeric string
arguments for setGraph() and setMode(), instead of the text strings. This makes program operation
independent of language localization.
I want the graph screen clear except for the cursors, so this code completely clears and displays the
graph screen:
ClrDraw © Clear all plots, functions and drawings
ClrGraph
PlotsOff
FnOff
SetGraph("3","1") © Turn grid off
SetGraph("4","1") © Turn axes off
DispG © Display graph screen
To avoid writing, distributing and maintaining two versions of the program, I detect which calculator
model (TI-89 or TI-92 Plus) on which the program is running. The model is determined by using
getConf() to find the calculator screen width. If the width is 240, then the calculator is a TI-92 Plus,
otherwise it is a TI-89. The expression to find the model is
if getconfg()[dim(getconfg())-14]=240 then
...
The test returns true if the calculator is a TI-92 Plus. getConfg() returns a list of configuration pairs. The
location of the screen width configuration pair depends on whether or not certificates are installed.
However, the screen width is 14 elements from the end of the list, regardless of certificate installation,
so the expression gets the configuration with respect to the end of the list, that is, 14 elements from the
end.
Three specific parameters depend on the calculator model: the screen size, the key codes for some
keys, and the pixel pitch. I account for all these parameters by assigning the correct values to variables
based on the calculator model, then the program logic uses these variables instead of hard-coded
constants.
I use the letter keys [O], [M] and [H] for features in ruler(). The same keys are used for both the TI-89
and the TI-92 Plus. However, on the TI-89, I don't make the user enable alpha mode to press the right
key. Instead, I test for the unmodified key code for that letter key. For example, the [O] key is the same
as the [-] key, so I just test for the [-] key code (45), instead of the [O] key code (79). The TI-89 user
presses the [-] key to perform the origin/target toggle function.
The user can press any of three keys to exit the program: [ESC], [QUIT] or [HOME]. This just makes it
easier for the user, since she does not need to remember exactly which key stops the program. The
cursor movement keys are consistent with the standard operation on the Graph screen. Pressing just
1 - 23

Table of Contents

Other manuals for Texas Instruments TI-89

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-89 and is the answer not in the manual?

Texas Instruments TI-89 Specifications

General IconGeneral
Display size (HxV)100 x 160 mm
Memory type639K FLASH ROM, 188K bytes RAM
Compatible operating systemsOperating System 2.09
Battery typeAAA

Related product manuals