TI Extended BASIC for the TI-99/4 Home Computer
Total Page:16
File Type:pdf, Size:1020Kb
TI EXTENDED BASIC FOR THE TI-99 /4 HOME COMPUTER A powerful, high-level programming language that expands the capability of your TI-99/4 Home Computer. Includes these features: · More than 40 new or expanded commands, statements, functions, and subprograms. · Multiple-statement lines for speed and efficiency. · Sprite (moving graphics) capability. · Subprogram capability that lets you store commonly used subprograms on diskette for use as needed. · The ability to load and run one program from another. · Comprehensive program control of errors, warnings, and breakpoints. · Direct screen control of input and output. · Support for loading and running TMS9900 Assembly Language programs if the optional Memory Expansion unit (sold separately) is attached to the computer. Copyright © 1981 Texas Instruments Incorporated Program and database contents Copyright © 1981 Texas Instruments Incorporated 1 Click here to Return to Table of Contents This book was developed and written by: Robert E. Whitsitt II and other staff members of the Texas Instruments Learning Center and the Texas Instruments Personal Computer Division. With contributions by: Tom M. Ferrio Stanley R. Hume Jacquelyn F. Quiram Artwork and layout were coordinated and executed by: Schenck Design Associates, Inc. ISBN #0-89512-045-3 Library of Congress Catalog #80-54899 Copyright © 1981 by Texas Instruments Incorporated This book has been scanned and converted to electronic form by: Manolis Kiagias For corrections, additions and suggestions, contact me: [email protected] Disclaimer: This book is copyrighted by Texas Instruments. This electronic version is for personal use only and MAY NOT BE SOLD It is offered as a contribution to the TI community Revision 1.0 – 27/10/2001 2 Click here to Return to Table of Contents TABLE OF CONTENTS Chapter 1 – Introduction 7 Features 8 Changes from TI Basic 10 How to Use this Manual 10 How to Use the Computer 11 Operating in TI Extended Basic 11 Special Key Functions 12 Chapter 2 – Overview of TI Extended Basic 15 Commands 16 Assignments and Input 17 Output 18 Functions, Subroutines, and Subprograms 19 Built in Functions 20 User-Defined Functions 21 Subroutines 21 Built in Subprograms 21 User-Written Subprograms 23 Sound, Speech and Color 24 Sprites 25 Debugging 26 Error Handling 26 Program Entry Example 27 Chapter 3 – TI Extended Basic Conventions 37 Running a Program on Power up 38 Files 38 Line Numbers 38 Lines 38 Special Symbols 39 Spaces 39 Numeric Constants 39 String Constants 39 Variables 39 Numeric Expressions 41 String Expressions 41 Relational Expressions 41 Logical Expressions 42 3 Click here to Return to Table of Contents Chapter 4 – Reference Section 45 ABS 46 ACCEPT 47 ASC 50 ATN 51 BREAK 52 BYE 54 CALL 55 CHAR 56 CHARPAT 59 CHARSET 60 CHR$ 60 CLEAR 61 CLOSE 62 COINC 64 COLOR 66 CONTINUE 68 COS 69 DATA 70 DEF 72 DELETE 74 DELSPRITE 75 DIM 76 DISPLAY 77 DISPLAY…USING 79 DISTANCE 80 END 81 EOF 82 ERR 83 EXP 85 FOR-TO -STEP 86 GCHAR 88 GOSUB 89 GOTO 91 HCHAR 92 IF-THEN-ELSE 94 IMAGE 97 INIT 101 INPUT 102 INPUT (with Files) 104 INT 107 JOYST 108 KEY 109 LEN 110 4 Click here to Return to Table of Contents LET 111 LINK 112 LINPUT 113 LIST 114 LOAD 115 LOCATE 116 LOG 117 MAGNIFY 118 MAX 121 MERGE 122 MIN 124 MOTION 125 NEW 126 NEXT 127 NUMBER 128 OLD 129 ON BREAK 130 ON ERROR 131 ON GOSUB 133 ON GOTO 135 ON WARNING 137 OPEN 138 OPTION BASE 141 PATTERN 142 PEEK 143 PI 144 POS 145 POSITION 146 PRINT 147 PRINT USING 150 RANDOMIZE 151 READ 152 REC 153 REM 154 RESEQUENCE 155 RESTORE 156 RETURN (with ON GOSUB) 157 RETURN (with ON ERROR) 158 RND 159 RPT$ 160 RUN 161 SAVE 163 SAY 164 SCREEN 165 5 Click here to Return to Table of Contents SEG$ 166 SQN 167 SIN 168 SIZE 169 SOUND 170 SPGET 172 SPRITE 173 SQR 178 STOP 178 STR$ 179 SUB 180 SUBEND 184 SUBEXIT 184 TAB 185 TAN 186 TRACE 186 UNBREAK 187 UNTRACE 187 VAL 188 VCHAR 188 VERSION 190 APPENDICES Appendix A – List of Illustrative Programs 192 Appendix B – List of Commands, Statements and Functions 194 Appendix C – ASCII Codes 196 Appendix D – Musical Tone Frequencies 197 Appendix E – Character Sets 198 Appendix F – Pattern-Identifier Conversion Table 198 Appendix G – Color Codes 199 Appendix H – Color Combinations 200 Appendix I – Split Console Keyboard 201 Appendix J – Character Codes for Split Keyboard 201 Appendix K – Mathematical Functions 202 Appendix L – List of Speech Words 203 Appendix M – Adding Suffixes to Speech Words 206 Appendix N – Error Messages 212 6 Click here to Return to Table of Contents INTRODUCTION (Remainder of this page intentionally left blank) 7 Click here to Return to Table of Contents INTRODUCTION FEATURES Texas Instruments Extended BASIC is a powerful computer programming language for use with the Texas Instruments TI-99/4 Home Computer. It has the features expected from a high level language plus additional features not available in many other languages, including those designed for use with large, expensive computers. TI Extended BASIC goes beyond Texas Instruments BASIC to enhance the capability and flexibility of your computer system by adding these features: Input and Output - The ACCEPT statement allows the input of data from anywhere on the screen. You may clear the screen, accept only certain characters, and limit the number of characters entered using this statement. The DISPLA Y statement has been enhanced to allow putting data anywhere on the screen, and DISPLAY ... USING, PRINT ... USING, and IMAGE have been added for ease in formatting data on the display screen and peripheral devices. Subprograms - Subprograms with local variables (affecting only values within the subprogram) can be written in TI Extended BASIC. Commonly used subprograms may be stored on a diskette and added to programs as needed. Statements included are SUB, SUBEND, and SUBEXIT. The MERGE command has been added and the SAVE command modified to allow the merging of programs from diskettes. Sprites - Sprites are specially defined graphics with the ability to move smoothly on the screen. To provide the sprite capability, the following subprograms have been included in TI Extended BASIC: COINC, DELSPRITE, DISTANCE, LOCATE, MAGNIFY, MOTION, PATTERN, POSITION, and SPRITE. COLOR and CHAR have been redesigned so they also can affect sprites Functions - MAX, returning the larger of two numbers; MIN, returning the smaller of two numbers; and PI, returning the value of p, have been included in TI Extended BASIC. Arrays - Arrays may have up to seven dimensions instead of three. String Handling - The RPT$ function allows the repetition of a string. Error Handling - With TI Extended BASIC, you can choose what action is taken if there is a minor error (which in TI BASIC causes a warning message), a major error (which in TI BASIC causes an error message and stops the program), or a breakpoint (which in TI BASIC causes the program to halt). The new statements allowing this control are ON WARNING, ON ERROR, and ON BREAK. RETURN has been modified for use with error handling. The CALL ERR statement can be used to determine the nature of an error that occurs in a program. 8 Click here to Return to Table of Contents RUN as a Statement - RUN can be used as a statement as well as a command. RUN has also been modified to allow you to specify which program to run. As a result, one program can load and run another program from a diskette. You can, therefore, write programs of almost unlimited size by breaking them into pieces and letting each segment run the next. Power-up Program Execution - When TI Extended BASIC is first chosen, it searches for a program named LOAD on the diskette in disk drive 1. If that program exists, it is placed in memory and run. Multiple Statement Lines - TI Extended BASIC allows more than one statement to be on a line. This feature speeds program execution, saves memory, and allows logical units (for example FOR-NEXT loops) to be on a single line. SAVE and LIST Protection - You may protect your programs from being saved or listed, preventing unauthorized copies of and changes in your programs. This, in conjunction with the copy protection feature of the Disk Manager Module, can completely secure a TI Extended BASIC program. IF-THEN-ELSE - The IF-THEN-ELSE statement now allows statements as the consequences of the comparison. This expansion permits statements such as "IF X<4 THEN GOSUB 240 ELSE X=X+ 1". Multiple Assignments - TI Extended BASIC allows you to assign a value to more than one variable in a LET statement, saving statements and permitting more efficient programming. Comments - In addition to the REM statement, comments can be added to the ends of lines in TI Extended BASIC, allowing detailed internal documentation of programs. Assembly Language Support - With the optional Memory Expansion unit (available separately), TMS9900 assembly language subprograms may be loaded and run. The subprograms INIT, LOAD, LINK, and PEEK are used to access assembly language subprograms. There are no facilities for writing assembly language programs on the TI-99/4 Home Computer. Information - The SIZE command has been added to tell you how much memory remains unused in your computer. The VERSION subprogram returns a value which indicates the version of BASIC that is in use. The CHARPAT subprogram returns a character string indicating the pattern which defines a character. Memory Expansion - TI Extended BASIC allows the use of an optional Memory Expansion peripheral which permits much larger programs to be written. 9 Click here to Return to Table of Contents CHANGES FROM TI BASIC The enhancements described above have made some slight changes necessary in other areas of TI BASIC.