BASIC09
Reference
Contents
Chapter 1 Looking At The Basics
Using BASIC09 . . . . . . . . . . . . . . . . . .
Requesting More Memory
Writing Procedures . . . . .
Modules of Other Languages . . . . . .
Executing Procedures
Leaving BASIC09 . . . . . . . . .
The Keyboard and BASIC09
.1-2
. . l-3
..1-5
.1-5
.1-5
. .1-5
Chapter 2 Sample Session
Creating a Procedure . . . . . . . . .
Commands and Program Lines
Executing a Procedure . . . . . . . . . . . . . . .
Chapter 3 The System Mode
Renaming Procedures . . . . . . . . . . . . . . . .
Listing Procedure Names . . . . . . . . . . . . . . . . . . . ~. . . .
Listing Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Listing Procedure Names to a File
Listing Procedures to a Printer . . .
Using a Wildcard . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Saving Procedures ..............................
Loading Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Deleting Procedures from the Workspace . . . . . . . . . . . . .
Changing Directories
Executing OS-9 Commands
Chapter 4 The Edit Mode
Edit Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using the Editor . . . . . . . . . . . . . . . : . . . . .
. 2-2
. . 3-4
. 3-6
. . 4-4
Using the Plus Sign to Move Forward . . . . . . . . . . . . . . 4-4
Accessing a Line Using the Line Number . . . . . . . . . . . 4-5
Using the Minus Sign to Move Backward . . . . . . . . . . . 4-5
The Global Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
Using LIST ~ 4-6
Deleting Lines . . . . . . . . . . . . . . . . . . . . : . . . . . . . . . . . . . . 4-6
Changing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
Searching for Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Searching Through a Procedure ....
Using
ENTER
...................................
Contents
Renumbering Lines . . .
Adding Lines . . . . . .
The Next Step . . . . . . . .
Chapter 5 The Debug Mode
Entering the Debug Mode . .
When Things Go Wrong . . . .
Using the Trace Function
What About Loops? . . . . . .
In Multiple Procedures . .
Chapter 6 Data and Variable Data Types . . . . . . . . . . . . .
The Byte Data Type . .
The Integer Data Type
The Real Data Type
String Variables . . . . . . .
The Boolean Type . . . . .
Automatic Type Conversion
Constants .......................................
String Constants
Variables . . . . . . . . . . .
Passing Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Arrays.....................................
Complex Data Types . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 7 Expressions, Operators, and Functions
. 5-5
s
. . . 6-13
BASIC09 Expression Operators
Arithmetic Operators . . . . . . . .
Hierarchy of Operators . . . . .
Relational Operators . . . . . . . . .
String Operators . . . . . . . .
Logical Operators .......
Functions .....................
Chapter 8 Disk Files
Manipulating Data .
Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . .
Type Conversion . . . . . . . . . . . . . . . . . . . . . . .
Operators .. . . . . .. .
. 7-1
Types of Access for Files . . . . . . . . . . . . . . . . . . . . . . . .
Sequential Files ...................................
. 8-2
Sequential File Creation, Storage, and Retrieval . . . . 8-2
Changing Data in a Sequential File
INPUT and Sequential Files . . . . . . .
Contents
Random Access Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5
Creating Random Access Files . . . . . . . . . . . . . . . . . . . . . 8-6
Using Arrays With Random Access Files . . . . . . . . . . . 8-9
Using Complex Data Structures . . . . . . . . . . . . . . . . . .8-11
Chapter 9 Displaying Text and Graphics
ASCII Codes .....................................
. . 9-1
. . 9-8
. . 9-8
. . 9-10
. 9-12
. . 9-26
. 9-32
. . 9-33
. . 9-34
Establishing a Graphics Window . . . . . . . . . . . . . . . . . . . .9-35
Starting a Shell in a Window . . . . . . . . . . . . . . . . . . . . .9-36
. 9-37
. . 9-39
. . 9-41
. 9-42
. 9-42
. 9-43
. 9-44
Low Resolution Graphics Characters . . . .
Special Characters in High-Resolution
Medium-Resolution Graphics . . . . . . . . . . . . . . . . . . . . . . .
Formats and Colors . . . . . . . . . .
The Draw Pointer . . . . . . . . . . .
High-Resolution Graphics . . . . . .
Establishing a Hardware Window . . . . . . . . . . . . . . . . . .
Defining Windows . . . . . . . . . . . . . . . . . . . .
The Palette . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using High-Level Graphics with 128K . . . .
Creating Windows From BASIC09 . . . . . . . .
Creating Overlay Windows . . . . . . . . . . . .
The Graphics Cursor and the Draw Pointer
High Resolution Text ..............................
Using Fonts .. . ...............................
High Resolution Quick Reference
Chapter 10 BASIC09 Quick Reference
Statements and Functions . . . . . . . . . . . . . . . . . . . . . . . . . .10-1
Commands By Type 10-7
Statements ..................................... 10-7
. .10-7
. .1.0-9
10-10
10-11
Transcendental Functions
Numeric Functions . . . . . .
String Functions . . . . . . . . . . . . .
Miscellaneous Functions
Data Types . . . . . . . . . . . . .
Types of Access for Files . . . .
Command Mode
Edit Commands . . . . . . . . . . . . . . . . . . .
Debug Commands . . . . . . . . . . . . . . . . .
Chapter 11 BASIC09 Command Reference
Keyword Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Syntax Line ..............................
Sample Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
Chapter 12 Program Optimization
Optimum Use of Numeric Data Types
Arithmetic Functions Ranked by Speed
(quicker Loops . . . . . . . . . . . . . . . . .
Arrays and Data Structures . . . . . . . . . . . . . . . . . . . . . . . .
The PACK Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Minimizing Constant Expressions and
Subexpressions .. .... . . . ........
Input and Output . . . . . . . . . . . . . . . . . . . : . . . . .
Appendix A Error Codes
Signal Errors . . . . . . . . . . . . . .
BASIC09 Error Codes . .
Windowing and System Errors
Appendix B The Inkey Program
Assembly Language Listing of Inkey
12-1
12-3
12-3
12-4
12-4
12-4
12-4
A-1
A-1
A-3