BASIC09
Encyclopedia
BASIC09 is a structured BASIC programming language dialect developed by Microware
for the then-new Motorola 6809
CPU
. Somewhat in the fashion of UCSD Pascal
it was implemented via 'compilation' into an intermediate representation. It was paired with the OS-9 Operating system, also from Microware and took advantage of several OS-9 features (e.g., shared memory, module loading and unloading, etc.).
The language processor turned BASIC09 source code
into a token
ized, optimized, bytecode
, called I-code in the BASIC09 literature. If that bytecode version of the source were saved (called packing), it could also be executed by a much more compact version of the interpreter, called RunB (no editor, no prettyprinter, no extraneous information included for human convenience, no debugger, ...).
BASIC09 had very impressive features for its time (it was first available in 1980), and most especially for its memory requirements. It was also fast, in comparison with nearly all other microcomputer BASICs. Most of the features listed below have significant benefits for those writing more than example programs.
Microware produced a version of BASIC09 for OS-9
/68k (for the 68000
), calling it Microware BASIC, but did not develop a version for OS-9000 (the portable version of OS-9).
operating systems, "packed" procedures are in fact OS-9 modules; the OS-9 shell
recognizes them as I-code and automatically calls the RunB interpreter to execute them. RunB avoids much of the runtime overhead found in typical interpreted BASICs of the day—not to mention that one can do integer calculations where appropriate rather than doing everything in floating point—so that BASIC09 programs run extremely quickly in comparison with equivalent programs in the interpreted BASICs of the time. RunB was also smaller than nearly every other BASIC interpreter package of even remotely comparable capabilities.
Microware
Microware is a US corporation that produced the OS-9 real-time operating system.Microware Systems Corporation existed as a separate entity from 1977 until September 2001, when it was bought by RadiSys Corp., and became a division of that company...
for the then-new Motorola 6809
Motorola 6809
The Motorola 6809 is an 8-bit microprocessor CPU from Motorola, designed by Terry Ritter and Joel Boney and introduced 1978...
CPU
Central processing unit
The central processing unit is the portion of a computer system that carries out the instructions of a computer program, to perform the basic arithmetical, logical, and input/output operations of the system. The CPU plays a role somewhat analogous to the brain in the computer. The term has been in...
. Somewhat in the fashion of UCSD Pascal
UCSD Pascal
UCSD Pascal was a Pascal programming language system that ran on the UCSD p-System, a portable, highly machine-independent operating system. UCSD Pascal was first released in 1978...
it was implemented via 'compilation' into an intermediate representation. It was paired with the OS-9 Operating system, also from Microware and took advantage of several OS-9 features (e.g., shared memory, module loading and unloading, etc.).
The language processor turned BASIC09 source code
Source code
In computer science, source code is text written using the format and syntax of the programming language that it is being written in. Such a language is specially designed to facilitate the work of computer programmers, who specify the actions to be performed by a computer mostly by writing source...
into a token
Lexical analysis
In computer science, lexical analysis is the process of converting a sequence of characters into a sequence of tokens. A program or function which performs lexical analysis is called a lexical analyzer, lexer or scanner...
ized, optimized, bytecode
Bytecode
Bytecode, also known as p-code , is a term which has been used to denote various forms of instruction sets designed for efficient execution by a software interpreter as well as being suitable for further compilation into machine code...
, called I-code in the BASIC09 literature. If that bytecode version of the source were saved (called packing), it could also be executed by a much more compact version of the interpreter, called RunB (no editor, no prettyprinter, no extraneous information included for human convenience, no debugger, ...).
BASIC09 had very impressive features for its time (it was first available in 1980), and most especially for its memory requirements. It was also fast, in comparison with nearly all other microcomputer BASICs. Most of the features listed below have significant benefits for those writing more than example programs.
Microware produced a version of BASIC09 for OS-9
OS-9
OS-9 is a family of real-time, process-based, multitasking, multi-user, Unix-like operating systems, developed in the 1980s, originally by Microware Systems Corporation for the Motorola 6809 microprocessor. It is currently owned by RadiSys Corporation....
/68k (for the 68000
Motorola 68000
The Motorola 68000 is a 16/32-bit CISC microprocessor core designed and marketed by Freescale Semiconductor...
), calling it Microware BASIC, but did not develop a version for OS-9000 (the portable version of OS-9).
Significant features
- reasonably structured control flow provisions (e.g., line numbers were mainly needed for computed
GOTO
, as BASIC09 did not have a switch/case statement, or computedGotogoto is a statement found in many computer programming languages. It is a combination of the English words go and to. It performs a one-way transfer of control to another line of code; in contrast a function call normally returns control...GOSUB
)GOSUBGOSUB is a command in many versions of the BASIC computer programming language. A GOSUB statement jumps to a line elsewhere in the program. That line and the following lines up to a RETURN are used as a simple kind of a subroutine without parameters or local variables.The GOSUB command may be used... - structure declaration (rare in any BASIC variant then; more common now)
- intrinsic integer and Boolean data types
- more than two significant characters in variable names (some BASICs of the time allowed only 1(!), many Microsoft BASICMicrosoft BASICMicrosoft BASIC was the foundation product of the Microsoft company. It first appeared in 1975 as Altair BASIC, which was the first BASIC, and the first high level programming language available for the MITS Altair 8800 hobbyist microcomputer....
variants allowed only 2) - procedures with local variables (indeed, all variables in BASIC09 are local to procedures) and parameter passing by reference
- a reasonable debugger (its only significant drawback was that one could not examine the contents of fields in structures)
- a way to interface to machine language code, which could be passed parameters using the BASIC09 calling sequence
- automatic prettyprintPrettyprintPrettyprint is the application of any of various stylistic formatting conventions to text, source code, markup, and other similar kinds of content. These formatting conventions usually consist of changes in positioning, spacing, color, contrast, size and similar modifications intended to make the...
ing of source, which enforced a standard layout and avoided the ghastly mess that was the usual appearance of a program of any size in the interpreted BASICs of the time. Programmers normally would cram as many lines together as possible to avoid line number memory overhead—not a problem in BASIC09
Procedure packing
Once one or more BASIC09 procedures are debugged to the programmer's satisfaction, they can be "packed" (or converted permanently to the I-code (i.e., bytecode) form) into a file. Among other things, line numbers, comments and names of local variables are discarded during packing, so that, unlike the typical interpreted BASICs of the time, comments and intelligible variable names incur no runtime cost and were therefore not a 'burden' programmers learned to avoid to maximize runtime execution time or memory efficiency. For the BASIC09 releases intended for the OS-9OS-9
OS-9 is a family of real-time, process-based, multitasking, multi-user, Unix-like operating systems, developed in the 1980s, originally by Microware Systems Corporation for the Motorola 6809 microprocessor. It is currently owned by RadiSys Corporation....
operating systems, "packed" procedures are in fact OS-9 modules; the OS-9 shell
Unix shell
A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems...
recognizes them as I-code and automatically calls the RunB interpreter to execute them. RunB avoids much of the runtime overhead found in typical interpreted BASICs of the day—not to mention that one can do integer calculations where appropriate rather than doing everything in floating point—so that BASIC09 programs run extremely quickly in comparison with equivalent programs in the interpreted BASICs of the time. RunB was also smaller than nearly every other BASIC interpreter package of even remotely comparable capabilities.