TI-Basic Z80 Programming/Introduction

Purpose
The purpose of this book is to teach both basic and advanced aspects of the TI-BASIC programming language. The book is designed to instruct newcomers with no previous TI-BASIC programming experience. Those who have some experience in programming can use the table of contents and appendices to inform themselves on certain aspects of the language, like optimizing code or learning the small, yet important differences between certain loop types.

Hopefully, the Wikibooks community can contribute a vast amount of useful TI-BASIC programming knowledge, which will allow this book to provide a much more in-depth look at TI-BASIC. Currently, it only provides information regarding TI-BASIC programming on the TI-83+ or 84+. Of course, the Silver Editions of the two calculators can be used with this guide (the only difference between the TI calculators and their Silver Editions is an increase in available memory).

To learn the language and programming skills from beginning to end, start with this page, the Introduction, and use the links at the bottom of each page to move on to the next chapter.

Overview
TI-BASIC is a simple programming language used on Texas Instruments (TI) graphing calculators that integrates many normal graphing calculator commands, like calculations and graphing.

TI-BASIC is a relatively easy language to learn, especially when it is compared with Assembly, the other main language used to program TI graphing calculators. Programs written in TI-BASIC, compared to programs written in Assembly, have a small file size (due to the fact that commands like If and Menu use just 1 or 2 bytes of memory). However, this makes execution of TI-BASIC programs very slow, because the calculator first reads through and parses each line of code before translating it into assembly and executing it, similar to Python. In other words, it suffers from the same performance issues as any interpreted language. Despite its sluggishness, TI-BASIC is appropriate for making many simple programs.

Conventions
A number of conventions are used in this book. Learning these conventions will aid in the learning process.

As this is a book designed to teach one how to program TI-BASIC programs, there will be several pieces of code throughout the chapter. Thus, special boxes have been designed so that one can easily find where certain portions of code exist.

There are three main code boxes: Syntax, Examples, and Output.

Syntax
The commands in TI-BASIC must be typed in a particular format. The way a command must be stated is called the syntax. For example, Output ( I/O 6) has certain restrictions. You must state the row, then the column, then the content in that order to display an output. This book explains syntax using boxes like this one:

No surprises here. TI-BASIC uses the same notation for functions as do many programming languages.

Examples
Examples are just that. They are examples of commands in use, sometimes only containing one command, sometimes containing more. Often, there is more than one example for a given function, with different variations in the way the command can be used. Examples are formatted as follows:

''Text to the right of a  //  represents a comment, used for explaining what the code is actually doing, line by line. This is only for display uses here in this Wikibook, and cannot be used in an actual program.''

Usually, but not always, there will be an explanation either before or after the example.

Output
The output is merely used to show how certain programs or functions would look on the calculator. If there is an example prior to the Output box, it is implied that the program was executed from the home screen. Outputs are displayed as follows:

The normal modes of entry can only use uppercase letters.

Code
A calculator's screen has the width and pixels to show 16 characters in a row. This constraint is ignored in examples. While the code would be like this on the calculator:

It is still written this way in examples:

Commands
In order to enter a command, like Disp, don't individually enter in the letters D i s p, but instead select the command from the program menu by pressing the key.

The Disp instruction can be found by pressing (while in the program editor) and using the right arrow key  to scroll over to the <tt>I/O</tt> menu. Then, press either to immediately paste the command to the editor or use the down arrow key  to select the <tt>Disp</tt> command, then press.

To be concise, we write <tt> I/O 3</tt> for the above. The instructions for accessing the command are included. If a command uses a menu name, it is stylized in italics. If must be pressed to open a menu, the menu will be bracketed in lieu of the actual key being pressed (e.g.,   becomes <tt> [TEST]</tt>).

As an example, to access <tt>Pxl-Off(</tt>, we write <tt> [DRAW] POINTS </tt>. Press, (this will open the <tt>DRAW</tt> screen since  was pressed), then navigate to <tt>POINTS</tt>, then press  or find the function <tt>Pxl-Off(</tt>, in the list.

Most instructions can be accessed through the Catalog <tt> [CATALOG]</tt>, although this method is usually slower. To navigate the catalog quickly, you can jump to a specific starting letter by pushing the key with the related alpha letter.