Home

Starting BASIC

image

Contents

1. HEWLETT PACKARD N Integral Personal Computer HP UX Technical BASIC Getting Started Guide Kin HEWLETT PACKARD Edition 1 December 1984 Part Number 82860 90001 5 I Notice Hewlett Packard makes no warranty of any kind with regard to this material including but not limited to the implied warranties of merchantability and fitness for a particular purpose Hewlett Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing performance or use of this material Hewlett Packard assumes no responsibility for the use or reliability of its software on equipment that is not furnished by Hewlett Packard 9 Copyright 1984 Hewlett Packard Company This document contains proprietary information which is protected by copyright All rights are reserved No part of this document may be photocopied reproduced or translated to another language without the prior written consent of Hewlett Packard Company The information contained in this document is subject to change without notice Restricted Rights Legend Use duplication or disclosure by the Government is subject to restrictions as set forth in paragraph b 3 B of the Rights in Technical Data and Software clause in DAR 7 104 9 a Copyright 1979 The Regents of the University of Colorado a body corporate Copyright 1979 1980 1983 The Regents of the University of California This so
2. ASIC Exit BASIC To stop a BASIC program To exit BASIC To suspend execution of a BASIC program To continue program exe cution after a To suspend the display output To resume output to the display Press Stop Stop key or the Sto pute E function key f8 on the BASIC system menu Be sure to shuf fle the windows if necessary so that the BASIC window is the active window First stop execution of any pro gram thet ey be a Then Press Press simultaneously Press any key except Break The message RESET will be displayed on the screen and the BASIC menu labels will appear at the bottom of the screen The BASIC window will remain ac tive The reset conditions are given in the appendix to the HP UX Technical BASIC Refer ence Manual Once the message Exiting Basic has been displayed the BASIC window will be dead Press to eliminate the window The program will be suspended and the message PHLUSE will be displayed on the screen The program will continue execution The output to the display will be suspended Program execution will continue until the ouput buffer is full and then it will be suspended Output to the display will resume Running a BASIC Program 4 3 E A D HEWLETT e PACKARD Mfg No 82860 90001 Printed in U S A
3. SIC Find out more about the syntax Program I O devices Find description of error messages Program using display or printer enhancements Upload Series 80 files to the Integral PC Familiarize yourself with the general operations on the Integral PC Learn how to select pro grams shuffle windows and get around the file system Learn how to use the system function keys Learn more about the file system HP UX Technical BASIC Get ting Started Guide 82860 90001 HP UX Technical BASIC Implementation Guide 82860 90004 HP UX Technical BASIC Reference Manual Vol 1 82860 90002 HP UX Technical BASIC I O Programming Guide 82978 90001 HP UX Technical BASIC Reference Manual Vol 2 82860 90003 Integral PC Comprehensive Guide 00095 90025 HP UX Technical BASIC Implementation Guide 82860 90004 Integral PC User s Guide 00095 90002 Tutor Disc Integral PC User s Guide 00095 90002 Tutor Disc Integral PC User s Guide 00095 90002 Tutor Disc Integral PC Comprehensive Guide 00095 90025 1 Introduction About This Guide mis guide will show you how to get started using the HP UX Technical BASIC on the Integral Personal Computer It pro vides specific step by step procedures for starting the BASIC interpreter entering a program and then running the program This guide is not a substitute for a tutorial on how to program in BASIC It assumes you already have some exper
4. ditor If you have some experience using the vi or ed editors you may want to create your BASIC programs using these editors Both of these system editors are provided on the Integral PC Applications Disc Documentation for these editors is pro vided on the utilities disc and appendix F Using the Vi Editor in the Integral PC Comprehensive Guide To create a BASIC program file using a system editor Start the vi or ed editors from PAM or another shell Enter your program Each BASIC statement should have a line number Save your file on a microflexible disc or on the electronic disc Start BASIC if it is already started simply shuffle the windows until BASIC is the active window Type in GET filename The filename must be either a complete path name or the name of a file in the current working directory The BASIC interpreter will attempt to load each line with a line number as a program line It will also display the commands found in the file on the basic window but it will not execute the commands If a syntax error is found the illegal line is printed followed by an error message To list the program type in LIST or press the G1 function key Creating a Program 3 7 BASIC Statement Syntax The exact syntax of BASIC keywords is diagrammed for each keyword in the dictionary section of the HP UX Technical BA SIC Reference Manual Vol 1 located in this binder For general information on how to
5. ftware and documentation is based in part on the Fourth Berkeley Software Distribution under license from The Regents of the University of California 9 Copyright 1980 1984 AT amp T Technologies All Rights Reserved UNIX is a registered trademark of AT amp T Bell Laboratories Portable Computer Division 1000 N E Circle Blvd Corvallis OR 97330 U S A Printing History Edition 1 December 1984 Mfg No 82860 90001 Contents Guide to Documentation Chapter 1 Introduction About This Guide What is HP UX Technical BASIC Before You Start Hardware Requirements Chapter 2 2 1 2 2 2 3 2 5 Starting BASIC Before You Start BASIC Starting BASIC From a Microflexible Disc Starting BASIC From a Fixed Disc Autostarting BASIC Chapter 3 3 1 3 2 3 3 3 7 3 8 3 8 Creating a Program Do You Really Need a Program Entering a BASIC Program Using the BASIC Editor Using a System Editor BASIC Statement Syntax Using the Machine Specific Features of the Integral PC Chapter 4 4 1 4 2 4 3 Running a BASIC Program How to Run a BASIC Program Handling Error Conditions How to Stop Suspend and Exit BASIC Contents iii Guide to Documentation A P Vb hh A OO O OO If You Are Interested In And You Want To Do This Read This HP UX Technical BASIC Personal Applications Man ager PAM Find out how to run a BA SIC program Learn more about the ma chine specific features of HP UX Technical BA
6. ght the copy disc program and press Start GD Press the Heip f7 function key and follow the in Ue o structions in the copy dise window Starting BASIC 2 1 Starting BASIC To start BASIC from a microflexible disc From a 1 Select the PAM window Microflexible 2 Insert the BASIC disc The PAM window will then be Disc updated 3 Highlight BASIC the BASIC interpreter and press GD 4 The BASIC window should appear as shown below The BASIC interpreter is now ready for you to enter a com mand or statement Basic ver a 2 2 Starting BASIC LLL Starting BASIC To start the BASIC interpreter from a fixed disc first use the From a Fixed procedure below to copy the master BASIC disc to your fixed disc Disc To copy BASIC to a fixed disc 1 Use the makefolder utility to make a folder on the fixed disc if necessary to hold the BASIC interpreter and your BASIC programs For example to make a folder called Programs on the usr disc go to the PAM win dow and type in makefolder usr Programs Insert the BASIC disc Highlight BASIC Press the Copy 45 function key When prompted for the destination type in usrePrograms Use the 15 function key to copy the remain der of the files on the BASIC disc to the usr Programs folder Starting BASIC 2 3 2 4 Starting BASIC 7 Check to be sure all files are in the same folder The file structure in our e
7. hem to the electronic disc 2 Start BASIC and use the GET or LOAD command to en ter your program file into BASIC program memory For example if your program file is an HP UX ASCII text file named usr Programs SpeedCalc type in GET susr Programs SpeedCalc 3 Press f2 to start program execution The program will run in the BASIC window If the program contains a BASIC graphics instruction the program will auto matically create a graphics window If the program requires input from the keyboard it will prompt with a question mark Running a BASIC Program 4 1 NENNEN BB L Handling Error Error messages during program execution will be sent to the Conditions standard error device usually the display If your program is sues an error message and then stops try the following m Write down the error message and line numbers if given Once the error messages roll off the top of the display memory the messages will be lost B Look up the error messages in chapter 6 of the reference manual Vol 2 B List the program or parts of it B Examine the statements for correct syntax and usage Refer to the keyword dictionary section of the reference manual or to the quick reference guide 4 2 Running a BASIC Program E m v o VyVP ph O How to Stop Suspend and Shuffling windows will not stop or suspend the programs Use one of the following procedures to stop suspend or exit B
8. ience pro gramming in BASIC For a detailed guide to HP UX Technical BASIC programming techniques you are encouraged to order the HP UX Technical BASIC Programming Guide 98680 90035 To get the most out of this guide you should already have your Intergral PC set up and be familiar with the Personal Applications Manager PAM and the general operation of the system If you need to review we suggest you use the tutor disc provided with your system or read the appropriate sec tions of the user s manual Later in this chapter the section Before You Start will help you get ready This guide is not comprehensive It should be used in con junction with the following manuals provided with the Integral PC and the BASIC interpreter m HP UX Technical BASIC Reference Manual 82860 90002 m HP UX Technical BASIC Implementation Guide 82860 90004 m HP UX Technical BASIC Quick Reference Guide 82860 90005 W Integral PC User s Guide 00095 90002 W Integral PC Comprehensive Guide 00095 90025 Introduction 1 1 Depending on your application the following two manuals may also be needed 1 HP UX Technical BASIC posu Guide 98680 90035 2 HP UX Technical BASIC I Jo Programming Guide 82978 90001 These two manuals may be ordered separately from your Hewlett Packard dealer What is HP UX Technical BASIC 1 2 Introduction HP UX Technical BASIC is an easy to learn yet powerful lan guage that allows you to uti
9. l included in this binder 4 Read the Software License and Warranty card before you break the seal on the package containing the HP UX Technical BASIC disc 5 Check to be sure your Integral PC meets the minimum hardware requirements listed in the next section If you are now ready to start turn to chapter 2 NENNEN Hardware To run HP UX Technical BASIC on your Integral PC you will Requirements need the following additional hardware B One HP 82925A 256K Memory Module or HP 82927A 512K Memory Module Introduction 1 3 Starting BASIC Like other programs the BASIC interpreter may be invoked from either a microflexible disc or if you have one from a fixed disc This chapter describes both procedures Before You Start BASIC Before you use your BASIC disc for the first time we recom mend that you make a working copy of the master disc containing the BASIC interpreter To make a copy of the BA SIC disc use the following procedure or refer to the Integral PC User s Guide for more information To format and initialize a new disc 1 2 3 4 5 Write enable a blank disc Select the PAM window Insert the utilities disc Highlight the format disc program and press GD Press the Help Q7 function key and follow the in structions in the format disc window To copy the BASIC disc to the new disc 1 2 3 Remove the blank disc and re insert the utilities disc Highli
10. lize the advanced computational and graphics capabilities of your Integral PC It is similar to Series 80 BASIC but it was developed to run on the HP UX operating system With HP UX Technical BASIC on the Integral PC you can B Piot and digitize on the internal graphics display W Access up to 5 external disc drive units m Access up to 8 megabytes of random access memory RAM B Control the enhanced features of the internal display and printer Use peripheral printers and multi pen plotters Control intrumentation and other I O devices Interface with real time control instrumentation Perform advanced matrix and string operations Use the full Extended Roman Character Set Access the internal clock Perform on event branching Before You Before you read further in this guide we suggest you do the Start following 1 If you have not done so previously unpack and set up your Integral PC Follow the instructions on the set up card included with your computer 2 Start the tutor disc and review the following B How to highlight and start a program B How to shuffle windows B How to use the format disc and copy disc friendly utilities m How to use the Copy f5 fonction key m How the file structure is organized 3 Scan through the other manuals provided with the BA SIC interpreter to familiarize yourself with their contents In particular read How to Use This Manual in chapter 1 of the reference manua
11. ntered into the program memory instead of being executed immediately For example to calculate the number of seconds in a given number of days first assign the number of seconds in one day to the variable 5 using a LET statement type in LET S 24 68 68 To find the number of seconds in three days simply type in 2 5 Retum The result will be displayed immediately Creating a Program 3 1 To find out if a particular BASIC keyword is immediately exe cutable from the keyboard refer to the keyword dictionary in the HP UX Technical BASIC Reference Manual located in this binder A solid box next to the heading Keyboard Execut able indicates that the keyword is immediately executable Entering A BASIC Program 3 2 Creating a Program This section will discuss how to enter store and fetch a pro gram file If you are writing your first BASIC program you may need the HP UX Technical BASIC Quick Reference Guide or the HP UX Technical BASIC Reference Manual at your desk A program file may be created using either a system editor such as vi or ed or the BASIC editor If you use a system editor you will store your file as an HP UX ASCII text file then load it into BASIC program memory using the BASIC GET command If you use the BASIC editor you may store your file as either an HP UX text file using the SAVE com mand or as an HP UX Technical BASIC program file using the STORE command Using the BASIC Editor If yo
12. o km hour and knots ISP Enter speed in m sec Prompt for inpu P UT SP PEED Key in information D FACTORI UNIT 1 FACTOR2 UNIT2 SPEEDI SPEED FRCTORI SPEED SPEED lt FACTORZ T SPEEDi M sec SPEEDI 5UNIT1 5 and SPEED2 UHIT2 3 6 kM hr 1 344 knots TORE 36 0 26 TO D BEE INF REA LET LET PRI B DAT RE GO SDs 3 4 Creating a Program Stop the automatic line numbering by backspacing over the last line number and pressing Return List the contents of the program memory by pressing the 01 function key The program lines will be listed on the display Delete unwanted lines by using the Cshift f2 function key or by typing in the DELETE command For example to delete the first line in the example above type in DELETE 18 This will delete line 10 Insert or append new lines by entering a line number followed by the statement For example to put the line we just deleted back in type in 18 REM X X This program converts speed in mesec to kmehour and knotz Return Unless you want to replace an existing statement be sure the line number is unique otherwise the editor will replace the existing statement with the new statement Use the cursor movement keys in combination with the keyboard editing keys located in the numeric keypad to move around the screen and make corrections to pro gram lines As an example let s change line 30 Use the arrow key
13. s to move the cursor over the comma in the EEEF state ment To insert characters press the once to get into the insert mode then type in your text To get out of the insert mode press again For this example type in B to change the pitch of the beep To delete a character move the cursor over the character then press Shift Delete char After you have changed the line on the screen press Return to enter the line Creating a Program 3 5 ER 3 6 Creating a Program 10 Use the FEH command to renumber the program lines For example type in REH Retum This will renumber the program lines and all references to line numbers By default the renumbering starts at line 10 and increments by 10 To save the program use the STORE command to store the program as a BASIC program file or the SAWE com mand to save the program as an ASCII text file If you plan on editing the program using a system editor save the file as an ASCII text file For example to store the sample program as a BASIC program file named SpeedCalc type in STORE SpeedCalc M For a summary of all program entry and editing keywords refer to chapter 7 of the HP UX Technical BASIC Reference Manual B For general information on how to use the editor refer to the HP UX Technical BASIC Programming Guide B For a description of the typing aids on the BASIC user menu refer to the HP UX Technical BASIC Implementation Guide Using a System E
14. u have never used the vi or ed editors getting started will be easier if you use the BASIC editor Unlike the system editors the BASIC editor provides auto matic line numbering using the ALTA command and immediately checks the syntax of each statement after it is en tered Syntax error messages are displayed by the BASIC editor after each erroneous program line or command is en tered For example 14 print Ha end quate BAO STEING The carrat symbol marks the first occurrence of the syntax error that was recognized by the editor The following section will provide an introduction to the screen editing capabilities of the Integral PC and the follow ing BASIC keywords m SCRATCH BH AUTO E LIST MN DELETE B EEH B STORE Bi SAVE Creating a Program 3 3 To create a BASIC program using the BASIC editor 1 Start BASIC For more information refer to chapter 2 2 Type in SCRATCH to clear the program memory if you have previously entered other program statements 3 Type in your program Preceed each line with a line number or use the ALTO command to automatically pro vide line numbers To familiarize yourself with the BASIC editor enter the following program Type in each line shown below followed by Return At this point you may ignore any typing errors you make until we discuss the editing keys later in this section Easic ver SCRATCH A FU B REM xxxxThis BE M converts speed in m sec t
15. use the keyword dictionary how files are named the use of spaces and the BASIC metacharacter refer to chapter 1 of the reference manual Using the Machine Specific Features of the Integral PC 3 8 Creating a Program The Integral PC has a number of machine specific features that may be used in BASIC In the section on using the BA SIC editor we have introduced several of the typing aids available on the function keys and we have also given an example of how to use the screen editing capabilities of the BASIC editor These are just two examples of machine spe cific features that are found on the Integral PC Other HP UX systems running HP UX Technical BASIC will have similar capabilities but they will not be exactly the same For a description of these machine specific features and how to use them from HP UX Technical BASIC refer to the HP UX Technical BASIC Implementation Guide in the back of the second binder 4 Running a BASIC Program How to Run a After your program has been entered or loaded into the B ASIC Program BASIC program memory you are ready to run it To load and run a program 1 Mount all external disc files that the program uses If you are using peripheral microflexible disc drives use the mount disc utility from PAM to mount the discs be fore running your program If you have more discs than available disc drives try consolidating the files your pro gram needs onto one disc or copying some of t
16. xample is shown below usr Programs Data Files upload BASIC load hpgl After the BASIC disc has been copied to your fixed disc use the following procedure to start the copy of the BASIC inter preter on your fixed disc To start BASIC from a file on your fixed disc 1 Open the folder containing BASIC For example type in Wer sFr ogr ams or use the function keys to open the appropriate folder 2 Highlight BASIC and press 81 You may also type in BASIC in the PAM command line if your current working directory contains the BASIC program Note that syntax for invoking the BASIC interpreter does not include options or arguments After the BASIC window appears the BASIC interpreter is ready for you to input a command or statement Autostarting For information on how to autostart the BASIC interpreter re BASIC fer to the HP UX Technical BASIC Implementation Guide or the Integral PC Comprehensive Guide Starting BASIC 2 5 Creating a Program This chapter is an orientation chapter It will show you how to enter store and retrieve a program file Do You Really Need a Program Not all applications require writing a BASIC Program For simple calculations you may want to execute the BASIC state ments from the keyboard Most BASIC statements may be executed one at a time sim ply by typing in the statement then pressing Return Do not include a line number or the statement will be e

Download Pdf Manuals

image

Related Search

Related Contents

Guida per l`utente Instructions pour l`utilisateur Anleitungen    Appliskan User Manual - Fisher Scientific    Transmission  TruLink™ 1 Port VGA over UTP Extender  

Copyright © All rights reserved.
Failed to retrieve file