Color BASIC

Color BASIC is the implementation of Microsoft BASIC that is included in the ROM of the Tandy/Radio Shack TRS-80 Color Computers manufactured between 1980 and 1991. BASIC (Beginner's All-purpose Symbolic Instruction Code) is a high level language with simple syntax that makes it easy for novices to write simple programs. Color BASIC is interpreted, that is, decoded as it is run. Interpreted BASIC is simple to edit and debug but execution is significantly slower than for programs written in assembly language or typical compiled languages of the time (like Pascal, compiled BASIC or C).
Background.
The nucleus of Color BASIC was Microsoft BASIC-69 which Tandy licensed from Microsoft. Color BASIC 1.0 was released with the original 4k TRS-80 Color Computer in 1980. It resides on 8k bytes of ROM, and is responsible for all 'housekeeping' duties on the system. This includes hardware initialization, memory management, interrupt processing, etc. Like most implementations of BASIC, each line of code starts with a line number and consists of one or more statements with variables and operators. 16k of memory is required for the next level of BASIC, Extended Color BASIC. ("ECB") Extended BASIC is required for the floppy disk controller, which then gives you Disk Extended Color BASIC. ("DECB") Emulators of the Color Computers running this interpreter and the others are available for modern computers, some of which require a "snapshot" file of the physical machine.
Variables.
Color BASIC understands one type of numeric variable and string variables. Variable names in Color BASIC have the first two characters significant. The first character of the variable name must be a letter. The second can be either a letter or number. String variables are indicated by adding a dollar sign ($) after the variable name.
Examples.
A=5
A$="THIS IS A STRING"
K7=10
BB$="HELLO!"
ZZ=1.54
Numeric variables have only one type, a binary floating point implementation. Each numeric variable uses 5 bytes of memory and can be in the range from -1E+38 up to 1E+37.
Unlike most implementations of Microsoft BASIC, Color BASIC requires the user to reserve space for string variables via the CLEAR statement.
Multidimensional arrays are also supported with both numeric and string variables. In the case of an array, the element address is enclosed with a parenthesis:
A(1)=1
A$(1)="BOOKS"
Multiple dimensions are separated by commas
A(1,3)=4
A$(2,2)="XYZ123"
Operators and Symbols.
Color BASIC provides several operators for both mathematic and, to a lesser extent, string operations.
Parenthesis ( ) are used to override mathematical order of operation
For testing, the following operators are used:
Other symbols used in BASIC:
Key.
"num" indicates a numeric expression is required. This can be a fixed number, a variable, or other operation or function that returns a numeric quantity.
"str" indicates a string expression is required. This can be a static string value (in quotes), a string variable, or other function or expression that returns a string of characters.
"device number" indicates a device. By default, device 0 (screen and keyboard) is assumed. In Color BASIC, device #-1 (cassette) and #-2 (printer) are available to the programmer.
Edit mode.
If you make a mistake typing in a line, you can either retype it from scratch (or DEL it).. or you can EDIT it.
When in EDIT mode, you get a reprint of the line, and a second copy that you SPACEbar across chars. You cannot use arrow keys. backspace takes you left, but does not actually erase it in the buffer. 'i' puts you in insert mode. pressing return gets you out of it. 'c' changes one char, 'd' deletes one char. 'x' takes you to end of line, allowing you to e'x'tend it. 'l' redraws the line.
Commands.
Control flow.
 FOR "{num}" = "{number}" TO "{number}" [STEP "{number}"]
 NEXT "(num)"
Documented ROM subroutines.
There are a few subroutines available for machine language programs in the Color BASIC ROM that are available for general purpose programming.