# All Science Fair Projects

## Science Fair Project Encyclopedia for Schools!

 Search    Browse    Forum  Coach    Links    Editor    Help    Tell-a-Friend    Encyclopedia    Dictionary

# Science Fair Project Encyclopedia

For information on any area of science that interests you,
enter a keyword (eg. scientific method, molecule, cloud, carbohydrate etc.).
Or else, you can start by choosing any of the categories below.

# TI-BASIC (calculators)

TI-BASIC is the unofficial name of a BASIC-like language built into Texas Instruments graphing calculators (TI only refers to it as the calculators' "extensive programming capability"). This is the simplest way to program any TI calculator although assembly language may also be used (most often Z80 assembly). On the TI-89 and higher calculators (with a Motorola 68000 processor) you can also use C, through a compiler called TIGCC. Although TI-BASIC is considerably slower than C or assembler and consequently is not much good for programming fast applications and games, it is very useful for quickly writing programs to solve math problems.

## Examples of TI-BASIC

(for the Z80-based models)

The following program, when run, will clear the screen and print the words "HELLO WORLD":

```:ClrHome
:Disp "HELLO WORLD"
```

The next program will add the integers from 1 to 20 inclusive, and store the result to variable "A". It will then display the contents of A on a blank screen:

```:Clrhome
:0->A
:For X,1,20
:A+X->A
:End
:Disp A
```

This one will tell the user the numerical value of any button pressed except the 'on' key, and will continue to loop until the calculator is turned off.

```:ClrHome
:Lbl 1
:getKey A
:While A=0
:getKey A
:End
:ClrHome
:Disp A
:Goto 1```

A common feature of TI-BASIC game programming is programming the arrow buttons to move an object on the screen. This program will draw a dot on on the screen that will move according to which arrow buttons you press.

```:ClrDraw
:-47 -> Xmin
:47 -> Xmax
:-31 -> Ymin
:31 -> Ymax
:0 -> X
:0 -> Y
:Lbl 1
:Pt-Off(X,Y)
:getKey -> C
:If C = 24
:X-1 -> X
:If C = 25
:Y+1 -> Y
:If C = 26
:X+1 -> X
:If C = 34
:Y-1 -> Y
:Pt-On(X,Y)
:Goto 1```

However, this code is both large and slow. Attempts have been made to optimize TI-Basic. The program below does the same thing as the program above, yet is far smaller, and possibly somewhat faster.

```:ClrDraw
:-47 -> Xmin
:47 -> Xmax
:-31 -> Ymin
:31 -> Ymax
:0 -> X
:0 -> Y
:Repeat 0
:Pt-Off(X,Y
:getKey -> C
:X+(C = 26)-(C = 24) -> X
:Y+(C = 25)-(C = 34) -> Y
:Pt-On(X,Y
:End```