Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
TI BASIC (TI 99/4A)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Statements === The ANSI-compatible [[Statement (computer science)|statements]] of TI BASIC are <code>{{mono|DATA, DEF, DIM, END, [[For loop|FOR..TO..STEP..NEXT]], [[GOSUB]], [[GOTO]], [[Conditional (programming)|IF..THEN..ELSE]], INPUT, LET, NEXT, ON..GOSUB, ON..GOTO, OPTION BASE, PRINT, [[Random number generation|RANDOMIZE]], READ, [[Comment (computer programming)|REM]], RESTORE, [[Return statement|RETURN]], STOP}}</code>. Most of these operate in the same fashion as their MS counterparts with two additions; {{code|RANDOMIZE}} restarts the [[random number generator]] at a given "seed" value, and {{code|OPTION BASE}} sets the first entry in arrays to either 0 or 1, whereas MS is always zero-based. To this standard set it added [[Subroutine|<code>CALL</code>]], [[File descriptor#Operations on the file descriptor table|<code>CLOSE</code>]], <code>DISPLAY</code> and [[Computer file#Operations|<code>OPEN</code>]].{{sfn|Guide1981|p=i}} In keeping with the Minimal BASIC standard,<ref>{{cite tech report |url=https://www.ecma-international.org/wp-content/uploads/ECMA-55_1st_edition_january_1978.pdf |title=Minimal BASIC |date=January 1978 |publisher=ECMA}}</ref> {{code|IF}} statements could only perform branches, they could not perform arbitrary statements as was common in almost every other BASIC of the era. For instance, code such as: {{sxhl|2=basic| 100 IF X>5 THEN PRINT "IT IS LARGE" }} is not valid in TI BASIC. Instead, this would have to be performed using multiple lines: {{sxhl|2=basic|1= 100 IF X<=5 THEN 300 200 PRINT "IT IS LARGE" }} This can easily lead to [[off-by-one error]]s if the conversion is not careful about changing the sense of the boolean comparison. TI BASIC did, however, support the {{code|ELSE}} clause:{{sfn|Guide1981|p=II-51}} {{sxhl|2=basic| 100 IF X>5 THEN 200 ELSE 300 }} The {{code|PRINT}} statement used colons to separate items on different lines, in addition to the more common comma or semicolon. This precluded its use as a statement separator, a concept that TI BASIC did not have.{{sfn|Guide1981|p=II-65}} This means a line can have only a single statement. Due to the way BASIC interpreters work, {{code|GOTO}}-based loops can be sped up significantly by combining code onto a single line, which reduces the number of lines in the program and the corresponding amount of time needed to find a particular line number. This seemingly minor missing feature may result in much slower code, and adding this feature was part of TI Extended BASIC. Extensions to the Minimal BASIC system were often not represented directly in BASIC, but were instead accessed via the {{code|CALL}} command and a series of named GPL-based subroutines. For instance, {{code|CALL CLEAR}} clears the screen, and {{code|CALL KEY}} returns the keycode of the currently pressed key on the keyboard. The language lacked [[PEEK and POKE|<code>PEEK</code> and <code>POKE</code>]] so there was no official way<ref>[https://forums.atariage.com/topic/162941-assembly-on-the-994a/page/11/?tab=comments#comment-2849894 Exploit by James Abbatiello]</ref> to create new CALLable code within BASIC, to do this one would require the TI Editor/Assembler, the TI Mini Memory cartridge which included a small [[assembly language|assembler]],<ref>{{cite web |url=https://www.ninerpedia.org/wiki/Mini_Memory |title=Mini Memory}}</ref> or by using Extended BASIC.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)