User Manual HiSOFT BASIC 2 for the Amiga Computers By HiSOFT © Copyright 1994 HiSOFT. All rights reserved. Program: designed and programmed by HiSOFT. Manual: written by David Nutkins, Alex Kiernan and Tony Kendle. This guide and the HiSOFT BASIC 2 program diskette contains proprietary information which is protected by copyright. No part of the software or the documentation may be reproduced, transcribed, stored in a retrieval system, translated into any language or transmitted in any form without express prior written consent of the publisher and copyright holder(s). HiSOFT shall not be liable for errors contained in the software or the documentation or for incidental or consequential damages in connection with the furnishing, performance or use of the software or the documentation. HiSOFT reserves the right to revise the software and/or the documentation from time to time and to make changes in the content thereof without the obligation to notify any person of such changes. Published by HiSOFT The Old School, Greenfield, Bedford MK45 5DE UK First Edition, March 1994 - ISBN 0 948517 69 7 Preface to HiSOFT BASIC 2 Introduction HiSOFT BASIC 2 for the Amiga range of computers is a powerful and modern version of the BASIC language that gives you a totally integrated and interactive environment for the production of your programs. HiSOFT BASIC 2 (from now on, we'll just call it HiSOFT BASIC) is a compiled language. This means that your programs are converted into fast running and compact machine code which makes it realistic to use this language for almost any type of application you wish. HiSOFT BASIC is the result of many years design and programming effort and our goal was to produce a BASIC compiler with the following features: * interactive edit/compile/run cycle, like an interpreter * compile Microsoft QuickBASICª with minimal change * compile most flavours of BASIC with little modification * fast compile time and very fast execution time * full recursive sub-programs and functions with parameters * many structured statements like WHILE...END WHILE, DO...LOOP UNTIL, SELECT...CASE etc. * full support for the Amiga range of computers (and the CD32) through the use of the operating system libraries, devices and resources * clear error reporting and correction * no limits on variable size Thanks to the power and flexibility of the Amiga and its operating system, we have been able to implement all of these design goals in the HiSOFT BASIC compiler and the results are explained in detail in the two manuals that complement the software. Please spend some time and effort getting to know and learning how to use the manuals so that you can gain the maximum benefit from HiSOFT BASIC. The rest of this section explains how to use the manuals, whether you are a beginner or an expert, how to use your computer to best effect with HiSOFT BASIC and, finally, we outline the different type styles that we have used throughout the manuals to (hopefully) make them easy and enjoyable to use. How to use this Manual This manual contains both information on using HiSOFT BASIC 2 and reference information. Its main purpose is not to teach you BASIC, although there is an extended tutorial chapter which starts from first principles and should be helpful to beginners. If you find the tutorial hard work we would encourage you to obtain one of the hundreds of good books on the subject (perhaps through your local library). We have designed this manual to tell you about using HiSOFT BASIC on the Amiga computers. We have packed a great deal of information about the package into the manuals and, in order to help you use them efficiently and easily, we will now plot recommended courses through the manuals for you, whether you are a beginner to BASIC or a seasoned expert. A Course for the Beginner Start by reading the rest of this Preface, then Chapters 1, 2, 3, 4 in order. You may find that you want to skip some of Chapter 2 (The Tutorials) but we would encourage you to work through the programs to gain experience in using the editor and compiler. Passages marked with a sidebar, as this paragraph is, can be omitted at first reading - they provide, mostly, technical or background information. You should then be ready to begin writing your own programs. You will find it useful to refer to the Command Reference (Chapter 5) for the commands that HiSOFT BASIC allows you to use and Chapters 3 and 4 for details on using the editor, compiler etc. If you intend to program the operating system Chapter 9 should be consulted. At some stage we recommend reading the Concepts chapter to gain an overview of the language features of HiSOFT BASIC. The Appendices are mainly for reference and you will only need to dip into them occasionally although we would recommend reading AppendixÊB (Hints and Tips) at an early stage. We hope you find HiSOFT BASIC easy and friendly to use, please do not hesitate to write to us with any suggestions for improvements and/or alterations. A Course for Seasoned BASIC Programmers If you are already familiar with BASIC programming and also with the Amiga then we recommend that you use this manual in the following way. Firstly, finish reading this Preface and then move on and read Chapter 1 and Chapter 3. If you are eager to start programming then run the installation program and double-click on HBasic2 (on your working disc!) and refer to Chapters 3, 4, 5, 7 as and when necessary. It is useful to read the Concepts chapter in this manual at some stage to appreciate the language features of HiSOFT BASIC. We would encourage you to work through at least the latter part of Chapter 2 (The Tutorials). If you intend programming the operating system then you will need to consult Chapter 9. For information on linking with C and assembler language programs, look at Appendix G. The other Appendices are for general reference and it is worth glancing through all of them to acquaint yourself with their contents. Good luck, we hope you find HiSOFT BASIC a powerful, flexible and easy-to-use development system. Of course, we welcome any written comments you may have on how we might improve both the program and the manuals. System Requirements HiSOFT BASIC will run on any Amiga computer (500-4000T) with at least 1Mb of memory, at least Workbench 1.3, a keyboard and one floppy disk drive. The programs should work in any resolution on all commercially available monitors. If you are serious about writing large programs and full taking advantage of the operating system we recommend 2 megabytes of RAM and a hard disk. Typography In order to make the manuals easy to read and to convey the maximum information as clearly as possible, we have adopted certain typefaces and typestyles throughout the manuals. These are used as follows: Typefaces Palatino General text. Futura oblique Chapter and sub-Chapter headings and references to them. Monospace Used to show something that is typed in at the keyboard or displayed on the screen. Predominantly used in program listings and references to function names, variables etc. Avant Garde Used for filenames, menu selections and button names. Also used to denote legends on single keys such as Alt (the Alternate key) and Ctrl (Control). Typestyles Italic Used for emphasis. and in syntax descriptions to show something to be filled in e.g. INT(numeric_expression) where numeric_expression is to be replaced by an expression when INT is used in a program. Special Characters [] Within syntax descriptions, information enclosed in [] is optional e.g. [CALL] sub_program_name means that you can call a sub-program TEST by CALL TEST or simply by TEST. {} Within syntax descriptions this indicates a choice of one or more options, each separated by a vertical bar (|) e.g. PRINT [expression_1] [{;| |,} expression2]... indicating that expressions in PRINT statements may be separated by a semi-colon, a space or a comma. ... Indicates repetition in syntax descriptions. ... Vertically-spaced dots show that some part of a program has been omitted. Acknowledgements The trademarks (both registered and otherwise) of various companies are used throughout its manuals. In particular: QuickBASIC is a trademark of Microsoft Corp. TurboBASIC is a trademark of Borland International Inc. HiSOFT BASIC, Power BASIC,, Devpac Amiga, GenAm, and MonAm are trademarks of HiSOFT. Amiga is a registered trademark of Commodore-Amiga, Inc.. Amiga 500, Amiga 600, Amiga 1000, Amiga 1200, Amiga 2000, Amiga 3000, Amiga 4000, AmigaDOS and Amiga Workbench are trademarks of Commodore Electronics Ltd. We acknowledge any other trademark used but not listed above.