It has been suggested that this article should be split into articles titled TI-BASIC 83 (Z80), TI-BASIC 89 (68k) and TI-BASIC Nspire (ARM). (discuss) (February 2019)

TI-BASIC is the official[1] name of a BASIC-like language built into Texas Instruments (TI)'s graphing calculators. TI-BASIC is a language family of three different and incompatible versions, released on different products:

TI rarely refers to the language by name, but the name TI-BASIC has been used in some developer documentation.[2][3]

For many applications, it is the most convenient way to program any TI calculator, since the capability to write programs in TI-BASIC is built-in. Assembly language (often referred to as "asm") can also be used, and C compilers exist for translation into assembly: TIGCC for Motorola 68000 (68k) based calculators, and SDCC for Zilog Z80 based calculators. However, both of them are cross-compilers, not allowing on-calculator programming. TI-BASIC is considerably slower than the assembly language (because it has to be interpreted), making it better suited to writing programs to quickly solve math problems or perform repetitive tasks, rather than programming games or graphics-intensive applications. Some math instruction books even provide programs in TI-BASIC (usually for the widespread variant used by the TI-82/83/84 series).

Although it is somewhat minimalist compared to programming languages used on computers, TI-BASIC is nonetheless an important factor in the programming community. Because TI graphing calculators are required for advanced mathematics classes in many high schools and universities, TI-BASIC often provides the first glimpse many students have into the world of programming.

Wikibooks Wikibooks has textbooks on TI-BASIC programming: Programming:TI-Basic TI-Basic Programs


The syntax of all versions of TI-BASIC are somewhat different from typical BASIC implementations. The language itself has some basic structured programming capabilities, but makes limited to no use of or allowance for white space or indentation. It is also dependent on a somewhat non-standard character set, with specific characters for assignment (the right "STO" arrow, not readily available in most character sets), square and cube roots, and other mathematical symbols, as well as tokenized entry and storage for keywords. All statements begin with a colon, which also functions as a statement separator within lines. On the TI-83/84 models, closing parentheses, brackets, braces, and quotes can optionally be omitted at the end of a line or before the STO token in order to save space, although sometimes they are better left on. For example, on TI 83/84 models the for loop function runs much slower without closing parentheses in certain circumstances.[4]

Expressions use infix notation, with standard operator precedence. Many statements demand arguments in parentheses, similar to the syntax used for mathematical functions. The syntax for assignment (copying of data into a variable) is unusual with respect to most conventional programming languages for computers; rather than using a BASIC-like let statement with an equal sign, or an algol-like := operator, TI-BASIC uses a right-arrow sto operator with the syntax: source → destination. This is similar to several Japanese calculators, such as from Casio, Canon and Sharp, that have often employed a similar syntax, ever since the first mass market Japanese alphanumerical calculators appeared in the late 1970s and early 1980s.

Data types

TI-BASIC is a strongly and dynamically typed language. Available data types differ considerably between the 68k and Z80 versions. It is not possible to create user-defined data types without using a library written in assembly. Lists are often used as a replacement for structs.

TI-83/84 (Z80)

Data types that cannot be directly manipulated include:

TI-89 (68k)

Data types that cannot be directly manipulated (typing only their name on a line would result in an error) include:


Flexibility in the use of variables varies widely by the calculator model. For example, on the TI-84 Plus, all English language letters as well as theta (Θ) are available.

TI-83/84 (Z80)

On the TI-83/84, the programmer can create lists whose names are up to five characters. All other data types are limited, such as the 27 real or complex variables, and a number of predefined variable names of other types (e.g., matrices have to be one of the ten variables [A]-[J]). On the TI-83/84 certain variables such as Ans and the finance variables have fixed addresses in RAM, making them much faster to access than the 27 letter variables. Ans acts as a special variable containing the result of the last evaluated code. A line with just a variable will still be evaluated and its contents stored in Ans as a result. Because Ans is reevaluated so frequently it most often is used to store very temporary calculations or to hold values that would otherwise be slow to access such as items from a list. All variables are global.

TI-89 (68k)

In contrast, 68k calculators allow all variable names to have up to eight alphanumeric characters, including Greek. Furthermore, variables can be grouped into "folders", or made local to a program by declaring them with the Local statement.


