MUGABASIG^ MICROSOFT 6 BASIC FOR TOE AMIGA" *A AMIGA u u u LJ u u u u u u U u LJ U U Li H H n n n n n n n n n AMIGA Amiga Basic H n n n n Amiga Basic was developed by Microsoft Corporation. Microsoft® BASIC for the Amiga COPYRIGHT This manual Copyright • Commodore-Amiga, Inc. and Microsoft Corporation, 1985, All Rights Reserved. This document may not, in whole or In part, be copied, photocopied, reproduced, translated, or reduced to any electronic medium or machine readable form without prior consent, in writing, from Commodore-Amiga, Inc. This software Copyright ® Microsoft Corporation, 1985, All Rights Reserved. The distribution and sale of this product are intended- for the use of the original purchaser only. Lawful users of this program are hereby licensed only to read the program, from its medium into memory of a computer, solely for the purpose of executing the program. Duplicating, copying, selling, or otherwise distributing this product is a violation of the law. DISCLAIMER THE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE RESULTS AND PERFORMANCE OF THE PROGRAM IS ASSUMED BY YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU (AND NOT THE DEVELOPER OR COMMODORE-AMIGA, INC. OR ITS DEALERS) ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. FURTHER, COMMODORE-AMIGA DOES NOT WARRANT, GUARANTEE, OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF, THE PROGRAM IN TERMS OF CORRECTNESS, ACCURACY, RELIABILITY, CURRENTNESS, OR OTHERWISE; AND YOU RELY ON THE PROGRAM AND THE RESULTS SOLELY AT YOUR OWN RISK. IN NO EVENT WILL COMMODORE-AMIGA, INC. BE LIABLE FOR DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES RESULTING FROM ANY DEFECT IN THE PROGRAM EVEN IF IT HAS BEEN ADVISED OF THE POSSIBLITY OF SUCH DAMAGES. SOME LAWS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES OR LIABLITIES FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE ABOVE LIMITATION OR EXCLUSION MAY NOT APPLY. Microsoft is a registered trademark of Microsoft Corporation. Amiga is a trademark of Commodore-Amiga, Inc. Macintosh is a trademark of Apple Computers. IBM-PC Is a trademark of IBM, Inc. PRINTED in Hong Kong CBM Product Number 327273-02 Rev C Contents Chapter 1: Introducing Amiga Basic 1-1 Chapter 2: Getting Started 2-1 Chapter 3: Using Amiga Basic 3-1 Chapter 4: Editing and Debugging Your Programs 4-1 Chapter 5: Working with Files and Devices 5-1 Chapter 6: Advanced Topics 6-1 Chapter 7: Creating Animated Images with the Object Editor 7-1 Chapter 8: BASIC Reference 8-1 Appendices A-l Index 1-1 u u u u u u Li L L L i ...i Chapter 1 Introducing Amiga Basic Who uses BASIC? People use the BASIC programming language for many different reasons. Some of these people are professional programmers. Others are not programmers at all, but wish to run BASIC programs they have purchased. Probably the largest segment of BASIC users is made up of people who write BASIC programs for their own use. They may simply enjoy the mental exercise of programming, or they may have special applications for which they cannot buy ready-made programs. Many BASIC users are students who are studying computer science or using a computer to help with their school work. Introducing Amiga Basic 1-1 All of these people have one thing in common. They use BASIC because it is the universal language for small computers. It is easy to learn, readily available, and highly standardized. It is also a versatile language that has been used in the writing of business, engineering, and scientific applications, as well as in the writing of educational software and computer games. Amiga Basic Whatever your reason for using BASIC, you will find that Amiga Basic gives you all the well-known advantages of BASIC, plus the ease of use and fun you expect from Amiga tools. Amiga Basic puts the full BASIC language on your Amiga computer, including BASIC statements used to write graphics, animation, and sound programs. Also, it has all the familiar features of the Amiga screen. Amiga Basic has a Menu Bar, a Pointer, and windows and screens, just like other Amiga tools have. If you are just starting to learn BASIC, either in a class or on your own, Amiga Basic will fit right in with your course of study. Amiga Basic is based on Microsoft BASICthe most popular programming language in the world, which works on every major microcomputer. If you are an old hand at BASIC programming, you'll want to try some of the special features of this version of BASIC, such as SOUND and WAVE for making music and sounds, and GET and PUT for saving and retrieving graphics by the screenful. About This Manual This book describes the Amiga Basic Interpreter. It assumes you have read Introduction to Amiga, and are familiar with menus, editing text, and using the mouse. Chapters 1 through 7 describe how to use Amiga Basic with the Amiga. They include general instructions on using the interpreter, editing and debugging your programs, working with files and devices, and using some of Amiga Basic's advanced features. Chapter 7 is a guide to using the Object Editor, a program written in Amiga Basic, which lets you create images to use in animations with your application programs. 1-2 Introducing Amiga Basic Chapter 8 is a reference for the BASIC language. Use the Amiga Basic Reference section to read about general characteristics of the language and to look up the syntax and usage of BASIC statements and functions in the Statement and Function Directory. Special Features of Amiga Basic The Amiga Basic Interpreter is written in assembly language and thus is small (80K). The core of Amiga Basic has been field tested for three years. Amiga Basic is a "standard" BASIC in that it will run most programs that were written in Microsoft BASIC on most other machines. Ease of Program Development Like all languages, Amiga Basic is always growing, changing, and improving. Amiga continues to keep its BASIC interpreter up to date with new features. Here are some of the latest features you'll find in this version of BASIC. All of the features are described fully in the reference section of the manual. Support for Amiga Application Programs Amiga Basic provides the tools you need to write programs that work like and look like they were written for the Amiga. These tools are especially important if you are a software developer who plans to sell application programs for the Amiga. It is also true that significant Macintosh MS-BASICtm and IBM-PCtm BASIC applications can easily be ported over to the Amiga. Mouse Support With the MOUSE function, your BASIC program can accept and respond to mouse input. The MOUSE function returns the coordinates of the mouse pointer under various conditions (left button up, left button down, single-click, double-click, and drag). Introducing Amiga Basic 1-3 MENU Statement Your programs can display Amiga-style menus created by BASIC'S MENU statement. This statement opens and closes menus and highlights menu items. If you want, you can replace BASIC'S menus with your own menus, to give your program a completely "custom" look. Powerful Language Features Amiga Basic provides a number of powerful language features that lend flexibility to your programs. These features include the following: Block Statements IF-THEN ELSE statements let your program make decisions during program execution. You can now include multiple statements on one or more lines after THEN. Subprograms Amiga Basic allows subprograms that have their own local variables. Using subprograms, you can build a library of BASIC routines that can be used with different programs. You can do this without concern about duplicating variable names in the main program. SHARED Statement The SHARED Statement allows variables to be shared between the main program and its subprograms. Integer Support Amiga Basic includes both 16 and 32 bit integer support. 1-4 Introducing Amiga Basic Floating Point Support The Amiga version includes both 32 and 64 bit floating point support. No Line Numbers Required Program lines do not require line numbers. Assigning labels to functional blocks lets you quickly see the control points in your program. Alphanumeric Labels Alphanumeric line labels beginning with an alphabetical character allow the use of mnemonic labels to make your programs easier to read and maintain. Sequential and Random Access File Support Both sequential and random access files can be created. Sequential files are easy to create, while random access files are flexible and quick in locating data. Device Independent I/O Support of RS232 and Parallel Ports Using Amiga Basic's traditional disk file-handling statements, a program can direct both input and output from the screen, keyboard, line printer, and RS232 and parallel ports. You can open the line printer or screen for output as easily as you open a disk file. Features that Show Off the Amiga A number of features of Amiga Basic enhance Amiga's color, graphics, animation, and sound capabilities: • Four-voice synchronized musical reproduction through the SOUND and WAVE statements Introducing Amiga Basic 1-5 • Creation of audible speech through the SAY and TRANSLATES statements • The ability to save and redisplay screen im...
Amiga789