Color BASIC: Difference between revisions

Content deleted Content added
m Typo fixing and general fixes using AWB (7660)
Line 48:
- is used for subtraction<br>
<nowiki>*</nowiki> is used for multiplication<br>
/ is used for division<br>
 
Parenthesis ( ) are used to override mathematical order of operation
Line 54:
AND is used for logical 'and' operations<br>
OR is used for logical 'or' operations<br>
NOT is used for logical 'not' operations<br>
 
For testing, the following operators are used:
Line 63:
>= is greater than or equal to (also => is acceptable)<br>
<= is less than or equal to (also =< is acceptable)<br>
<> is not equal to (also >< is acceptable)<br>
 
Other symbols used in BASIC:
Line 70:
''':''' separates multiple commands on a single program line<br>
A semicolon, when encountered in a PRINT function, will cause the output to remain on the same line<br>
A comma, when encountered in a PRINT function, will tab to the next column<br>
 
==Key==
Line 104:
'''SIN(''num'')''' returns the sine of ''num'' in radians<br>
'''STR$(''num'')''' returns a string of the number ''num''<br>
'''USR(''num'')''' calls a machine language subroutine 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<br>
 
==Commands==
Line 121:
'''[[For loop|FOR]] ''{num}'' = ''{number}'' TO ''{number}'' [STEP ''{number}'']''' <br>
'''... 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<br>
'''[[GOSUB]] ''{[[line number]]}''''' calls the subroutine at the line number specified<br>
'''[[GOTO]] ''{line number}''''' jumps to the program's line number specified<br>
'''IF ''{test}'' THEN ''{command(s)}'' [ELSE ''{command(s)}'']''' 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<br>
Line 146:
'''STOP''' causes the program to stop executing<br>
'''TAB(''column'')''' tabs to the column specified (used with PRINT)<br>
'''VAL(''str'')''' returns the numeric value of a string that contains a number in string form<br>
 
==Error Messages==
Line 157:
'''DS''' direct statement error (program has no line numbers)<br>
'''FC''' illegal function call: function contains a value that is out of range<br>
'''FD''' bad file data: attempt to read a number into a string value, etc.<br>
'''FM''' bad file mode, attempt to INPUT data to a file open for OUTPUT, etc.<br>
'''ID''' illegal direct: the specified command can only be run in a program<br>
'''IE''' input past end of file. See EOF<br>
Line 183:
'''BLKIN''', address [$A006]: reads a block from cassette<br>
'''BLKOUT''', address [$A008]: writes a block to cassette<br>
'''JOYIN''', address [$A00A]: reads joystick values<br>
 
==References==
Line 192:
{{BASIC}}
 
{{DEFAULTSORT:Color Basic}}
[[Category:TRS-80 Color Computer]]
[[Category:Discontinued Microsoft BASICs]]