TI-83/84 (Z80)

Z80 programmers often start lines with " (double quotation mark) to denote a comment. Lines starting with " are actually executed changing the Ans variable, but this does not affect anything other than performance unless Ans is read immediately afterwards.

TI-89 (68k)

The 68k calculators allow programs to include single-line comments, using © as a comment symbol. If a comment appears as the first line after the "Prgm" statement, it is displayed in the status bar when the program is selected in the catalog; such comments are often used to document the names or types of parameters. The 68k interpreter has a built in feature to store the number of space characters at the beginning of a line, this allows indentation.


TI-83/84 (Z80)

The Z80 version of TI-BASIC makes explicit "functions" like those in 68k impossible. However, all variables are global so functions can be emulated by setting variables, similar to arguments, before calling another program. Return values do not exist; the Return statement stops the current program and continues where the program was called.

TI-89 (68k)

The 68k version of TI-BASIC allows creating user-defined functions. Functions have the same syntax as programs except that they use the Func...EndFunc keywords instead of Prgm...EndPrgm, and that they are not allowed to use instructions that perform I/O, modify non-local variables, nor call programs. However, functions can still be non-pure because they can call built-in functions such as getTime(), getKey(), or rand(). All functions have a return value, which in the absence of an explicit Return statement is the last expression evaluated.

Third-party language extensions

Third-party applications, in chronological order Omnicalc,[5] xLIB,[6] Celtic, and Doors CS,[7] have overloaded TI-BASIC functions on the Z80 calculators to provide additional language functionality. The third-party libraries overload the sum(), real(), det() and identity() functions, which are handled and interpreted by their respective applications. Among the extra functions are fast shape-drawing routines, sprite and tilemap tools, program and VAT modification and access abilities, GUI construction features, and much more, most of which are ordinarily restricted to use by assembly programmers. All of the functions require that an application like Doors CS 7.0 be present on the user's calculator, sometimes considered a detraction to the use of the libraries.


Hello world

The following programs, when executed, will display the phrase "HELLO, WORLD!".

TI-83/84 (Z80 Series)


TI-89 (68k Series)

(P.S. this code can be shortened down to just the Disp function, like in the TI-83/84, and the hellowld, prgm, and endprgm are auto-generated.)



text "HELLO, WORLD!"

TI-Nspire CX

text "HELLO, WORLD!"

Lists and loops

TI-83/84 (Z80 Series)

:If A<1 or fPart(A)
:Input "VAR ",B

TI-89 (68k Series)

:  Local n,i,c © Declare local variables n, i, and c.
:  {}→list © Initialize list as an empty list.
:  Input "Number of variables?",n 
:  For i,1,n
:    Input "Variable #"&string(i),c © & concatenates i after it is converted to a string.
:    c→list[i]
:  EndFor

Lists have many possible names, this allows for many programs to manipulate many lists without overriding previous data. Lists on the TI-82 cannot have custom names (L1 through L6 are preprogrammed). The TI-85 and TI-86 do not have the ability to handle a variable name with subscripts. The TI-81 is completely unable to handle lists. Lists can be used by the numerous built-in TI-BASIC functions for calculating statistics, including various regression analyses and more.[1] These can be called inside of programs, however they still show the info while pausing execution and they cannot store specific results into variables.


Recursion is possible. A program can be called from within itself or from within another program.

TI-83/84 (Z80 Series)

The example below is used to compute factorials. In order for it to work, X is the parameter of the factorial function and A must equal 1.

:If X=0
:Disp A

TI-89 (68k Series)

:  Local n
:  Define fact(x)=Func
:    If x=0
:      Return 1
:    Return x*fact(x-1)
:  EndFunc
:  Input "Input a number", n
:  Disp "n! = "
:  Disp fact(n)


The 68k series makes a distinction between programs and functions. Functions are just like programs except that they do not allow statements that perform I/O, including modifying non-local variables, and they return a value, which in the absence of an explicit Return statement is the last expression evaluated.

:  If x=0
:    Return 1
:  If x<0
:    Return undef
:  x*fact(x-1)
:End Func

Editors and Tools

