TI-Basic 84 Programming/A Basic Program

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