BASIC XL Programming Environment
Total Page:16
File Type:pdf, Size:1020Kb
Last Edit: 3 December 2015 A reference manual for The BASIC XL Programming Environment comprising Cartridge Version Run Time Toolkit A complete programming system designed for your ATARI home computer system. The programs, cartridges, ROMs, and manuals comprising the BASIC XL environment are Copyright (c) 1983, 1984 by Optimized Systems Software, Inc. Atari, Atari Computers, and Atari Home Computers are trademarks of Atari, Inc. This comprehensive information provided by Atari enthusiasts aims at the preservation of The BASIC XL Programming Environment 1st revised edition (p) 2015 Preface ------- As tribute to OSS this fully edited version is provided to keep one of the best and fastest BASIC versions on ATARI 8-bit computers accessible to all being interested in this great piece of software. BASIC XL was released by OSS in 1983. OSS merged into a division of ICD, Inc. in 1988. ICD sold their ATARI 8-bit product line to FTe in 1993. FTe disappeared supposedly in 1996. The author Bill Wilkinson passed in November 2015. The current status of BASIC XL is 'abandonware'. Many of those famous A8 hardware and software products from OSS and ICD are still available thanks to a worldwide active A8 community. So is this manual. My BASIC XL reference manual went through scanner and OCR process as the one about Action!. The new BASIC XL manual in chapters 1 to 8 keeps the original layout for reference to the original paperback and of course for historical reasons. Nearly all entries from the original's table of contents are found on the same page. The BASIC XL Toolkit including The BASIC XL Runtime Package was added to this manual as chapter 9 and is adapted to the layout as deemed necessary. Therefore the appendices needed amendment and changes as well. Typos and errors found were corrected and information concerning the XL/XE computers were added to the new BASIC XL manual. BASIC XL and other OSS programming languages work best in conjunction with SpartaDOS X V. 4.47 or newer provided by DLT. Open Office was engaged to create this manual. Enjoy BASIC XL … and may your A8 always be with you! GoodByteXL, December 2015 P.S.: Special thanks for help to Roland. TABLE OF CONTENTS Chapter 1: Introduction 1.1 Features of BASIC XL ........................... 1 1.2 Special Notations used in this Manual .......... 2 1.3 Glossary and terminology ....................... 3 1.4 Operating Modes ................................ 7 Chapter 2: VARIABLES, OPERATORS, EXPRESSIONS 2.1 Variables (var) ................................ 9 2.1.1 Arithmetic variables (avar) .................. 10 2.1.2 Array / Matrix Variables (mvar) .............. 10 2.1.3 String Variables (svar) ...................... 12 2.1.4 String Array Variables (svar) ................ 12 2.1.5 DIM .......................................... 13 2.2 Operators ..................................... 14 2.2.1 Arithmetic Operators (aop) ................... 14 2.2.2 Logical Operators (lop) ...................... 15 2.2.3 Operator Precedence .......................... 16 2.3 Expressions (exp) ............................. 17 2.3.1 Numbers ...................................... 17 2.3.2 Arithmetic Expressions (aexp) ................ 18 2.3.3 String Expressions (sexp) .................... 19 Chapter 3: PROGRAM DEVELOPMENT COMMANDS 3.1 BYE (B.) ...................................... 21 3.2 CLR ........................................... 21 3.3 CONT (CON.) ................................... 22 3.4 DEL ........................................... 22 3.5 DOS ........................................... 23 3.6 FAST .......................................... 23 3.7 LIST (L.) ..................................... 24 3.8 LOMEM ......................................... 24 3.9 LVAR (LV.) .................................... 25 3.10 NEW .......................................... 25 3.11 NUM .......................................... 25 3.12 REM (R.) ..................................... 26 3.13 RENUM ........................................ 27 3.14 RUN .......................................... 27 3.15 SET .......................................... 28 3.16 STOP ......................................... 31 3.17 TRACE and TRACEOFF ........................... 31 Chapter 4: PROGRAM CONTROL STATEMENTS 4.1 Assignment Statement .......................... 33 4.2 END ........................................... 34 4.3 FOR(F.)...TO...STEP / NEXT(N.) ................ 35 4.4 GOSUB (GOS.) / RETURN (RET.) .................. 36 4.5 GOTO (G.) ..................................... 37 4.6 IF/THEN ....................................... 39 4.7 IF...ELSE...ENDIF ............................. 40 4.8 LET ........................................... 41 4.9 MOVE .......................................... 42 4.10 ON... ........................................ 43 4.11 POP .......................................... 44 4.12 RESTORE (RES.) ............................... 45 4.13 TRAP (T.) .................................... 45 4.14 WHILE...ENDWHILE ............................. 46 TABLE OF CONTENTS Chapter 5: INPUT/OUTPUT COMMANDS AND DEVICES 5.1 Comments and Notations ........................ 47 5.2 BGET .......................................... 49 5.3 BPUT .......................................... 50 5.4 CLOAD ......................................... 50 5.5 CLOSE (CL.) ................................... 50 5.6 CSAVE (CS.) ................................... 51 5.7 DATA (D.) ..................................... 51 5.8 DIR ........................................... 52 5.9 ENTER (E.) .................................... 52 5.10 ERASE ........................................ 53 5.11 GET .......................................... 53 5.12 INPUT (I.) ................................... 53 5.12.1 Advanced use of INPUT ....................... 54 5.13 LOAD (LO.) ................................... 55 5.14 LPRINT (LP.) ................................. 55 5.15 NOTE (NO.) ................................... 55 5.16 OPEN (O.) .................................... 56 5.17 POINT (P.) ................................... 57 5.18 PRINT (PR or ?) .............................. 57 5.19 PRINT USING .................................. 58 5.20 PROTECT ...................................... 63 5.21 PUT (PU.) .................................... 63 5.22 READ ......................................... 63 5.23 RENAME ....................................... 64 5.24 RGET ......................................... 64 5.25 RPUT ......................................... 65 5.26 SAVE (S.) .................................... 66 5.27 STATUS (ST.) ................................. 66 5.28 TAB .......................................... 66 5.29 UNPROTECT (UNP.) ............................. 67 5.30 XIO (X.) ..................................... 67 5.31 An Example Program ........................... 68 Chapter 6: FUNCTION LIBRARY 6.1 Arithmetic Functions .......................... 69 6.1.1 ABS .......................................... 69 6.1.2 CLOG ......................................... 69 6.1.3 EXP .......................................... 70 6.1.4 INT .......................................... 70 6.1.5 LOG .......................................... 70 6.1.6 RANDOM ....................................... 70 6.1.7 RND .......................................... 71 6.1.8 SGN .......................................... 71 6.1.9 SQR .......................................... 71 6.1.10 An Example Program .......................... 71 6.2 Trigonometric Functions ....................... 72 6.2.1 ATN .......................................... 72 6.2.2 COS .......................................... 72 6.2.3 DEG and RAD .................................. 72 6.2.4 SIN .......................................... 72 6.2.5 An Example Program ........................... 73 6.3 String Functions .............................. 73 6.3.1 ASC .......................................... 73 6.3.2 CHR$ ......................................... 73 6.3.3 FIND ......................................... 74 6.3.4 LEFT$ ........................................ 75 TABLE OF CONTENTS 6.3.5 LEN .......................................... 75 6.3.6 MID$ ......................................... 75 6.3.7 RIGHT$ ....................................... 76 6.3.8 STR$ ......................................... 76 6.3.9 VAL .......................................... 76 6.3.10 An Example Program .......................... 77 6.4 Game Controller Functions ..................... 78 6.4.1 HSTICK ....................................... 78 6.4.2 PADDLE ....................................... 78 6.4.3 PEN .......................................... 78 6.4.4 PTRIG ........................................ 78 6.4.5 STICK ........................................ 79 6.4.6 STRIG ........................................ 79 6.4.7 VSTICK ....................................... 79 6.4.8 An Example Program ........................... 80 6.5 Player/Missile Functions ...................... 80 6.5.1 BUMP ......................................... 80 6.5.2 PMADR ........................................ 81 6.6 Special Purpose Functions ..................... 81 6.6.1 ADR .......................................... 81 6.6.2 DPEEK ........................................ 81 6.6.3 DPOKE ........................................ 82 6.6.4 ERR .......................................... 82 6.6.5 FRE .......................................... 82 6.6.6 HEX$ ......................................... 83 6.6.7 PEEK ........................................