TI-Basic 84 Programming/Printable version

Purpose

The purpose of this book is to teach both the basics and more advanced aspects of the TI-BASIC programming language. Although the book's intention is to instruct newcomers with no previous TI-Basic programming knowledge or experience, those who have some programming experience can use the table of contents to inform themselves on certain aspects of the language, like optimizing code or learning the small yet important differences between certain loop types. Hopefully, the Wiki Community can contribute a vast amount of useful TI-Basic programming knowledge, which will allow this book to provide a much more in-depth look at TI-Basic. Currently, this book only provides information regarding TI-BASIC programming on the TI-83+ or 84+. Of course, the Silver Editions and C or CE versions of the two calculators can be used with this guide.

To learn the language and programming skills in order from beginning to end, the reader should start with this page, the Introduction, and use the links at the bottom of each page to move to the next chapter.

Overview

TI-Basic is a simple programming language used on Texas Instruments (TI) graphing calculators which integrates many normal graphing calculator commands (like storing variables or graphing) into its code.

TI-Basic is a relatively easy language to program in, especially when it is compared with Assembly, the other main language that can be used to program TI graphing calculators. Programs written in TI-Basic, compared to programs written in Assembly, have a small filesize (due to that fact that commands like 'If ' and 'Menu(' use just 1-2 bytes of memory). However, this makes execution of TI-Basic programs very slow, because the calculator first reads through and parses each line of code before translating it into Assembly and executing it (in other words, it suffers from the same performance issues as any interpreted language). Despite its slow speed, the use of TI-Basic is appropriate for many simple programs.

Assumptions

This wikibook assumes that you have at least a partial understanding of the following concepts:

Versions of TI-BASIC

The two main versions of TI-Basic in use today are TI-BASIC Z80, and TI-BASIC 68K. The "Z80" and "68K" refer to the processor that the calculator uses.

  • TI-Basic Z80 comes on the TI-83, TI-83+, TI-83+ Silver Edition, TI-84+, TI-84+ Silver Edition, TI 84+ C, and TI-84 Plus CE calculators. It is the less powerful version of TI-Basic, but is still fairly versatile.
  • TI-Basic 68K that comes on the TI-89, TI 89 Titanium, TI-92, TI-92 Plus and Voyage 200 calculators. It is the more powerful version of TI-Basic.

It is important to note that these two versions are very different. Z80 syntax is less strict than 68K, but 68K has many useful features like error handling.


Next: Book Conventions
Table of Contents: TI-Basic 84 Programming

Conventions

A number of conventions are used in this book. Learning these conventions will aid in the learning process.

As this is a book designed to teach one how to program TI-Basic programs, there will be several pieces of code throughout the chapter. Thus, special boxes have been designed so that one can easily find where certain portions of code exist.

There are three main code boxes: Syntax, Examples, and Output.

Syntax

Syntax is the way a command must be stated. For example, the output function has certain restrictions. There must first be a Y coordinate, an X coordinate, and then what is to be outputted. To inform one of all these restrictions, this book would display them in the following fashion:

