TI-Basic Z80 Programming/Hello, World!

Opening and Navigating the Program Editor
To begin coding TI-BASIC on your calculator, you must use the program editor. This allows you to edit, manage, and run your programs. To access it, press  NEW . Then, type in a short name for your program. The names for programs must follow these rules:

Press, and an empty program will appear. In the following example, the program has been named :
 * Must include only uppercase letters and numbers, where the first character must be a letter
 * Cannot include any other tokens, such as symbols or math functions
 * Maximum length of 8 tokens long

To navigate the program editor, use the arrow keys to move the cursor, which is represented by a blinking black box. Press to move the cursor down a line, or to create a new line if the cursor is at the bottom-most line. To insert a line at any point, move the cursor to the end of the line above where the new line should be inserted. Then press  [INS] . To clear a line, press. Press on any empty line to delete it.

Always, the first line on the screen shows the name of the program. It is not a line in the code, but rather a header to show the name of the current program. Press. Now, a new line on the program editor is created:

In TI-Basic, colons are used to signify new lines.
 * 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 run a program, you need to first exit the program editor. Press  [QUIT] to return to the home screen. Press and use the up and down arrows to select your program. Now, press twice: once to paste it to the home screen and second to execute it.

To stop a program during execution, press the key and an error will be thrown, stopping the program.

Hello, world!
Now that you have learned how to navigate and perform simple edits on a program, now we will program our first program: the "hello world." This simple program tells the calculator to display the text  on the screen.

Now, let's break down each line of this program and understand how it works.

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

Disp ( I/O 3) displays a variable, value, or string to the screen. If the screen is full, it will scroll down a line. If the string is more than 16 characters, <tt>Disp</tt> will only show the first 15 of them, followed by an ellipse (…). During the execution of the program, you will not be able to scroll and see the rest of the line if the 16 character limit is exceeded. Strings are displayed left-aligned, and values are displayed right-aligned.

In order to add quotation marks (<tt>"</tt>), press.

In this example, the string  is printed to the screen.

Alternate Method
Another command offered for printing to the screen is the <tt>Output</tt> (<tt> I/O 6</tt>) command. This command offers more arguments to specify where on the screen to print.

Here's how to use this command in the "hello world" program. It prints  at row 1 column 1:

This program will result in the same output.

You try it!
Try these examples to practice the <tt>Disp</tt> and <tt>Output</tt> commands.

Poem
Use the <tt>Disp</tt> commands to print a simple poem to the screen. Your poem should be 7 or fewer lines to fit on the screen (if you try to print an 8th line, the first line will move off the screen).

This example poem will print to the screen:

Centered Text
Using <tt>Output</tt>, replicate the following output exactly. You will need to use the command more than once.