TI-Basic Z80 Programming/Introduction

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Contents

[edit] Purpose

The purpose of this book is to teach both the basics and more advanced aspects of the TI-BASIC programming language. Although the book's intentions are to instruct newcomers with no previous TI-Basic programming knowledge or experience, those who have some experience in programming can use the table of contents 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 Wiki 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, this book 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.

In order to learn the language and programming skills from beginning to end, it is suggested that one starts with this page, the Introduction, and use the links at the bottom of each page to move on to the next chapter.


[edit] 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.

[edit] Syntax

Syntax is the way a command must be stated. For example, the output function has certain restrictions. There must first be a Y coordinate, an X coordinate, and then what is to be outputed. To inform one of all these restrictions, this book would display them in the following fashion:

<BEGIN>

Output(Row,Col,Stuff)
  • Where Row is a number or real variable that will determine the vertical position where Stuff
    • Row can be a number between 1 and 8 (there are 8 lines of text on the screen)
  • Where Col is a number or real variable that will determine the horizontal position of Stuff.
    • Col can be a number between 1 and 16 (there are 16 characters accross the screen)
  • Where Stuff is a string, number, equation, or variable of any type, that is to be displayed at the specified location.


<END>

[edit] Examples

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

<BEGIN>

:15→X
:If X=15
:Display "HELLO WORLD"

The previous example will always display HELLO WORLD because X will always be equal to 15.

<END>

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

[edit] Output

Output is merely used to show one 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 homescreen, but that the program name is not present (i.e. there is no pgrmPROGRAM display for each output). Outputs are displayed as follows:

<BEGIN>

HELLO WORLD

<END>

[edit] Calculator vs Computer

[edit] Code

It should be noted that the calculator screen can only show a certain amount of characters (16 characters). This constraint is ignored in this book. In other words, while the code would be like this on the calculator:

:Disp "Hello, Wo
rld!","My name i
s Bob"

It it still written this way in this guide:

:Disp "Hello, World!","My name is Bob"

[edit] Commands

In order to enter in a command, such as Disp, one does not individually enter in the letters D i s p, but instead selects the command from a menu.

The Disp instruction can be found by pressing PRGM (while in the program editor) and using the horizontal arrow keys to scroll over to the I/O menu. Then, press either 3 to immediately paste the command to the editor or use the arrow key to select the Disp command and press enter.

In this book, in order to shorten the commands, the above would be shown as PRGM:I/O:3.

These are the exact keys that are pressed in order to access the command, separated by a colon ':'. If a command is accessed by pressing the second key, the menu has the menu name listed first, then the actual key text listed in parenthesises.

So, in order to find Pxl-On(, the instructions would be 2nd:DRAW(PRGM):POINTS:5. the 2nd key is pressed, followed by the DRAW menu (which is really the secondary PRGM), then one navigates to POINTS, then presses 5 or finds the function Pxl-On(, on the list.

It should also be noted that most instructions can also be accessed through the Catalog, 2nd:CATALOG(0), although this is generally slower than retrieving the command from its proper menu.


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