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 to write simple programs. Color BASIC is interpreted, that is, decoded as it is run.
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.[2]
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.
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:
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.
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. 's' searches for the next instance of a character. For the 's', 'c' and 'd' commands you can also enter a number (#) before pressing any of them which will: 's' - search for the # instance of the character, 'c' - allow you to change # of characters, 'd' - delete # amount characters.
returns the value of the memory location num (0-65535)
POINT(x num,y num)
returns the color of the semigraphics dot at position x numm (0-63) and y num (0-31)
RIGHT$(str,position num)
returns the end ("right") portion of string str beginning at character position num
RND(number)
returns a random number (integer) between 1 and num
SGN(num)
returns the sign of a number num, 1 if positive, -1 if negative, 0 if 0
SIN(num)
returns the sine of num in radians
STR$(num)
returns a string of the number num
USR(num)
calls a machine languagesubroutine whose address is stored in memory locations 275 and 276. num is passed to the routine, and a return value is assigned when the routine is done
Connects or disconnects cassette audio from the TV sound
CLEAR variable space[,highest memory location]
reserves memory for string variables, and optionally, a machine language program
CLOAD ["name"]
loads BASIC program from cassette. If no name is specified, the next program is loaded
CLOADM ["name"]
loads machine language program from cassette. If no name is specified, the next program is loaded
CLOSE [device number]
closes a device (in Color BASIC this can only be #-1, the cassette)
CLS(num)
clears the screen. An optional color num (0-8) can be specified
CONT
continues a program after pressing BREAK or a STOP statement
CSAVE ["name"]
saves a BASIC program to cassette with optional name
DATA var,var,var...
stores data in a BASIC program for retrieval with the READ command
DIM variable(dimension[,dimension 2,...]
dimensions an array and reserves memory space for it
END
indicates the end of a BASIC program
EXEC
[memory address] executes the machine language program at memory address. If none specified, the execute address of the program loaded off tape is used
Waits for input from device number. If not specified, device 0 (keyboard) is assumed. An optional prompt can be printed on the screen for the input statement
LIST [starting line] - [ending line]
lists line(s) of your program. Either start or end can be omitted, or if both are omitted, the entire program will be listed
LLIST [starting line] - [ending line]
works like LIST, but outputs to the printer
MOTOR [ON|OFF]
turns the cassette motor on or off
NEW
erases contents of memory (program and variable)
ON {num} GOSUB line 1, line 2, ... line n
evaluates expression num and calls the numth subroutine listed
ON (num) GOTO line 1, line 2, ... line n
evaluates expression num and jumps to the numth line listed
prints data to device specified. If omitted, #0 (screen) is assumed
PRINT @{screen position} expression
works like PRINT, but prints at the location specified (0-511)
READ variable[,variable,...]
reads the next variable(s) from the BASIC program embedded with DATA statements
RENUM NewStart num, OldStart num, Increment num
renumbers each line (optional Oldstart ) (with optional NewStart) of the program : at multiples of (optional num).: If all options are omitted, the list will use 10 for increment. : With a program with 10 lines, with 10 separation. 10,20,30,40,50,60,70,80,90,100: renum 100, 40, 2. This will renumber, Starting at line number 40. It will change all line number following and including 40 by 2. lines now 10,20,30,100,102,104,106,108,110, 112
RESET(x,y)
sets the semigraphics pixel at location x (0-63) and y (0-31) to black
RESTORE
resets the READ pointer back to the first DATA statement
RETURN
returns from a subroutine
RUN num
runs the BASIC program, optionally, at the line number specified
SET(x,y,color)
sets the semigraphics pixel at location x (0-63) y (0-31) to color (0-8)
SKIPF ["filename"]
skips over BASIC programs on tape until the program name specified is found
SOUND tone,duration
sounds a tone with frequency (1-255) and duration (1-255)
STOP
causes the program to stop executing
TAB(column)
tabs to the column specified (used with PRINT)
VAL(str)
returns the numeric value of a string that contains a number in string form
performs conditional test. If the test is true THEN commands are executed, otherwise (ELSE) other commands are executed. If the no ELSE is specified, and the test is false, the next line of the program will be run
FOR{num} = {number} TO {number} [STEP {number}]
...
NEXT (num)
creates a loop where the numeric variable (num) runs from start number to end number in increments of number (STEP). If step is omitted, 1 is assumed
^80-U-S. Interviews Bill Gates of Microsoft, 80-U.S. - Volume IV Number 3 (1981-05)(80-Northwest Publishing)(US), Page 8. Most recently he completed the work on the Radio Shack color computer. He is most excited about the Extended Color Basic package he wrote.