Chapter 1
BASIC09 is a computer language created for use with the OS-9 operating system. Along with standard BASIC language statements and functions, it includes the most useful elements of the PASCAL computer language.
Strings can be any length. For each operation, you can select the most efficient of five available data types. Compiled procedures use less space. You can save several procedures into one file.
Combine any type of data into a single dimensioned data structure that you can move, store, and assign easily and quickly.
BASIC09 has three levels of graphics. The high resolution graphics and text capabilities feature more than 50 functions.
BASIC09 has a full range of fast and accurate math and transcendental capabilities including powers, roots, trigonometry, logic, and Boolean functions.
BASIC09 provides superior debugging functions. It checks syntax as you enter lines. It points to the location of your errors and tells you what they are. You can stop programs, enter the debugger, then continue execution. Execution errors automatically put you in a debugging mode where you can examine values, and step and trace your way through faulty procedures.
Before anything else, make a backup copy of your BASIC09/ CONFIG diskette. You can do this using the BACKUP command. If you are not familiar with BACKUP, see Chapter 3 of Getting Started With OS-9.
To use BASIC09, boot your computer as described in Getting Started With OS-9. Replace the system diskette in Drive /DO with the BASIC09/CONFIG backup diskette and type:
After a short pause, during which OS-9 loads BASIC09 from the diskette, the screen displays the copyright and a new prompt, like this:
BASIC09
RS VERSION 01.0 0.01
COPYRIGHT 1980 BY MOTOROLA INC.
AND MICROWARE SYSTEMS CORP.
REPRODUCED UNDER LICENSE
TO TANDY CORP.
ALL RIGHTS RESERVED
The B: indicates that your computer is in the BASIC09 command mode. From the command mode, you can issue instructions to the system executive to manipulate procedures (programs).
Unless you specify otherwise, BASIC09 automatically sets aside 8192 bytes of memory as a workspace into which you can type or load procedures. BASIC09 reserves approximately 1200 bytes of the workspace for internal use, leaving you with 6992 bytes for workspace.
There are two ways to set aside more memory for BASIC09 operations:
In both cases, because BASIC09 rounds the amount you request to the next multiple of 256, the actual reserved memory is 18176 bytes.
You can also use the MEM command to reduce memory. However, BASIC09 does not reduce the size of the workspace if doing so destroys resident procedures.
BASIC09 is a modular programming language. Several procedures can occupy memory at the same time. Each procedure performs a particular function but can also interact with others to form a sophisticated program.
To create or change procedures, enter the edit mode by typing either e d i t ENTER or CD ENTER at the B : prompt . From now on, when directing you to enter the edit mode, this manual uses the easier to type CD.command.
Each time you type a procedure line and press ENTER , the editor checks for common errors. This automatic checking lets you catch mistakes before you run the program, saving you testing and rewriting time. You can even let the automatic checking help you learn the rules of BASIC09. If you are not sure about a syntax, go ahead and type it the way you think is correct. If you guess wrong, BASIC09 shows where the error is and displays a message to tell what is wrong.
BASIC09's use of modules lets you divide large and complex projects into smaller, easily manageable sections. Not only are the smaller procedures easier to write and understand, they are also easier to test As well, because BASIC09 lets you call procedures that are outside the workspace (the computer's memory where you write and edit procedures), you can accumulate libraries of procedures to incorporate into future programs.
You can work on a program's procedures either individually or as a group. For example, to work on the procedures as a group, save your workspace procedures into a single disk file. When you subsequently load the file, BASIC09 automatically loads all of the procedures.
BASIC09 can incorporate procedures from other languages, such as Pascal, C, or assembly language. Several users can then share the procedures.
You execute or run programs from the command mode. When you enter a procedure, BASIC09 compiles it. This means that the procedure is ready for execution as soon as you exit the edit mode. For instance, if you create a program named Greeting, you can execute it by typing from the command mode: