BASIC09 Programming Language Reference Manual
Total Page:16
File Type:pdf, Size:1020Kb
BASIC09 Programming Language Reference Manual BASIC09: Programming Language Reference Manual Copyright © 1983 by Dragon Data Ltd. and Microware Systems Corporation. All Rights Reserved. Basic 09 is a trademark of Microware Systems Corporation and Motorola Inc. Revision History Revision F February 1983 Table of Contents 1. Introduction .......................................................................................................................9 Comments on BASIC09...............................................................................................9 The History of BASIC09 ............................................................................................10 2. Introduction to BASIC09 Programming.....................................................................11 What is a Program?....................................................................................................11 A Simple BASIC09 Program .....................................................................................12 Basic Programming Techniques: Loops and Arithmetic ......................................14 Listing Procedure Names..........................................................................................15 Requesting More Memory ........................................................................................16 Storing and Recalling Programs ..............................................................................16 How to Print Program Listings ................................................................................17 BASIC09’s Four Modes:.............................................................................................18 More about the Workspace... ....................................................................................19 Where to go From Here? ...........................................................................................19 3. System Mode ...................................................................................................................21 System Mode Commands .........................................................................................22 4. Edit Mode .........................................................................................................................29 Overview of Edit Commands...................................................................................29 How the Editor Works...............................................................................................30 Line-Number Oriented Editing................................................................................30 String-Oriented Editing.............................................................................................31 Moving the Edit Pointer ..................................................................................31 Inserting Lines...................................................................................................32 Deleting Lines ...................................................................................................32 Listing Lines ......................................................................................................32 Search: Finding Strings ....................................................................................33 Change: String Substitution ............................................................................33 5. Execution Mode...............................................................................................................35 Running Programs .....................................................................................................35 Execution Mode: Technically Speaking ..................................................................35 6. Debug Mode ....................................................................................................................37 Overview of Debug Mode ........................................................................................37 Debug Mode Commands..........................................................................................37 Debugging Techniques ..............................................................................................39 Debug Mode as a Desk Calculator ..........................................................................40 7. Data Types, Variables and Data Structures................................................................43 Why are there different data types?.........................................................................43 Data Structures ...........................................................................................................43 Atomic Data Types ...........................................................................................43 Type BYTE .........................................................................................................44 Type INTEGER..................................................................................................44 Type REAL.........................................................................................................45 Type STRING.....................................................................................................45 Type BOOLEAN ...............................................................................................46 Automatic Type Conversion ...........................................................................46 Constants .....................................................................................................................46 Numeric Constants...........................................................................................47 Boolean Constants ............................................................................................47 v String Constants................................................................................................47 Variables ......................................................................................................................48 Parameter Variables ...................................................................................................48 Arrays...........................................................................................................................49 Complex Data Types..................................................................................................49 8. Expressions, Operators, and Functions ......................................................................51 Evaluation of Expressions.........................................................................................51 Operators.....................................................................................................................51 Operator Precedence ........................................................................................52 Functions .....................................................................................................................53 9. Program Statements and Structure..............................................................................57 Program Structure......................................................................................................57 Line Numbers .............................................................................................................57 Assignment Statements.............................................................................................57 LET Statement ...................................................................................................57 POKE Statement ...............................................................................................58 Control Statements.....................................................................................................59 IF Statement: Type 1 .........................................................................................59 IF Statement: Type 2 .........................................................................................59 FOR/NEXT Statement .....................................................................................60 WHILE..DO Statement.....................................................................................60 REPEAT..UNTIL Statement.............................................................................61 LOOP and ENDLOOP/EXITIF and ENDEXIT Statements .......................62 GOTO Statement...............................................................................................63 GOSUB/RETURN Statements........................................................................63 ON GOTO/GOSUB Statement.......................................................................64 ON ERROR GOTO Statement.........................................................................64 Execution Statements.................................................................................................65 Run Statement...................................................................................................65 Parameter Passing ............................................................................................66 Calling External Procedures............................................................................66 KILL Statement .................................................................................................67 CHAIN Statement ............................................................................................68