Output(Row,Col,Stuff
  • Where Row is a number or real variable that will determine the vertical position of Stuff.
    • Row can be a number between 1 and 8 (there are 8 lines of text on the screen)
  • Where Col is a number or real variable that will determine the horizontal position of Stuff.
    • Col can be a number between 1 and 16 (there are 16 characters across the screen)
  • Where Stuff is a string, number, equation, or variable of any type, that is to be displayed at the specified location.


Examples

Examples are just that, Examples. They are examples of the commands in use, sometimes only containing one command, sometimes containing more. Often there are more than one example for a given function, with different variations in the way the command can be used. Examples are formatted as follows

<BEGIN>

Disp "HELLO WORLD"

The previous example will always display HELLO WORLD.

<END>

Usually, but not always, there will be some sort of explanation either before or after the example.

Output

Output is merely used to show one how certain programs or functions would look on the calculator. If there is an example prior to the Output box, it is implied that the program was executed from the homescreen, but that the program name is not present (i.e. there is no pgrmPROGRAM display for each output). Outputs are displayed as follows:

<BEGIN>

HELLO WORLD

<END>

Calculator vs Computer

Code

It should be noted that the calculator screen can only show a certain amount of characters (16 characters monochrome calculators, and 22 characters for color calculators). This constraint is ignored in this book. In other words, while the code would be like this on the calculator:

Disp "Hello, Wo

rld!","My name i s Bob"

It is still written this way in this guide:

Disp "Hello, World!","My name is Bob"


Commands

It must be understood that to "type" commands (commands are all code other than strings and mathematical functions) like Disp for example, are not written by typing each character (D then i then s then p), but rather by accessing the token Disp in one of the menus built into the calculator. Most instructions are only found in certain menus.

The Disp instruction, for example, can be found by pressing PRGM, then moving to the I/O menu, and then either pressing 3 or scrolling down to it and pressing Enter. Each keypress, in order. ((NOTE: This assumes you are already in the Program Editor, this makes a big difference))

In this book, in order to shorten the commands, the above would be shown as PRGM:I/O:3.

These are the exact keys that are pressed in order to access the command, separated by a colon ':'. If a command is accessed by pressing the second key, the menu has the menu name listed first, then the actual key text listed in parenthesis.

So, in order to find Pxl-On(, the instructions would be 2nd:DRAW(PRGM):POINTS:5. the 2nd key is pressed, followed by the DRAW menu (which is really the secondary PRGM), then one navigates to POINTS, then presses 5 or finds the function Pxl-On(, on the list.

It should also be noted that most instructions can also be accessed through the Catalog, 2nd:CATALOG(0).


Previous: Introduction
Next: A Basic Program
Table of Contents: TI-Basic 84 Programming

Opening the program

To begin programming, open the Program Editor with the keystrokes PGRM:NEW. Then enter the desired name of your program and press enter. The program should be completely blank. The following examples are the only ones that will show the actual program name.

For the sake of this chapter, the program's name is TEMP.

Enter

Here's the initial screen - your clean slate.

PROGRAM:TEMP

Hitting the ENTER key will add a new line. After pressing ENTER, the screen will look like this:

PROGRAM:TEMP


Hello, World

Now, one of the most very basic programs will be created: Hello, World!

Enter the list of commands as follows:

PGRM:I/O:8 (ClrHome)
ENTER
PGRM:I/O:3 (Display)
"HELLO, WORLD!"

Make sure that "HELLO WORLD" is enclosed in quotation marks or string markers. To use them, key ALPHA +. If you followed the commands, the program should look like -

ClrHome
Disp "HELLO, WORLD!"

The ClrHome command clears the home screen, removing any clutter on it before your program started. The Disp command displays anything after it. There are other ways of displaying output, but Disp is the simplest. To run the program, press 2nd:Quit(Mode) then PGRM, find the program in the menu, and hit enter. The program name will be prefixed by 'pgrm' when displayed on the homescreen ("prgmTEMP"). Press enter again and the program will run, displaying:

HELLO, WORLD!

And that's your first program. A more thorough explanation of each command used can be found in later chapters.

To edit the program again, go to PGRM:EDIT and find the name of the program.

After toying around with the program editor for a while, you might have noticed something if you've had experience programming. There's no indentation. This may be a scary notion - after all, how do you keep track of those blocks of code? The lack of indentation does interfere with readability, but there is simply not enough screen real estate to allow for indentation. The screen resolution on your calculator is extremely poor, and individual pixels can be seen with the naked eye without squinting. Unfortunately, it's one of the things you'll just have to get used to in TI-BASIC programming.


Previous: Book Conventions
Next: Basic Variables
Table of Contents: TI-Basic 84 Programming

What are Variables?

TI-Basic is unusual among programming languages in that it does not support actual variables. Instead, all data are treated like files; there is no distinction between an ordinary number and an image, for example. TI refers to all files as "variables;" henceforth "variable" will refer to a file usable by a program. "Variables" are the meat of any programming language - they are used to store and work with data. With variables, the outcomes of programs can differ depending on the user's input or the purpose of the program. Variables in the TI calculators can store different types of data, whether it be numbers, lists of numbers, strings, mathematical functions, etc. However, each data type has its own type of variable that it can be stored in and the rules must be followed fairly strictly.

Storing and Recalling Variables

Variables can be stored and recalled at the Homescreen (the startup screen), or within a program by simply using that variable's name. For example, to recall the variable X at the Homescreen, one would simply type X and hit enter (which would display 10 if X was ten):

X
10

or to recall Str1:

Str1
HELLO WORLD

The format to recall any variable is the same.

To store a value to a variable, you simply state the value you are trying to store, hit the store key (the little arrow), then the variable you are storing to, and then hit enter. For example, making X equal to 52.5 would be as follows:

52.5→X
52.5

It should be noted that 52.5 was displayed after hitting enter on the homescreen. This is because it also recalled the value of the variable after storing it. In programming, the variable isn't actually recalled, but rather the variable is used in some sort of equation. See the individual examples for more help.

Types of Basic Variables

There are many types of variables, but in this chapter, only the most common ones will be dealt with. The Advanced Variables section, will deal with the more complex variable types and uses. The following sections will deal with:

  • Real Numbers (52.5, 100)
  • Lists (1,2,3,4,5)
  • Strings ("APPLES")

Real Numbers

For convenience in this section/chapter, it should be noted that the variables 'A' through 'Z' and the variable theta are considered to be Real Number Variables.

Real number variables store both an integer and decimal part of a number. Examples of real numbers are 0, 2.1, 5, 7.212 or 3.1415926. Reals are accurate up to eight significant digits and can be in the range of -9e99 to 9e99 (that is 9*10^99). If an attempt is tried to exceed this limit the calculator returns an error.

Syntax

To store a number to a Real Variable, the syntax is as follows:

valuevariable
  • Where value is a literal value, a variable, or an expression and
  • Where variable is the variable to store value to
    • Can be 'A' through 'Z' or 'θ'.
      • The variables are accessed by pressing the green ALPHA key, then finding the corresponding green character key on the keypad.


Ex: Literals

5.32→X

Ex: Variable

A→X

Ex: Equation

10/2+36+89/A→X

*Note: In this example, if A was 89, X would be 42, not the actual equation. Only the result of an equation is stored to X (the equation is 5+36+89/89 = 42, so X is 42)


Lists

For convenience in this section/chapter, all lists will be considered as Real Number Lists.

Lists are basically what they sound like - lists of numbers. They are considered by some to be the same as an array. They store a series of numbers that are the same data type (for this section we will assume that it is a Real Number List). The individual numbers of a list are named elements.

Syntax

{value1,value2,...,valueN}→listName
  • Where value1,value2 through valueN are real number elements
    • The number of elements (values) in a list is limited to 999 or the memory of the calculator
    • The minimum number of elements a list can contain is 0
  • Where listName is the name of a list. This can be one of two types:
    • Calculator defined: L1, L2, L3, L4, L5, L6
    • User defined: a small 'L' found via the list menu, followed by up to five characters denoting the name


Ex: Literals

{15,20,30}→L1


Ex: Custom Named list

{1,2,3,4,5}→LLIST1


Ex: List to List

L1→L2

Ex: Equations

{15,20,30}+5→L1

*Note: In this example, L1 would consist of {20,25,35} because each element was increased by five then stored to L1


Strings

Syntax

stringstrN
  • Where string is the string literal, or some other form of string to store to strN and
  • Where strN is one of the predefined strings for the calculator. These are Str1, Str2, Str3, Str4, Str5, Str6, Str7, Str8, Str9 and Str0


Ex: Literals

"MY NAME IS BOB"→Str1

Ex: Str to Str

Str1→Str2

Ex: Combination

"MY NAME IS "+Str1+" AND YOU KNOW IT!"→Str2



Previous: A Basic Program
Next: Output
Table of Contents: TI-Basic 84 Programming

Disp

Disp, PRGM:I/O:3 is a command which will display a number, string, equation or other type of variable/literal given as arguments. Disp can accept an unlimited number of arguments separated by commas (although it recommended to keep the number of arguments under 7 for monochrome calculators and 9 for color calculators because after that, for each consecutive argument the screen pushes everything else up past the top of the screen), and will display each argument following the previous line.

Syntax: Disp

:Disp [arg][,arg2][,arg3][,arg4][,…argN]
  • Where arg,arg2,arg3,arg4 and all other arguments through argN are optional parameters. The number of arguments is only limited by the calculator memory. The arguments can be either a literal or variable of any type, except for Pic0-Pic9 and GDB0-GDB9.
  • For each argument, Disp displays the argument on the next line, starting from where the cursor initially was located. If the display reaches the last line, the display will 'scroll' the rest of the screen up so that the argument can be displayed.
    • If an argument is a number, Disp displays it right-aligned
    • If an argument is a string:
      • it will display it left-aligned
      • if the string contains more than 16 characters string will be truncated and will display "..." at the end of the string
    • If an argument is too long to be displayed, the argument will be truncated and three dots will be placed at the end indicating such
  • If no argument is specified, the command just displays the home screen


Ex: Display Lines

Assuming you have a homescreen like this,

5→X
               5
X+1
               6

and you executed this program,

Disp "HELLO WORLD",52,X+1

you would have the following:

               5
X+1
               6
pgrmTEMP
HELLO WORLD
              52
               6
            Done

Ex: Empty Lines

Disp "","","HELLO WORLD"

HELLO WORLD

Ex: Truncated

Disp "THIS LINE IS TOO LONG FOR ONE LINE"
THIS LINE IS TO…

Pause

Pause, PRGM:8 displays an argument, then pauses execution afterwards.

Syntax: Pause

:Pause [value]
:Pause [value,time]
:Pause
  • When argument is given, value is some value, be it literal or variable, which Pause will display then pause execution until the enter key is pressed.
    • Pause will display value on the next line, starting from where the cursor initially was located. If the display reaches the seventh line, the display will 'scroll' the rest of the screen up so that the argument can be displayed.
  • If two arguments are given, value is displayed, and the execution waits for time seconds.
  • If no argument is given, the execution waits until the user presses enter.


Ex: Hello

Pause "HELLO WORLD"
* It should be noted that the program execution would pause until enter is pressed.

Ex: Pause

Pause
* It should be noted that the program execution would pause until enter is pressed.

Output

Output, PGRM:I/O:6 allows the display of an argument in a location other than the next line. The item to be displayed is output to the specified coordinates supplied to the function. It is useful for formatted display and it can also be used, if it is the last command of a program, to stop "DONE" from displaying.

Syntax: Output()

:Output(row,col,arg)
  • Where row is a number between 1 and 8 which determines the row location(vertically) arg is to be displayed.
  • Where col is a number between 1 and 16 which determines the column location (horizontially) arg is to be displayed
  • Where arg is the argument to be displayed. This can be a number, string or list.
    • arg is displayed from left to right
    • if arg is too long to fit on one line, the argument will carry over to the next, starting line at row+1,1.
      • if arg continues past the last line of the calculator (row 8), arg only displays the portion that fits into the screen


Ex: Basic

Output(2,3,"HELLO WORLD")

  HELLO WORLD
*HELLO WORLD is moved down one row (making it in the 2nd row) and moved right 2 times (making it in the 3rd column)

Ex: Too Long

PROGRAM:TOOLONG
Output(1,1,"THIS STRING IS TOO LONG")
prgmTOOLONG
THIS STRING IS T
OO LONG


Text()

Text, 2nd:DRAW(PGRM):0 is a command very similar to Output, except that the arguments are displayed on the graph screen rather than on the homescreen which allows a more precise location of text. In addition, Text can accept multiple arguments and will display them one after another. It also allows both the smaller font (by default) and the larger font (if -1 is the first argument) to display the arguments.

Syntax: Text() Small

This form displays the arguments in the calculator's smaller font.

Text(row,col,arg[,arg2][,arg3][,arg4][,…argN]
  • Where row is the vertical displacement of the arguments
    • For monochrome calculators, row is a number between 0 and 61, where 0 is the top of the screen, and 61 is the bottom.
    • For color calculators, row is a number between 0 and 164, where 0 is the top of the screen, and 164 is the bottom.
  • Where col is the horizontal displacement of the arguments
    • For monochrome calculators, col is a number between 0 and 92, where 0 is the very left of the screen, and 92 is the right side of the screen minus one pixel (for the run cursor)
    • For color calculators, col is a number between 0 and 264, where 0 is the far left of the screen, and 264 is the far right.


Syntax: Text() Large

This form displays the arguments in the calculator's larger font.

Text(-1,row,col,arg[,arg2][,arg3][,arg4][,…argN]
  • Where row is the vertical displacement of the arguments
    • row is a number between 0 and 61, where 0 is the top of the screen, and 61 is the bottom
  • Where col the horizontially displacement of the arguments
    • col is a number between 0 and 92, where 0 is the very left of the screen, and 92 is the right side of the screen minus one pixel (for the run cursor)



Previous: Basic Variables
Next: Input
Table of Contents: TI-Basic 84 Programming

Input

Input, PRGM:I/O:1 is a command which will display a string, and will wait for a value to be entered. It will then store that value into the provided variable once ENTER is pressed. If the only argument is a variable, then a question mark will be displayed instead of the string. And if no arguments are provided, then a cursor on the graph screen will be used to define coordinates at a given location to the variables X and Y.

Syntax: Input

:Input [string],''var''
  • Where string is either a literal string or string variable which is displayed to help determine appropriate input value
    • If string is not given, then a question mark is displayed in its place
    • If string is used, then var must also be used
  • Where var is a variable type of any {unverified} which data is stored to
  • If no argument is specified, the command will display a movable cursor on the graph screen, where when enter is pressed, the current X-coordinate of the cursor will be stored to the variable X, and the current Y-coordinate stored to the variable Y

Ex: With String Title

Input "PLEASE ENTER VALUE: ",X
PLEASE ENTER VAL
UE: 5
*The value of 5 would be stored to X.

Ex: Without String Title

Input X
?5
*The value of 5 would be stored to X.


Ex: Without Arguments

Input
* If the graph screen cursor was at 3.5 for X, and 6.2 for Y, then 3.5 would be stored to X and 6.2 stored to Y.

Prompt

:Prompt var[,var2][,var3][,var4][,…varN]
  • Where var2,var3,var4, though to varN are all optional arguments. The number of arguments is only limited by available memory. There needs to be at least one argument for it to work.
    • Each argument must be a variable name.
  • For each argument, Prompt will wait while a value is entered. Once Enter is pressed, the value will be stored to the associated variable. Then Prompt will continue on to the next argument until the end.


Ex: Two Numbers

Prompt X,Y
X=?5
Y=?7
*The X would have the value of 5 stored to it, and 7 would be stored to Y.

Ex: Other Variable Types

Prompt Str1,L2
Str1=?"ABC"
L2=?{1,2,3}
*This time, a string and a list were the variable types used.

 

using VARS you can set and pick functions Y1(requested value) 

Y-VARS Example solves for v Note: add quotes " " for equation you can also predefined equation in Y=

using VARS you can set and pick functions Y1(requested value) Template:Bcode:Y-VARS Example solves for v Note: add quotes " " for equation you can also predefined equation in Y=

Previous: Output
Next: Conditional Functions
Table of Contents: TI-Basic 84 Programming

If

If, PRGM:CTL:1 is a command that, when it's condition is true, will execute the next line of code. If the condition happens to be false, then the program will skip to the second line of code after the statement.

Syntax: If

:If condition
  • Where condition either an (in)equality (X=3, A>B), or an expression (5+2X), which resolves to be either true (non-zero) or false (zero).


Ex: If

PROGRAM:TEMP
5→X
If X>3
Disp "X IS MORE THAN 3"
Disp "END OF PROGRAM"
prgmTEMP
X IS MORE THAN 3
END OF PROGRAM


Else

Else, PRGM:CTL:3 is a command that, when a previous If statement is not met, will execute the next line of code. If the condition happens to be false, then the program will skip to the second line of code after the statement.

Syntax: Else

:If condition
:Then
://some action
:Else
://some other action
  • Else executes when the condition in the If statement is not met.

Ex: Else

PROGRAM:TEMP
5→X
If X>3
Then
Disp "X IS MORE THAN 3"
Else
Disp "X IS LESS THAN OR EQUAL TO 3"
Disp "END OF PROGRAM"
prgmTEMP
X IS MORE THAN 3
END OF PROGRAM


Then

Then, PRGM:CTL:2 is a command used to have a conditional statement (If or Then) execute a block of code as opposed to a single statement.

Syntax: Then

:If condition
:Then
://some code
://some more code
:End
  • Code block is started with a Then statement and ended with the End, PRGM:CTL:7


Previous: Input
Next: Test Conditions and Logical Operators
Table of Contents: TI-Basic 84 Programming

Nota Bene: The TI 83/84 uses any nonzero number to represent true (most often it is 1) and zero to represent false.

Test Conditions

Test Conditions are used to compare different values and form the basis of Conditional Functions.

Equal

=, TEST:TEST:1 returns true if two input values are equal and false if not equal.

Syntax

:Value 1 = Value 2
  • Where Value 1 and Value 2 are both variables of the same type.

Example

PROGRAM:TEMP
0→X
If X=0
Disp "True"
prgmTEMP
True

Not Equal

≠, TEST:TEST:2 returns true if two input values are not equal and false if they are equal.

Syntax and Example

See Equal

Greater Than

>, TEST:TEST:3 returns true if first input value is larger than second input value and false if it is less than or equal.

Syntax and Example

See Equal

Greater Than or Equal To

≥, TEST:TEST:4 returns true if the first input value is larger than or equal to the second value and false if it is greater than.

Syntax and Example

See Equal

Less Than

<, TEST:TEST:5 returns true if the first input value is smaller than the second and returns false if it is greater than or equal to.

Syntax and Example

See Equal

Less Than or Equal To

≤, TEST:TEST:6 returns true if the first input value is smaller than or equal to the second input value and returns false if it is greater than.

Syntax and Example

See Equal

Logical Operators

Logical Operators help combine multiple boolean valued statements into one.

And

In order for an "and" conditional function evaluate to true, both parts of the statement have to be true or else it returns false.

Syntax

and, TEST:LOGIC:1

:Boolean 1  and  Boolean 2
  • Where Boolean 1 and Boolean 2 are both expressions that can be evaluated to true or false.

Example

PROGRAM:TEMP
0→X
1→Y
If X=0 and Y=1
Disp "TRUE"
prgmTEMP
TRUE

Or

In order for an "or" conditional function to evaluate to true, at least one of the parts of the statement have to be true or else it returns false.

Syntax and Example

or, TEST:LOGIC:2

See And

XOr

In order for an "xor" conditional function to evaluate to true, exactly one of the values has to be true. If both of the values are true or false it evaluates to false.

Syntax and Example

xor, TEST:LOGIC:3

See And

Not

The "not" operator is a little different from the others, it only takes one value and it evaluates to the opposite.

Syntax

not(, TEST:LOGIC:4

:not(valueA)
  • valueA can be almost anything. It can be a single number since numbers represent true and false, or it can be a boolean expression that evaluates to true or false.

Example

PROGRAM:TEMP
0→X
If not(X≠0)
Disp "X EQUALS ZERO"
prgmTEMP
X EQUALS ZERO


Previous: Conditional Functions
Next: Loops
Table of Contents: TI-Basic 84 Programming

For

For, PRGM:CTL:4 is command used to perform a specific block of code a set number of times.

Syntax: For

:For(variable,starting number,stopping number,increment)
://code
://code
:End
  • Variable is some numeric variable (Ex: X). Starting number is the variable will be set as in the beginning. Stopping number is the final number that the variable will be. Increment is the amount variable will go up or down after each run-through the loop; increment has a default of 1 and can be left off.

Ex: For

First Example

PROGRAM:TEMP
For(X,0,3,1)
Disp X
End
prgmTEMP
           0
           1
           2
           3


Second Example

PROGRAM:TEMPA
For(X,3,0,-1)
Disp X
End
prgmTEMPA
           3
           2
           1
           0

While

While, PGRM:CTL:5 is a command used to have a loop run as long as a specific condition is met.

Syntax: While

:While condition
://code
://code
:End

Ex: While

PROGRAM:TEMP
          0
          1
          2
          3
prgmTEMP{{{3}}}


Previous: Test Conditions and Logical Operators
Next: Picture Variables
Table of Contents: TI-Basic 84 Programming

Pictures are a relatively easy concept to understand. A picture on your calculator is simply a state of the graph that has been saved as an image. Picture variables can be accessed under VARS:4.

Storing Pictures

To store the current graph as an image you simply go to DRAW:STO:1 press enter, then choose a number 0-9 and press enter again. The 0-9 just determines what picture variable you're using (i.e. Pic1).

StorePic 0
       OR
StorePic Pic0

Displaying Pictures

To display a picture you go to DRAW:STO:2 press enter, then choose the picture 0-9 you want to display. WARNING: This will overlay the picture over the current graph, it will not clear the graph first.

RecallPic 0
      OR
RecallPic Pic0

Creating More Complex Pictures

Sometimes one graph window is not enough to completely draw your picture. Fear not, for there is a way around this. The first step is to get as much of your picture on the graph as possible. Then save this as a picture. Clear the graph and finish the rest of your picture, overlay the previous picture and save the whole thing as its own picture variable. This can be done several times to create very intricate pictures.


Previous: Loops
Next: Graph Databases
Table of Contents: TI-Basic 84 Programming

Graph Databases (GDB) are a convenient way to store all of the settings about a current graph. A graph database will include all of the aspects necessary to reproduce the current graph as is, including the input functions, the window settings, and the graph format. GDB variables can be accessed under VARS:3.

Creating a GDB

To create a GDB you first want to set up your graph as you want it to be saved. Then access the StoreGDB method under DRAW:STO:3 press enter to bring the method to the home screen. Then enter a number 0-9 or choose a GDB variable and press enter.

StoreGDB 0
         OR
StoreGDB GDB0

Recalling a GDB

To recall a GDB you use the RecallGDB method found under DRAW:STO:4 then choose your GDB either with a number 0-9 or a GDB variable.

RecallGDB 0
         OR
RecallGDB GDB0


Previous: Picture Variables
Table of Contents: TI-Basic 84 Programming

Recursion in programs involves calling up the program to run again from the beginning. If not done carefully it can create infinite loops of code that won't terminate. If you run a program that gets stuck in a loop you can press the On button; the On button terminates execution of any program.

How to do it

Writing code that does is simple, within the program you simply have a call to the current program. The syntax is PRGM:EXEC then whatever program.

PROGRAM:TEMP
://code
://code
:prgmTEMP

If you use recursion you always want to have some condition that has to be met in order for the recursive call to happen. An easy way to do this is to encapsulate the recursive call in an "If" statement or a while loop.

Example

In this example we will write a simple counting program. Before we run this program we have to set X to a number, for this example we will assume it has been set to 0.

PROGRAM:COUNT
While X≤3
Disp X
X+1->X
prgmCOUNT

(Note: End is not needed here since the while already loops)

prgmCOUNT
       0
       1
       2
       3


Previous: Graph Databases
Table of Contents: TI-Basic 84 Programming