• • • Integral Personal Computer • • • • • • • • • • • • • • • •
Integral Personal Computer HP-UX Technical BASIC Implementation Guide Edition 1 December 1984 Part Number 82860-90004
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. HewlettPackard 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.
Contents Guide to Documentation Chapter 1 Introduction 1-1 1-2 Chapter 2 About This Guide Where to Find More Information Integral PC Specifics 2-1 2-1 2-2 2-3 2-4 2-5 2-7 2-8 2-8 2-9 2-10 2-11 2-11 2-12 2-12 2-12 2-15 2-15 2-16 2-17 2-17 2-18 The Keyboard BASIC Function Keys Programming the Function Keys o t·~ tCl B D Statement Keyboard Escape Sequences Alpha Display Screen Editing Multiple Windows BASIC Graphics Graphics Window Digitizing Keyword Specifics Graphics Menu '.
Chapter 3 3-1 3-2 3-2 3-4 3-4 3-5 3-5 3-6 3-6 3-6 3-9 3-10 3-11 3-12 iv Uploading Series 80 BASIC Files Introduction Hardware Requirements Limitations Preparation Microflexible Disc Types File Naming Conventions Series 80 Program Files Series 80 DATA, LIF and CRAF Files Running the Upload Program Using the Single Internal Disc Drive Using Multiple Disc Drives Options Error Conditions Disc Drive Naming Conventions
Guide to Documentation If You Are Interested In And You Want To Do This Read This HP-UX Technical BASIC Find out how to run a BASIC program HP-UX Technical BASIC Getting Started Guide (8286090001) Learn more about the machine-specific features of HP-UX Technical BASIC HP-UX Technical BASIC Implementation Guide (8286090004) HP-UX Technical BASIC Reterence Manual, Vol.
1 About This Guide Introduction This guide describes the machine-specific aspects of the implementation of HP-UX Technical BASIC on the Integral Personal Computer. HP-UX Technical BASIC is a new version of BASIC developed from Series 80 BASIC for the HP-UX series of computers. It includes most of the Series 80 keywords found in Series 80 BASIC, including the keywords found in the Advanced Programming ROM, Printer/Plotter ROM, I/O ROM and the Matrix ROM.
This guide provides information on each of these features to allow you to get the most out of the advanced features of your Integral PC. This guide is divided into three chapters. The information in the three chapters is summarized below. Chapter 1: Introduction Summarizes what information is in this manual. Chapter 2: Integral PC Specifics This chapter summarizes the machine-specific capabilities of the Integral PC that may be used from HP-UX Technical BASIC programs.
2 Integral PC Specifics The Keyboard This section describes some of the machine-specific features of the Integral PC keyboard. For a general discussion of how to use the keyboard, refer to chapter 3 of the user's guide.
BASIC Function Keys (continued) Key Q[) SCRATCH No @ PRINTER IS No em PLiST Yes @ KEY LABEL Yes MASS STORAGE IS No DELETE No (][) ®, CITQ) ,= CITD , LOAD No (]I[) , STORE No ; TRACE ALL Yes CRT IS No INIT Yes Exits BASIC Yes (@ (fill (ill) (]]) Programming the Function Keys Immediate Execute? Typing Aid Key Label ;: "';:-=!.!"·Y' ,' ...• !.--., ..
To redefine the typing aids available from the keyboard, use the 0 t·4 K E \' # statement without a line number. For example, to assign the CLEAP statement to the @ function key enter the following statement: ot·~ K E \' # 9., " C LEA F.: " .' "C LEA P ..... 1 3" (Return) Pressing @ is equivalent to typing the pressing return. I] t·i K \' B D Statement C LEA P statement and The Ot·4 K\'BD statement is used to initiate program branching when a specific key is pressed.
Keyboard Escape Sequences The following table provides a list of escape sequences returned by the Integral PC keyboard. (Because these escape sequences have been remapped, these values are valid only while running HP-UX Technical BASIC.) Keyboard Escape Sequences 2-4 Integral PC Specifics Key Name Numeric Key Code BASIC Escape Sequence (ill 363 ·····027k @ 364 ···.·(1271 @) 365 ··... 027m OD CID 00 366 ···.·~~127n 367 ···.·[127cl 368 ·····027p em 369 ·····027,1.
Keyboard Escape Sequences (continued) Alpha Display Key Name Numeric Key Code BASIC Escape Sequence ( Shift )( Tab) 361 ·····027 i (Tab) 329 ···.·~:127 ( I nsert char) (Mode On) 337 ·····027G! ( I nsert char) (Mode Off) 338 ···.·[127P ( Delete char) 336 ···.·[127F' (Prev) 342 ·····027 1,} (Next) 341 ·····~327U m 321 ·····027A @ 324 ·····027D C!) 322 ·····027B CB 333 ·····027C (Shift)m 339 ·····027::; (Shift)m 340 ···.
The size of both the alpha window and display buffer is shown below. Figure 2-1. Size of the Alpha Window -------------, Alpha Window 24 lines x 80 columns I BASIC Screen Memory Il __________________________ 32 lines x 160 columns _ To change the position of the alpha window with respect to the display buffer, use the (Shift) key in combination with the arrow keys. The normal mode for the alpha display is black characters on a white field.
For example, to print one word in inverse mode, enter the following statement: 1 [1 D I !:;p 1I·····27t:dB I t·~'.}EF.:!:;E! ···.·27:~.:dl!! II Display Escape Sequences Screen Editing Key Sequence BASIC Escape Sequence (ESC )&dB ·····27t:dB Inverse mode. (ESC )&dD ·····27g.:dD Underline mode. (ESC)&dF ·····27:~.:dF Inverse and underline mode. (ESC )&d@ ·····278.:dl!! Turn off all display enhancements.
Multiple Windows HP-UX Technical BASIC runs in a multi-tasking environment on the Intergral PC. This means that users can have several processes running at the same time. For example, you may start a program in the BASIC window and then return to the PAM window. From the PAM window you can start other programs while your BASIC program is running. Multiple windows are also useful when you need to run a system utility while you are in BASIC.
Graphics Window The BASIC graphics window is a view into the graphics buffer. The graphics buffer is a 512 by 255 array of bits in memory. When plotted on the display, this corresponds to roughly 2.8 dots per millimeter over the entire 18 by 9 cm display. The size of the graphics window is initially 162 mm by 67 mm. But like other windows, its size can be changed with the j§t~tl<;":; (@) function key and moved with the ;:::·;MQi~~.: (CIT)} function key (both on the graphic window's system menu).
Again, like other windows, the graphics window can be positioned over any portion of the plotter buffer by using the (Shift) key in combination with the cursor keys. The effect is as if the plotter buffer is sliding" under the window. 1/ Operation Digitizing Key Roll left. (Shift)@ Roll right. (Shift Roll up. (Shift)ffi Roll down. (Shift )0 )cy) Description Moves the plotter buffer left. Moves the plotter buffer right. Moves the plotter buffer up. Moves the plotter buffer down.
To use the DIG I T I Z E statement directly from the keyboard (in the immediate execute mode), use the following procedure: 1. Enter the DIG I T I Z E statement followed by a ( Return). For example: DIG I T I ZE ::<., 'y' 2. Select the graphics window using the display pointer. 3. Move the pen icon with a combination of ( Select) and cursor keys. For example, to move the pen to the right press (Select )CE) simultaneously. 4. Press (Enter) key to enter the pen coordinates. (The pen icon will disappear.) 5.
i,} [I L Ut'! E I ::; Statement The volume labels on discs may be renamed using the I,} [I L Ut'l E I ::; statement. Peripheral disc drive device names on the Integral PC consist of the upper case letter D followed by three digits; volume number, HP-IB address, and disc drive number. For example, D020 is the device name of volume 0 of disc drive number 0 with HP-IB address 2. The full path name of the device file is Idev/D020.
To send an escape sequence to the printer, use ·····27 or CH P $ ( 27) concatenated with the escape character. For example, to send the command to skip over the perforations «( ESC )l1L), use one of the following BASIC statements: II 10 pF.:lt·n II 1I·····2711L II or 1[1 pF.:lt·n CHF.:$(27)t ll l1L II The printer control codes can be sent by using the BASIC escape sequence listed below or by using the C H P $ function.
Printer Escape Sequences Key Sequence 2-14 Integral PC Specifics BASIC Escape Sequence Function (ESC )&16D ·····27:~.: 16[1 Set line spacing to 6 lines per inch. ( ESC)&18D . ···27:~.: 1 ::::[1 Set line spacing to 8 lines per inch. (ESC )&11 L ·····27:~.: Enable skip perforation mode. 11 L (ESC )&I{n}P ···. 27t:l{n}F' Specify total length of {n} lines per page. (ESC )&I{n}F ···. 27t:l{n}F Set {n} lines of text per page. (CTRL )H ..... ::: (CTRL )J ·····1 [1 Line Feed.
Programming 1/0 Devices The Integral PC provides a built in HP-IB interface and two I/O ports. A bus expander may be connected to each I/O port to provide space for additional interface or memory modules.
Number Representation Numbers are stored internally as binary numbers in HP-UX Technical BASIC. The following illustration shows the range of numbers that may be entered or stored in the Integral PC. Figure 2-3. Range of BASIC Variables overflow underflow overflow REAL o -1 .797693134862315E + 308 - 2.225073858507202E - 308 SHORT 1.797693134862315E+308 2.225073858507202E + 308 If' .,.. V//'lj'.h'I'/h - 3.402824E38 3.402824E38 -1.175494E-38 1.
Storage Requirements The following table gives the number of bytes required to store BASIC variables in the HP-UX disc file system. Data Storage Requirements Bytes in BASIC/DATA File Variable Type REAL Autostarting the BASIC Interpreter 9 bytes. SHORT Individual variables or array elements: 9 bytes. Entire array: 5 bytes per element. STRING 3 bytes + 1 byte per character + 3 bytes each time the string crosses a logical record boundary.
The disc is now ready to use. To automatically start BASIC when the power is turned on, simply insert the disc into the internal disc drive and turn the power on. The PAM window will first echo the message "t·4 0 1.•.1 S t a t- tin':;I B A~:; I C . Please 1.·.1.01 it. " When the BASIC window appears, it is ready to use. Loading Binaries Binary files may be called from BASIC programs using the CALLE: I t·4 statement after the binaries have been loaded.
In the following example, the value of the variable passed as a parameter: 1[1 CALLE:It·~ "Entt-'::IPoint" n u rtf is «num» Both methods of passing parameters may be used in the same statement. For example: 1 ~~1 CAL L E: I t·~ "E n t r '::I Poi n t" ( .~ d dr., ( n IJ rtf)., 15 4 2 1 ) For information and examples on how to use binary programs in BASIC, refer to the HP-UX Technical BASIC Programming Guide.
3 Uploading Series 80 BASIC Files Introduction The upload utility program is provided to allow users to port Series 80 BASIC files to HP-UX Technical BASIC files on the Integral PC. This utility will accept files from the HP-85, 86 and 87 computers. The utility will transfer the following disc-based files: • Series 80 BASIC Program Files (stored as ASCII DATA Files). • Series 80 BASIC Logical Interchange Format (LIF) Files. • Series 80 BASIC DATA Files. • Series' 80 BASIC CRAF Files.
The transfer process is illustrated below. Figure 3-1. Upload Process Series 80 Series 80 HP-UX HP-UX Technical BASIC SAVE "_filename" upload r---------, PROG File LlF File GET ~---~ DATA File .----------. PROG File Text File DATA File DATA File Text File GRAF File Hardware Requirements 3-2 GRAF File No additional hardware is required to run the upload program.
Limitations Number of Files. Up to 100 file names may be transferred in one batch from a single disc. If you need to transfer more than 100 files from anyone disc, transfer the files in two or more batches. Files that have already been transferred in previous batches must be renamed on the source disc with an asterisk H*" as the first character in the file name before running subsequent batches. Graphic Files. The sizes of the graphic screen on the HP-86/87 and the Integral PC are not identical.
Data Precision and Value Range. Another limitation is due to the differences in the internal representation of numbers. Transferring data files may result in numeric overflow or underflow conditions or in changes in precision. In the overflow junderflow condition, the utility replaces all overflow or underflow values with the maximum or minimum values (I t·~ F and E P ~:;) available on the Integral PC.
File Naming Conventions It is recommended that Series 80 file names be restricted to upper and lower case alphabetic characters, numeric characters, the period, and the underscore character 1/_". Any files that you do not want to transfer can be masked with an asterisk 1/*" as the first character in the file name. Series 80 Program Files Converting Series 80 Program Files to ASCII Files. Series 80 program files can not be directly transferred using this utility.
3. Replace binary keywords with HP-UX Technical BASIC binary programs, for example, compiled C functions or subroutines. If the program requires extensive editing, it may be more convenient to edit the program using an HP-UX editor such as vi. Note however that the HP-UX editors may only be used on ASCII text files, not on BASIC files. Series 80 DATA, LIF and GRAF Files No special preparation is needed to transfer regular Series 80 LIF, DATA or GRAF files to HP-UX text, DATA or GRAF files.
Upload Program Window er prograM. (0.
5. If you want to copy the entire disc, press: (00). If only want to copy a portion of the disc, press the iJijjri1tji, (Q[) function key. Use the (@) function key to move through the directory listing and the RtflJiESi:fi (Q[) function key to mark files that are to be transferred. The program menu keys are summarized in the following table. Upload Menu Keys Menu Key Function Continue (00) Continues to next step. Disc (00) Entire Series 80 disc is uploaded. Files (Q[)) Enables user to select files.
Using Multiple Disc Drives When using multiple external micro flexible disc or SIf4-inch drives, do the following: 1. Insert the utilities disc in the internal drive. Start the mount_disc utility. 2. Insert the destination disc in an external drive. (If this is a new disc, it will need to be formatted first.) 3. Follow the instructions in the mount_disc window and mount the destination disc. 4. If you have another disc drive available, insert the Series 80 source disc in the drive. Do not mount this disc.
Options The full syntax for the upload program is: upload -options source_device-'lame destination_folder-'lame The options are summarized below. 3-10 f File by file transfer. The upload program will ask for the name of each file. Without this option, the program will copy all the files on the source disc when both the source and destination names are given in the argument string. n Suppresses expansion of the logical record in the HP-UX Technical BASIC data file.
Error Conditions Destination Directory Full. If the destination directory becomes full and there are more files to be transferred, the program will stop and ask the user to specify another target folder name. Do the following: If You Are Using Only the Internal Disc Drive: 1. Remove the Series 80 disc. 2. Insert a formatted disc. 3. Move files from the target directory to the empty disc. 4. Remove the disc and insert the Series 80 disc. 5. Specify the target folder and continue transferring files.
Error Conditions Condition Program Response Solution Corrupt Series 80 Files File will not be transferred. Program will go on to next file in the directory. Check the file or disc on your Series 80 computer. Source disc drive not found. Program terminates. Check the /dev directory for the device name of the disc drive. Refer to the Integral PC Comprehensive Guide for device naming conventions. Destination folder not found. Program terminates.