Back to TI-99 page
TI-CC-40 BASIC, TI-99/4 BASIC, and TI-99/4 Extended BASIC
Commands and Statements
This TI BASIC manual is a breif manual on most commands and is a work in progress.
ABS(numeric-experssion)
[TI-99/4 BASIC, TI-CC-40 BASIC and TI-99/4 Exteneded BASIC]
Also [ANSI BASIC][Atari BASIC][GW-BASIC]
Returns absolute value. Always a non negative number.
Examples:
>100 PRINT ABS(42.3)
>100 VV=ABS(-6.124)
>100 PRINT ABS(-3*2); ABS(-4.5)
ACCEPT
[TI-CC-40 BASIC and TI-99/4 Exteneded BASIC only]
Allow input from anywhere on the screeen, unlike the INPUT statement,
Examples:
>100 ACCEPT AT(5,7):Y
>100 ACCEPT VALIDATE("YN"):R$
>100 ACCEPT ERASE ALL:B
>100 ACCEPT AT(R,C)SIZE(FIELDLEN)EEEP VALIDATE(DIGIT,"AYN"):X$
ASC(string-expression)
[TI 99-4 BASIC, TI-CC-40 BASIC, and TI-99/4 Exteneded BASIC]
Also [Atari BASIC][GW-BASIC]
Returns the ASCII code of the first character in the string expression.
Example:
>100 CHAR1 = ASC(STRING$)
ASN(numerian-expression)
[TI-CC-40 BASIC only]
The ASN (arcsine) function calculates the angle whose sine is numeric-expression.
Example:
>100 B = ASN(.9)
ATN(radian-expression)
[TI-99/4 BASIC, TI-CC-40 BASIC, and TI-99/4 Exteneded BASIC]
Also [ANSI BASIC][Atari BASIC][GW-BASIC]
Returns trigonometric Arctangent - the angle (in radians) whose tangent is x.
Examples:
>100 PRINT ATN(.4)
>100 PRINT ATN(5)
BREAK |line-list|
[TI-99/4 BASIC, TI-CC-40 BASIC, and TI-99/4 Exteneded BASIC]
Causes the program to halt. As an option, lines where breaks are desired may be listed.
BYE
[TI-99/4 BASIC and TI-99/4 Exteneded BASIC - NOT TI-CC-40 BASIC]
Closes open files. Exits TI Basic
CALL CHAR(character-code, pattern-identifier-string)
[TI-99/4 BASIC, TI-CC-40 BASIC, and TI Exteneded BASIC]
TI BASIC Execution Time(ms): 115 to 131
Allows you to define your own graphics characters.
Character-code is the ASCII value.
With TI BASIC
You can define the standard set of ASCII codes 32-127 and establish additional characters with codes 128-159.
With TI Extended BASIC
You can define the standard set of ASCII codes 32-127 and establish additional characters with codes 128-143.
The Pattern-identifier-string is an up-to 16-character string expression which
specifies the pattern of the character wyou want to use in your program.
A character has 64 pixels in an 8-by-8 grid on TI-99/4 and TI-99/4A
A character has 40 pixels in an 5-by-8 grid on TI CC-40
Each character in the string expression describes the patter of the pixes in one block of a row.
Examples:
> 100 CALL CHAR(128,"FF0110FF0220AAFF")
> 100 CALL CHAR(33,"00FF00FF")
CALL CLEAR
[TI-99/4 BASIC and TI-99/4 Exteneded BASIC - NOT TI-CC-40 BASIC]
TI BASIC Execution Time(ms): 44
Clears the screen.
CALL COINC(#sprite-number,#sprite-number,tolerance,numeric-variable)
CALL COINC(#sprite-number,dot-row,dot-column,tolerance,numeric-variable)
CALL COINC(ALL,numeric-variable )
[TI-99/4 Exteneded BASIC only]
CALL COINC detects when two sprites touch.
-1 is true, there is coincidense (touching)
0 if false, there is NO coincidense
Examples:
>100 CALL COINC(#1,#2,10,C)
>100 CALL COINC(ALL,C)
CALL COLOR(character-set, foreground-color, background-color)
[TI-99/4 BASIC and TI-99/4 Exteneded BASIC - NOT TI-CC-40 BASIC]
TI BASIC Execution Time(ms): 48
Changes the foreground and background colors of the character set.
Character-Sets
SET # ASCII Character Values
1 32 - 39
2 40 - 47
3 48 - 55
4 56 - 63
5 64 - 71
6 72 - 79
7 80 - 87
8 88 - 95
9 96 - 103
10 104 - 111
11 112 - 119
12 120 - 127
Color Codes (foreground and background)
Value Color
1 Transparent
2 Black
3 Medium Green
4 Light Green
5 Dark Blue
6 Light Blue
7 Dark Red
8 Cyan
9 Medium Red
10 Light Red
11 Dark Yellow
12 Light Yellow
13 Dark Green
14 Magenta
15 Gray
16 White
CALL GCHAR (row, column, numeric-variable)
[TI-99/4 BASIC and TI-99/4 Exteneded BASIC - NOT TI-CC-40 BASIC]
TI BASIC Execution Time(ms): 48
Returns the ASCII code of the character located at specified row (1-24) and column (1-32).
CALL HCHAR (row, column, character-code |, repetition|)
[TI-99/4 BASIC and TI-99/4 Exteneded BASIC - NOT TI-CC-40 BASIC]
TI BASIC Execution Time(ms): 48 to 82
Places ASCII character at specified row (1-24) and column (1-32) and optionally repeats it Horizontally.
CALL JOYST (key-unit, x-return, y-return)
[TI-99/4 BASIC and TI-99/4 Exteneded BASIC - NOT TI-CC-40 BASIC]
TI BASIC Execution Time(ms): 57
Inputs data based on the x (-4,0,4) and y (-4,0,4) position of the specified key-unit (1-4).
Examples:
>100 CALL JOYST(1,X,Y)
>100 CALL JOYST(2,COLRET,ROWRET)
CALL KEY (key-unit, return-variable, status-variable)
[TI BASIC and TI Exteneded BASIC]
TI BASIC Execution Time(ms): 51
specified key-unit (0-5)
return-variable = function assigns ASCII code of key pressed on.
Commonly used with key-unit 0:
[ENTER] = 13
[space] = 33
A = 65
B = 66
C = 67
D = 68 [right arrow]
E = 69 [up arrow]
S = 83 [left arrow]
X = 88 [down arrow]
Status-Variable Meanings:
1 = new key pressed
-1 = same key pressed
0 = no key pressed
Example:
>100 CALL KEY(0,K,S)
CALL SCREEN (color-code)
[TI BASIC and TI Exteneded BASIC]
TI BASIC Execution Time(ms): 36
Changes screen color to that specified by the color-code.
Color Codes (foreground and background)
Value Color
1 Transparent
2 Black
3 Medium Green
4 Light Green
5 Dark Blue
6 Light Blue
7 Dark Red
8 Cyan
9 Medium Red
10 Light Red
11 Dark Yellow
12 Light Yellow
13 Dark Green
14 Magenta
15 Gray
16 White
CALL SOUND(duration, frequency 1, volume 1, |freq2, volume2|, |freq3, volume3|, |freq4, volume4|)
[TI-99/4 BASIC and TI-99/4 Exteneded BASIC - NOT TI-CC-40 BASIC]
Controls up to three tone and one noise generators. Tone and noise parameters can occur in any order. Negative duration causes immediate sound update.
Duration:
1 thru 4250ms
Frequency:
110 thru 44733 Hz (cycles/sec.) for tone
-1 thru -8 for noise
Volume:
0 (loudest) thru 30 (softest)
Examples:
>100 CALL SOUND(100,294,2)
>100 CALL SOUND(-500,TONE,1)
>100 CALL SOUND(+500,TONE,1)
>100 CALL SOUND(1000,440,2)
>100 CALL SOUND(500,-1,2)
>100 CALL SOUND(2500,440,2,659,5,880,10,-6,15)
CALL SPRITE(#sprite-number, character-value, sprite-color,dot-row,dot-column )
[TI-99/4 Exteneded BASIC only]
Create a moving sprite.
Sprite number is a numeric number between 1 and 28. (up to 28 sprites on the screen)
If two sprites are in the same location, the sprite with the lowest number will conver the other sprite.
Character value is the ASCII code of graphic being displayed as sprite between 32 and 143.
Sprite color between 1 and 16:
Color Codes (foreground and background)
Value Color
1 Transparent
2 Black
3 Medium Green
4 Light Green
5 Dark Blue
6 Light Blue
7 Dark Red
8 Cyan
9 Medium Red
10 Light Red
11 Dark Yellow
12 Light Yellow
13 Dark Green
14 Magenta
15 Gray
16 White
Dot Row and Dot Column is starting location of Sprite.
Dot Row is a number between 1 and 192.
Dot Column is a number between 1 and 256.
CALL VCHAR (row, column, character-code |, repetition|)
[TI-99/4 BASIC and TI-99/4 Exteneded BASIC - NOT TI-CC-40 BASIC]
TI BASIC Execution Time(ms): 50 to 103
Places ASCII character at specified row (1-24) and column (1-32) and optionally repeats it vertically.
Note: CALL VCHAR is slower than CALL HCHAR.
CHRS$ (numeric-expression)
[TI BASIC and TI Exteneded BASIC]
Returns the string character corresponding to the ASCII code
CLOSE #file-number |:DELETE|
[TI BASIC and TI Exteneded BASIC]
Discontinues association between a file and a program and optionally erases a file.
CONTINUE
CON
[TI BASIC and TI Exteneded BASIC]
Resumes execution after breakpoint has been encountered.
COS (radian-expression)
[TI BASIC and TI Exteneded BASIC]
Also [ANSI BASIC][Atari BASIC][GW-BASIC]
Returns trigonometric cosine.
Example:
>100 X = 2*COS(.4)
DATA data-list
[TI BASIC and TI Exteneded BASIC]
Stores numeric and string constant data in a program.
DEF function-name |(parameter)| = expression
[TI BASIC and TI Exteneded BASIC]
Associates user-defined numeric or string expression with function name.
DELETE file-name or program-name
[TI BASIC and TI Exteneded BASIC]
Removes program or file from computer's filing system.
DIM {array-name (integer1|,integer2|,integer3|}...
[TI BASIC and TI Exteneded BASIC]
Dimensions the listed arrays as specified by integers.
DISPLAY |print-list|
[TI BASIC and TI Exteneded BASIC]
DISPLAY is the same as PRINT statment when used to print items on screen.
DISPLAY does not write to any other device like PRINT
Example:
>100 DISPLAY B$:A;C
EDIT line number
[TI BASIC and TI Exteneded BASIC]
Displays a line for editing.
END
[TI BASIC and TI Exteneded BASIC]
Also [ANSI BASIC][Atari BASIC][GW-BASIC]
Terminates program execution.
EOF (numeric-expression)
[TI BASIC and TI Exteneded BASIC]
Returns the end-of-file condition of the specified file.
0 = not end-of-file
1 = logical end-of-file
-1 = physical end-of-file
EXP (numeric-expression)
[TI BASIC and TI Exteneded BASIC]
Returns the exponential value of the argument.
FOR control-variable=initial-value TO limit |STEP increment|
[TI BASIC and TI Exteneded BASIC]
Also [ANSI BASIC][Atari BASIC][GW-BASIC]
Repeats execution of statements between FOR and NEXT until the control-variable exceeds the limit. STEP default is one.
Examples:
>100 FOR X=1 TO 5
>110 PRINT X
>120 NEXT X
>100 FOR I=2 TO -3 STEP -1
>110 PRINT I
>120 NEXT I
GOSUB line-number
[TI BASIC and TI Exteneded BASIC]
Also [ANSI BASIC][Atari BASIC][GW-BASIC]
Transfers control to a subroutine at specified line-number until RETURN encountered.
Example:
>100 GOSUB 200
GOTO line-number
[TI BASIC and TI Exteneded BASIC]
Also [ANSI BASIC][Atari BASIC][GW-BASIC]
Unconditionally branches to the specified line-number.
Also used with IF
IF {relational-expression or numeric-expression} THEN line-number1 |ELSE line-number2|
Transfers control to line-number1 if the relational expression is true or the numeric expression is not equal to zero.
If false or equal to zero, control passes to the next statement or optionally to line-number2.
Example:
>100 GOTO 200
INPUT
INPUT |input-prompt:|variable-list
[TI BASIC and TI Exteneded BASIC]
Also [ANSI BASIC][Atari BASIC][GW-BASIC]
Suspends program execution until data is entered from the keyboard. The operational input-prompt indicates data to be entered.
INPUT #file-number|,REC record-number|:variable-list
[TI BASIC and TI Exteneded BASIC]
Assigins data from specified file to the listed variables. Records are read sequentially unless an optional REC clause is used.
INT (numeric-expression)
[TI BASIC and TI Exteneded BASIC]
Returns greatest integer less than or equal to the argument.
LEN (string-expression)
[TI BASIC and TI Exteneded BASIC]
Returns the number of characters in the string expression.
[LET] {numeric-variable = numeric expression or string-variable = string-expression}
[TI BASIC and TI Exteneded BASIC]
Assigns the value of an expression to the specified variable.
LIST line-number or line-number1-line-number2 or -line-number or line-number-
[TI BASIC and TI Exteneded BASIC]
Sequentially displays program statements and optionally a single line number or all lines between the specified line numbers.
For example, if you only want to see the head of the program, you could type:
>LIST 1-200
While typing just LIST will display the entire code.
LOG (numeric-expression)
[TI BASIC and TI Exteneded BASIC]
Returns natural logarighm.
NEW
[TI BASIC and TI Exteneded BASIC]
Clears memory and screen and prepares the computer for a new program.
Note: What is not saved, will be lost.
NEXT control-variable
[TI BASIC and TI Exteneded BASIC]
Also [ANSI BASIC][Atari BASIC][GW-BASIC]
(See FOR statement.)
The NEXT statement is always paired with the FOR statement for contruction of a
loop.
Example:
>100 FOR X=1 TO 5
>110 PRINT X
>120 NEXT X
NUMBER or NUM |initial-line,increment|
[TI BASIC and TI Exteneded BASIC]
Automatically generates sequenced line numbers starting at 100 in increments of 10. Optionally, an initial line and/or increment may be specified.
OLD file-name
[TI BASIC and TI Exteneded BASIC]
Loads a program from a mass storage device into the computer's memory.
Commonly used:
CSX where X is the number of the cassette recorder being used.
DSKX where X is the number of the disk drive being used.
ON
ON numeric-expression GOSUB line-number-list
[TI BASIC and TI Exteneded BASIC]
Transfers control to the subroutine with a beginning line number in the position corresponding to the value of the numeric expression.
ON numeric-expression GOTO line-number-list
[TI BASIC and TI Exteneded BASIC]
Unconditionally branches to line number in the position corresponding to the value of the expression.
OPEN #file-number:file-name |,file-organization|,file-type|,open-model| |,record-type|
[TI BASIC and TI Exteneded BASIC]
Prepares a program to use specified file.
file-number: 0-255
file-organization: SEQUENTIAL or RELATIVE
file-type: DISPLAY or INTERNAL
open-mode: INPUT, OUTPUT, UPDATE, or APPEND
record-type: FIXED or VARIABLE
OPTION BASE {0 or 1}
[TI BASIC and TI Exteneded BASIC]
Sets the lowest allowable subscript of arrays to zero or one. Default is zero.
POS (string1, string2, numeric-expression)
[TI BASIC and TI Exteneded BASIC]
Returns the position of string2 in string1. Search begins at position specified by numeric expression. Returns zero if no match is found.
PRINT {|print-list | #file-number |,REC record-number| or :print-list}
[TI BASIC and TI Exteneded BASIC]
Also [ANSI BASIC][Atari BASIC][GW-BASIC]
TI BASIC Execution Time(ms): 100 to 440
Outputs to the display screen and optionally to an external file or device. The REC clause directs output to the specified record number.
; can be used between numbers and strings
& can be used between strings
: creates a new line in the output
Examples:
>100 PRINT "HELLO WORLD"
>100 PRINT A;" ";B
>100 PRINT A$&" "&B$
>100 PRINT A$:B$
RANDOMIZE |seed|
[TI BASIC and TI Exteneded BASIC]
Resets random number generator to an unpredictable sequence. With optional seed (numeric-expression), the sequence is repeatable.
READ variable-list
[TI BASIC and TI Exteneded BASIC]
Assigns number and string constants in DATA statements to variables listed.
REM
[TI BASIC and TI Exteneded BASIC]
Also [ANSI BASIC][Atari BASIC][GW-BASIC]
Program documentation. Documentation can be entered after the statement without effecting the program.
Example:
>100 REM THIS LINE DOES NOTHING
RESEQUENCE or RES |initial-line| [,increment]
[TI BASIC and TI Exteneded BASIC]
Renumbers program statements starting at 100 in increments of 10. Optionally an initial line number and/or increment may be specified.
RESTORE { #file-number|, REC record-number | |line-number}
[TI BASIC and TI Exteneded BASIC]
Indicates the record or line from which data will be read. If no options, the beginning of a file or first data statement will be read next.
RETURN
[TI BASIC and TI Exteneded BASIC]
Also [ANSI BASIC][Atari BASIC][GW-BASIC]
Transfers program control from subroutine to statement following corresponding GOSUB or ON . . . GOSUB statement.
RND
[TI BASIC and TI Exteneded BASIC]
Generates a random number that is between zero (inclusive) and one.
RUN |line-number|
[TI BASIC and TI Exteneded BASIC]
Starts program execution at the lowest numbered statement or optionally at the specified line number.
SAVE [file name]
[TI BASIC and TI Exteneded BASIC]
Saves a copy of the program that is currently in memory on the specified device.
Commonly used:
CSX where X is the number of the cassette recorder being used.
DSKX where X is the number of the disk drive being used.
SEG$ (string-expression, position, length)
[TI BASIC and TI Exteneded BASIC]
Returns a substring of the string-expression that starts at position and is as long as that specified by the length.
SGN (numeric-expression)
[TI BASIC and TI Exteneded BASIC]
Returns 1 if the numeric-expression is positive, 0 if it equals zero, and -1 if the numeric-expression is negative.
SIN (radian-expression)
[TI BASIC and TI Exteneded BASIC]
Returns the trigonometric sine.
SQR (numeric-expression)
[TI BASIC and TI Exteneded BASIC]
Also [ANSI BASIC][Atari BASIC][GW-BASIC]
Returns the square root.
STOP
[TI BASIC and TI Exteneded BASIC]
Stops program execution.
STR$ (numeric-expression)
[TI BASIC and TI Exteneded BASIC]
Converts the value of the numeric-expression into a string.
TAB (numeric-expression)
[TI BASIC and TI Exteneded BASIC]
Sets the column position of the output of a DISPLAY or PRINT statement.
TAN (radian-expression)
[TI BASIC and TI Exteneded BASIC]
Also [GW-BASIC]
Returns the trigonometric tangent where x is an angle in radians.
Example:
>100 PRINT TAN(B*(4*ATN(1))/180)
TRACE
[TI BASIC and TI Exteneded BASIC]
Lists line numbers of statements before they are executed.
UNBREAK |line-list|
[TI BASIC and TI Exteneded BASIC]
Removes either all breakpoints or those listed.
UNTRACE
[TI BASIC and TI Exteneded BASIC]
Cancels the TRACE command.
The UNTRACE command may be used as a statement in a program.
VAL(string-expression)
[TI BASIC and TI Exteneded BASIC]
Also [Atari BASIC][GW-BASIC]
Converts the string-expression into a numeric value.
Must be a string less than 255 characters.
Example:
>100 PRINT VAL(P$);VAL(N$)
>100 PRINT VAL("52"&".5")