Introduction

This manual is intended to introduce you to the HP BASIC programming language and to provide some helpful hints on getting the most utility from it. Although this manual assumes that you have had some previous programming experience, you need not have a high skill level, nor does your previous experience need to be in BASIC. If you have never programmed a computer before, it will probably be more comfortable for you to start with one of the many beginner's text books available from various publishing companies. However, some beginners may find that they are able to start in this manual by concentrating on the fundamentals presented in the first few chapters. If you are a programming expert or are already familiar with the BASIC language of other HP computers, you may start faster by going directly to the HP BASIC Language Reference and checking the keywords you normally use. You can always come back to this manual when you have extra time to explore the computer's capabilities, or if you bump into an unfamiliar concept.

After reading each section and trying the examples shown, try your own examples. Experiment. You cannot damage the computer by pressing the wrong keys. The worst thing that can happen is that an error message will appear. All errors are listed in the "Error Messages" section in volume 2 of the HP BASIC Language Reference.

Some Important Notations

There are three implementations of HP BASIC, which are described below. The notations BASIC/WS, BASIC/UX, and BASIC/DOS are used throughout this manual to identify these implementations.
BASIC/WS The Workstation implementation, which is a combined language and operating system that runs on HP 9000 Series 200/300 computers. (This is probably the most familiar implementation of the HP BASIC language.)
BASIC/UX The HP-UX implementation, which is essentially the BASIC interpreter and part of the BASIC Workstation operating system that runs as a set of processes "on top of" the HP-UX operating system. This exists in two forms: BASIC/UX 300 for series 300/400 machines, and BASIC/UX 700 for series 700 machines.
BASIC/DOS The DOS implementation, which is essentially Workstation BASIC modified slightly to run on the HP Measurement Coprocessor. BASIC/DOS supports both the HP 82300 Measurement Coprocessor and the HP 82324 High-Performance Measurement Coprocessor. These coprocessors provide HP Series 200/300 computer architecture on a PC plug-in card.

Most of the programming techniques described in this manual are applicable to all three implementations of HP BASIC. However, where there are specific differences, they will be identified.

What's In This Manual?

No matter what your skill level, it is helpful to understand the contents and organization of this manual. First of all, there are some things that it is not. Because it is organized by topics and concepts, it is not a good place to find an individual keyword in a hurry. Keywords can be found using the index, but even so, they are often embedded in discussions, contained in more than one place, or only partially explained. Also, this is not a good place to find complete syntactical details. Program statements are often presented only in the form that applies to the specific concept being discussed, even though there may be other forms of the statement that accomplish different purposes. If you want to quickly find the complete formal syntax of a keyword, use the HP BASIC Language Reference. It is specifically intended for that purpose.

This manual contains explanations and programming hints organized topically. A program performs various sub-tasks as it completes its overall job. Many of these tasks should be viewed separately to be understood more easily and used more effectively. For example, perhaps you have experience in another programming language. You know exactly what a "loop" does, but you didn't find the statement you were looking for in the HP BASIC Language Reference. In the chapter on "Program Structure and Flow," there is a section called "Repetition" which explains the kinds of loops available and all the statements needed to create them. The following is an overview of the chapters in this manual. (Note that the HP BASIC Advanced Programming Techniques manual provides additional information about selected programming topics. References to this manual are given where appropriate.)

Chapter 1: Introduction

Chapter 2: Program Structure and Flow

Chapter 3: Numeric Computation

Chapter 4: Numeric Arrays

Chapter 5: String Manipulation

Chapter 6: Subprograms and User-Defined Functions

Chapter 7: Data Storage and Retrieval

Chapter 8: Graphics Techniques

Chapter 9: Graphics on Printers and Plotters

Chapter 10: Using a Printer

Chapter 11: Using the Clock and Timers

Chapter 12: Handling Errors

Chapter 13: Debugging Programs

Chapter 14: Introduction to I/O