TI-86 BASIC Tutorial #1

Beginning programming skills

When you first turn on the calculator, you see a blank screen with a cursor in the upper left corner. This is known as the home screen. Remember that. From the home screen, hit [PRGM][F2] and then press the right letter keys to name the program and hit [ENTER]. It must be 8 characters or less. For example purposes, I'll call the program "FIRST". If done correctly, you should see this:

PROGRAM:FIRST
:Cursor


Note: I appologize for any code and screen output that isn't correctly aligned. I have more testing to do in other browsers.

That's just to give you a general idea of what you should see. There is also a menu at the bottom. From now on, I won't add in the cursor because it's not really necessary. Now, you'll learn one of the most basic but most inportant commands of all.. Disp. That controls what is displayed on the screen. To use it, just do something like this..
PROGRAM:FIRST
:Disp "I can do it!"
Then to run it, on the home screen type FIRST and it will run it. You'll see something similiar to this..
FIRST
I can do it!
                 Done

Pretty neat, huh? You now have a running program. That's good, but how do you get rid of the stuff that was on the screen before you ran the program? You'll use another basic command ClLCD. Just add it in to your program whenever you want the screen to be cleared. So..
PROGRAM:FIRST
:ClLCD
:Disp "I can do it!"
gives you..
I can do it!
                 Done
Programmer's Tip
It is perfectly legal to put more than one command on the same line. Simply separate them with a colon. Example: ClLCD:Disp "1":Output(8,1,"Hello".

Don't worry about that Done that appears, you'll learn how to get rid of it in a little bit.. Now say you want something to appear somewhere on the screen besides to the left in the row that the cursor is in. You'll use Outpt(. This is a little more tricky that the last ones.. To use it, you have to specify the location in row,column and then the text to display. So..
PROGRAM:FIRST
:ClLCD
:Disp "I can do it!"
:Outpt(4,6,"This is n
eat"
Would put..
I can do it!


     This is neat
on the screen. Notice there is no Done anymore.. Why is that? Well, if the last line of your program is an Outpt( command, it doesn't display the Done. Why? That's just the way they made it. Say you have a really long line of text to display.. If you just use Disp "This is a really long line of text", you would get the following..
This is a really lon…
It's cut off! Now what do you do? Well, you'll need to shorten it to lines that are 21 characters or less in length. So..
:ClLCD
:Disp "This is a real
ly long"
:Disp "line of text"
Would make
This is a really long
line of text
                 Done
Optimization Technique
Bytes saved per use: 5
When you have multiple Disp commands in a row, it is not necessary to start a new line and use another Disp. Instead, you can replace the new line and Disp with a comma. For example, you could change Disp "LINE 1":Disp "LINE 2" into Disp "LINE 1","LINE 2".

It's all there! Good, now you should undestand that much. Now, with the Outpt( command, it does wrap it to the next line, but you have to be careful because you might get half of a word on one line, and half on the next. But there are some practical applications for Outpt(:
PROGRAM:FIRST
:ClLCD
:Outpt(1,1,"+--------
-----------+|    A yo
ur name    ||     pro
duction    ||        
           ||        
           ||    GAME
 TITLE!    ||        
           |+--------
-----------+"
Note: The screen is only 8 rows tall, I just made it bigger so you could see the entire program.
Using that would give you the following..
+-------------------+
|    A your name    |
|     production    |
|                   |
|                   |
|    GAME TITLE!    |
|                   |
+-------------------+
Say you have over seven lines of text..
:Disp "Line 1","Line 
2","Line 3","Line 4",
"Line 5","Line 6","Li
ne 7","Line 8"
The code looks right, but if you run the program, you only see the last seven lines:
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Where did the first line go?! Well, all of the TI calculators are set to automatically scroll after seven lines. If you are going to have a lot of text to display, you need to use the Pause command after seven lines.
:Disp "Line 1","Line 
2","Line 3","Line 4",
"Line 5","Line 6","Li
ne 7"
:Pause
:Disp "Line 8"
So now, you get
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
                  <- Press [ENTER] key
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8

Now you get to see all of the lines. If you only have 8 lines, you can use the Outpt( command to put something on the last line. For example:
:Disp "Line 1","Line 
2","Line 3","Line 4",
"Line 5","Line 6","Li
ne 7"
:Outpt(8,1,"Line 8"
:Pause
would show up nicely as
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Optimization Technique
Bytes saved per use: 1
When you have a Pause command right after up to 7 Disp commands, you can save one byte because the Pause command accepts one argument. Here's an example: Disp "Line 1","Line 2","Line 3":Pause could be modified into Disp "Line 1","Line 2":Pause "Line 3"

To be continued..

The truth is that I did the TI-83/TI-84 tutorial first and just adapted it to the TI-86. I haven't gotten around to adapting the rest of the pages yet. I am considering combining these sections into one and just noting the differences between calculators.



Valid XHTML 1.1