Donate to support Ukraine's independence.

TI-83/TI-84 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][->][->][ENTER] 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. To access the menu with the most common commands, press [PRGM]. 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 press [PRGM] and select FIRST from the menu, hit [ENTER] and it will run it. You'll see something similiar to this..
prgmFIRST
I CAN DO IT!
            Done
Optimization Technique
Bytes saved per use: 1
The quote at the end of a single Disp argument is not needed. Thus Disp "I CAN DO IT! is just as valid as Disp "I CAN DO IT!". In these tutorials, I will generally keep the last quote in to make the code easier to understand.

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 ClrHome. Just add it in to your program whenever you want the screen to be cleared. So..

PROGRAM:FIRST
:ClrHome
: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: ClrHome:Disp "1":Output(8,1,"HI".

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 Output(. 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
:ClrHome
:Disp "I CAN DO 
IT!"
:Output(4,3,"THI
S IS NEAT"
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", you would get the following..
THIS IS A REALL…
It's cut off! Now what do you do? Well, you'll need to shorten it to lines that are 16 characters or less in length. So..
:ClrHome
:Disp "THIS IS A
 REALLY"
:Disp "LONG LINE
"
Would make
THIS IS A REALLY
LONG LINE
            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 Output( 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
:ClrHome
:Output(1,1,"+--
------------+|  
A YOUR NAME ||  
 PRODUCTION ||  
            ||  
            ||  
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","LIN
E 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","LIN
E 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 Output( command to put something on the last line. For example:
:Disp "LINE 1","
LINE 2","LINE 3"
,"LINE 4","LINE 
5","LINE 6","LIN
E 7"
:Output(8,1,"Lin
e 8"
:Pause
would show up nicely as
LINE 1
LINE 2
LINE 3
LINE 4
LINE 5
LINE 6
LINE 7
LINE 8

Next tutorial



This is how we (partially) recoup costs

Valid XHTML 1.1