The growth of the hobbyist graphing calculator community in the 1990s brought with it sharing and collaboration, including the need to share TI-BASIC code on mailing lists and discussion forums. At first, this was done by typing out the TI-BASIC code from a calculator screen into a computer by hand, or conversely, entering programs manually into calculators. TI-BASIC programs are stored in a tokenized format, they cannot be edited using standard computer text editors, so as the calculator programming community matured, a need for an automated converter arose. The format for computer-stored TI-BASIC programs generated by Texas Instruments' TI-GraphLink application was eventually decoded, and third-party tools were created to manipulate these files. TI created a BASIC editor that they included in certain releases of the TI-GraphLink linking program, but it has not gained widespread usage. In particular, it used a custom character set that did not display properly when copied and pasted to fora.

In 2005, Joe Penna created OptiBASIC, a translator tool to convert text from the TI-GraphLink editor into standard Unicode. The project soon expanded to include a regex-based TI-BASIC optimizer.[8] Independently, Christopher "Kerm Martian" Mitchell of Cemetech began creating an online converter to extract plain-text (and later HTML and BBCode-formatted) contents from tokenized TI-BASIC programs,[9] which expanded to include an online program editor, exporter, and TI-83 Plus emulator.[10] The SourceCoder project absorbed OptiBASIC at the end of 2005. The only other major TI-BASIC editor currently in use is TokenIDE (or "Tokens"), created by Shaun "Merthsoft" McFall. An offline editor, Tokens can import, edit, and export TI-BASIC programs, includes tools to track program size and correctness, and offers ancillary features such as a sprite/image editor. Built around token definitions stored in XML files, it is intended to be extensible to work with any user-specified token mapping.[11]

Programmes on the NSprire series as well as TI 92 plus and Voyage 200 calculators can be transferred and saved in flat clear text (Ansi/Ascii/ISO 8859-*) format and there are several IDEs for TI calculator programming. A series of TextPad syntax definitions, code snippets, and charts are available for the TI calculators, and the syntax definitions have also been converted to the format used by the Zeus editor.[12][13] The clear text format is also used for the Lua interpreter on the calculator.

An independent project exists for developing a PC-side interpreter for the TI89-92-Voyage 200 variant of TI Basic that would allow programmes for the calculator to be run directly[14] as well as combined programmes of other languages which call this interpreter. The interpreter uses standard input, output, error and specifiable log and configuration files in console mode under Windows, and a second programme to replicate the graphics used on the calculator would be related to it in the same way as the Tk tools which are integrated with Tcl, Perl, Rexx, C and other languages. A related project for developing a Tk kind of tool for use by VBScript is the source of this tool.[14] A third tool which integrates the PC-side TI Basic with spreadsheet and database programmes via VBA and WSH engines is also envisioned. This project also involves a calculator-side Unix-style shell and Rexx and Perl interpreters, a Fortran 77 interpreter, as well as converters to go back and forth amongst the various Casio, HP, Sharp, and Texas Instruments calculator programming languages and to and from those and various scripting languages.[14]

See also


  1. ^ a b "TI-84 Plus".
  2. ^ TI-89 at
  3. ^ "Lua Scripting". Retrieved 2011-06-05.
  4. ^ Analysis of different command times.
  5. ^ Omnicalc v1.00 Released
  6. ^ Evans, Travis. xLIB by Patrick Prendergast
  7. ^ Sutherland, Nikky. Find an Oasis in Doors CS 7.0
  8. ^ "Cemetech – United-TI Archives – Project Ideas/Start New Projects – opTI-BASIC [Topic]". Cemetech archive of UnitedTI. Retrieved 2012-08-05.
  9. ^ Michael Vincent. "Martian Develops SourceCoder; Conquers BASIClings". Retrieved 2012-08-05.
  10. ^ Travis Evans. "Cemetech's SourceCoder Updated". Retrieved 2012-08-05.
  11. ^ Ryan Boyd. "TokenIDE / Shaun McFall Interview". Retrieved 2013-01-18.
  12. ^ TextPad site
  13. ^ Programming -
  14. ^ a b c "Calculator Programming Today", The Spreadsheet Vol VI, No 14, 23. November 2004 pp 5