Programing TI Basic
This page is designed to be a short tutorial in the basics of writing your own program on the TI 83. You can use this to program on the 86 as long as you take note of the differences between the two versions. Please also take note that this site is under construction and my final work should be easier to navagate. I do plan to add more as far as content.
Basic Logic:
The If/Then/Else/End commands will be the very basic structure of any logic you need. First you have an If statement such as this:
:If A=1
After that depends on how much you what your program to do. If you have just one line of code that you need the program to do if the statement is true, you do not need to use the 'Then' nor the 'End' commands:
:If A=1
:A-1->B
If you need it to execute more that on line, this is when you use the 'Then' command. After that you can put in as many lines as you need. But to close the If statement you need to use the end command such as the following statement:
:If A=1
:Then
:A-1->B
:B-1->A
:End
The Else command is used as a back up to your If statement. It will execute the code after the Else statement only if the If statement is false. The Else command also needs to be closed with an End.
:0->A
:If A=1
:2->A
:else
:1->A
:End
or like this:
:0->A
:If A=1
:Then
:2->A
:Goto B
:End
:Else
:1->A
:End
Labeling:
The next thing you need to know is how to structure your code. To do this you can use the commands 'Lbl' and 'Goto'. The Lbl must be followed by a number or a letter, which can be up to 2 characters long.
:Lbl A
:Goto A
The above code would create an infinite loop, when the Goto A is read, the program will be sent back up to Lbl A.
Ending your program:
If you need to have it quit before it reaches the end of your code, you can use the method above by having the program Goto a Label at the end of the code. An even faster way is just to enter in the command 'Stop'.
Displaying to the screen:
You'll also need some way to have your program tell the user what it's doing or finished doing. First of all you may want to clear the home screen of anything else that might be there. The command 'ClrHome' will do just that. Next, to display information you'll need to know how to work the 'Disp' command and the 'Output()' function.
'Disp' can display one thing or several things separated by commas. To display text to the screen, you need to put quotation marks around the text, like this:
:Disp "HELLO"
To display numbers just replace the "HELLO" with the number you want. More usefull than that is displaying variables, and equations. You can do so just like this:
:Disp A,B
:Disp A+B
This displays the value that your variable has and the value of the computation respectively.
The downside to the 'Disp' is that it displays one item to each line on the screen. If you want to have several things on the same line, you'll need to use the 'Output()' function. This function takes 3 arguements: the row number, the column number, and then the information to be outputed. For example to output HELLO WORLD to the screen we can use either one of these ways:
:Disp "HELLO WORLD"
or
:Output(1,1,"HELLO")
:Output(1,7,"WORLD")
The output for HELLO will start on the row 1 and column 1, the output for WORLD will start on row 1 and column 7(skiping over the word HELLO and 1 space)