TI-Basic Z80 Programming/Hello, World!

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Opening the Program Editor[edit]

To begin programming in TI-BASIC, it is first necessary to bring up the program editor. Press the PRGM button, arrow over to the NEW submenu, and press enter. Then, type in a short name for your program. Naming guidelines include:

  • Numbers can be used in the name of the program, except as the first character of the name.
  • The name is limited to 8 characters.
  • The ALPHA mode is already set to on when creating a program name.

Also note that lowercase letters or tokens, such as "sin(" are disallowed in a program name.

Press enter, and you should have a blank program:


Always, the first line (PROGRAM:NAME) simply tells you that you are editing that program. Try pressing ENTER. When you press ENTER, a new line on the program editor is created:


A colon signifies a new line of the program.

  • Colons are automatically placed by the calculator when creating a new line. These colons CANNOT be deleted, except by deleting the line itself.
  • Manually adding a colon also signifies a new line. These colons CAN be deleted.

To delete a line, go to the line above it and scroll over to the end of the line. Press DEL to delete the line. To erase code on a line, but not delete the line itself, press CLEAR.

Starting to Program[edit]

This is one of the many ways that you can write the traditional Hello, World! program in TI-BASIC. This simple program tells the calculator to display the text "HELLO, WORLD!" on the screen. To get to these commands, press PRGM while in the edit screen and press > once to get over to I/O. Then scroll down to find the correct command. You will encounter an error if you try to type these commands in with the alpha keys.




:Output(1,1,"Hello, World!")


:"Hello, World!"

Typing the Code and Explanation of It[edit]

Line by line, here's how to enter and what each command does.


Every new line in a BASIC program automatically starts with a colon (:). It's how the calculator figures out when a line ends and a new line begins. ClrHome (PRGM:I/O:8) is the instruction that clears the home screen, erasing any text or numbers that may have been on it.


Disp (PRGM:I/O:3) displays the string (whatever is in quotes.) If the screen is full, it will scroll down a line. If the string is more than 16 characters, Disp will only show the first 15 of them, followed by an ellipse (...). During execution of the program, the user will not be able to scroll and see the rest of the line if the 16 character limit is exceeded. Strings are displayed left-justified.

:Output(1,1,"HELLO, WORLD")

Output (PRGM:I/O:6) tells the calculator to display a string at the top-left corner of the screen. This usage exploits the fact that the calculator will not display "Done" if "Output" is the last command in a program. Displaying an empty string thus supresses "Done" without changing the screen.


Another way to remove the Done is to place a string or a number at the last line of the program. If the program ends after that line, it will show that string or number instead of Done.

To run this program, exit out of edit mode by pressing 2nd:MODE(Quit). Warning! On some old versions of the Operating System on the TI-83+, the calculator may crash if there are many other programs. You should update the operating system, or (preferably) program on the computer and then transfer to the calculator. Then press PRGM and move down to find the program under the name you entered. Press Enter to paste it into the homescreen, and press Enter again to run the program. You should see the following text on the screen when you run it.


If the final line is omitted, it will display:


To go back to the program editor, press PRGM, arrow over to the EDIT submenu, and press Enter when the program's name appears.

Previous: Necessary Items
Next: Basic Variables
Table of Contents: TI-Basic Z80 Programming