TI BASIC (TI 99/4A)
From Free net encyclopedia
- This article is about the TI 99/4A home computer programming language. For the calculator language, see TI-BASIC (calculators) (note: hyphen between "TI" and "BASIC" in that one).
TI BASIC was a dialect of BASIC for the Texas Instruments TI 99/4A home computer, developed under contract to Microsoft by Bob Wallace and Bob Greenberg.
TI BASIC was built into the 99/4 and 99/4A, and was remarkably easy to learn. Users could access functions through this simple language that on other computers would only be available to those versed in the machines' assembly language code. Text, full screen graphics, logic operations, and recording to tape could all be accomplished using TI BASIC.
Contents |
Elements of TI BASIC
Statements
The statements of TI BASIC are CALL, CLOSE, DATA, DEF, DIM, END, FOR..TO..STEP, GOSUB, GOTO, IF..THEN..ELSE, INPUT, LET, NEXT, ON..GOSUB, ON..GOTO, OPEN, OPTION BASE, PRINT, RANDOMIZE, READ, REM, RESTORE, RETURN, STOP
Every line of TI BASIC can only contain one statement. The possibility to put several statements in a line with :: became available in TI Extended BASIC. Note that there is no POKE statement. Therefore it is not possible to load or execute machine code. (This is partially because the console, as shipped, contained only 256 bytes of CPU addressable RAM, most of which was required by the interpreter. TI BASIC stored it's program in video RAM, and could not take advantage of memory expansion.)
Functions
- ABS Absolute value
- ATN Arctangent
- CHR$ Convert a number into a string with an ASCII character
- COS Cosine
- EOF Test whether the end of a file has been reached
- EXP Exponentiation
- INT greatest integer less than or equal to the parameter
- LEN Length of a string
- LOG Natural logarithm
- POS First occurrence of a string in another string
- RND Pseudorandom number generator
- SGN Sign function
- SIN Sine
- SQR Square root
- STR$ Convert a number to a string
- TAN Tangent
- VAL Convert a string to a number
Subprograms
Subprograms are called with CALL statement (e.g. CALL CLEAR). There are no user defined subprograms (This is possible in TI Extended BASIC), but some subprograms are predefined:
- CHAR Definition of graphical characters
- CLEAR Clears the screen
- COLOR Defines foreground- and background color for 8 characters
- GCHAR Reads one character at a specified position from the screen
- HCHAR Writes a character to a screen position and repeats it horizontally
- JOYST Returns the position of the joystick
- KEY Reads from the keyboard without echo on the screen
- SCREEN Changes the color of the screen
- SOUND Creates sounds (using a frequency) and noise
- VCHAR Writes a character to a screen position and repeats it vertically
TI Extended BASIC
TI also produced an Extended BASIC cartridge that greatly enhanced the functionality accessible to BASIC users. Sprites could be generated and set up to move automatically with simple one-line commands. Custom 'CALL' subprograms, access to memory expansion for larger programs, multiple statement lines, boolean logic in IF statements, assembly language linkage, as well as the ability to display text at any location on the screen, were all added while largely retaining compatibility with TI BASIC. When equipped with the TI Speech Synthesizer, TI Extended BASIC users could also generate speech from a predefined vocabulary as easily as writing text on-screen. Extended BASIC also provided raw access to the speech synthesizer, but very few developers had the resources to generate the speech data and this function was rarely used.
Execution speed
One serious shortcoming of TI BASIC was that, as an interpreted rather than compiled language, it ran very slowly. In fact, TI BASIC was a double interpreted language, as the BASIC interpreter was itself written in an mid-layer interpreted byte-code language known as Graphics Programming Lanaguage (GPL), which was unique to the TI home computer.
TI Extended BASIC improved execution speed somewhat by providing some functionality in assembly lanaguage, but not enough to permit programmers to create animation for smooth, responsive gameplay.de:TI BASIC (Texas Instruments TI 99/4A)