The Series 80 HP BASIC Programming Language

functions, statements, and commands common to all models
-- HP83 -- HP85A -- HP85B -- HP86A -- HP86B -- HP87A -- HP87XM --


BASIC FUNCTIONS AND STATEMENTS
System Functions
1 ABS absolute value of the numberic expression
2 ACS principal value (1st or 2nd quadrant) of the arc cosine of the numeric expression in the current angular units
3 ASN principal value (1st or 4th quadrant) of the arc sine of the numeric expression in the current angular units
4 ATN principal value (1st or 4th quadrant) of the arc tangent of the numeric expression in the current angular units
5 ATN2 arc tangent of Y/X in proper quadrant
6 CEIL smallest integer greater than or equal to the numeric expression
7 COS cosine
8 COT cotangent
9 CSC cosecant
10 DATE Julian date in the format YYDDD, assuming system timer was set
11 DTR converts the value of the numeric expression from degrees to radians
12 EPS a constant equal to the smallest possible real precision number, 1E-499
13 ERRL line number of latest error
14 ERRN error number of latest error
15 FLOOR largest integer less than or equal to the evaluated expression
16 FP fractional part of the evaluated expression
17 INF a constant equal to the largest real number possible, 9.99999999999E499
18 INT largest integer less than or equal to the expression (equivalent to FLOOR)
19 IP integer part of the numeric expression
20 LGT common logarithm (base 10) of a positive numeric expression
21 LOG natural logarithm (base e) of a positive numeric expression
22 MAX larger of two values
23 MIN smaller of two values
24 PI numerical value of pi
25 RMD remainder resulting from a division operating according to X-(Y*IP(X/Y))
26 RND generates a number that is greater than or equal to zero and less than one, using a predetermined, pseudo-random sequence
27 RTD converts the value of the numeric expression from radians to degrees
28 SEC secant
29 SGN returns a 1 if the expression is positive, -1 if negative, and 0 if exactly 0
30 SIN sine
31 SQR square root of a positive numeric expression
32 TAN tangent
33 TIME returns the time in seconds since midnight if the timer is set, or since machine turn-on otherwise, resetting automatically after 24 hours
String Functions
34 CHR$ converts a numeric value between 0 and 255 into a character corresponding to that value
35 LEN returns number of characters in a string
36 NUM returns decimal value corresponding to first character of string expression
37 POS returns the position of the first character of a substring within another string or 0 if the substring is not found
38 UPC$ converts all lowercase letters in a string to uppercase letters
39 VAL returns as a numeric value, including exponent, a string of digits so that the value may be used in calculations
40 VAL$ returns the value of a numeric expression as a string of digits
General Statements and Programmable Commands
41 BEEP outputs a tone of specified frequency for a specified duration
42 CLEAR clears the CRT
43 COM dimensions and reserves memory so chained programs can access the same data
44 CRT IS allows the definition of either a printer or the actual CRT as the current CRT
45 DATA provides constants and text characters for use with read statements
46 DEFAULT ON makes numeric overflows, underflows, and the use of uninitialized variables non-fatal by substituting an appropriate approximate value
47 DEFAULT OFF makes numeric overflows, underflows, and the use of uninitialized variables fatal
48 DEF FN defines a single - or multiple line function
49 DEG sets degree mode for evaluation and output of the arguments and results of trigonometric functions
50 DIM declares the size and dimensions of array and string variables
51 DISP outputs values or text on current CRT
52 DISP USING displays values and text according to format specified by IMAGE statement or literal IMAGE
53 END terminates program execution (same as STOP)
54 FLIP changes the keyboard from BASIC mode to typewriter mode or vice versa
55 FN END terminates a multiple line function
56 FOR / NEXT defines a program loop and the number of iterations
57 GOSUB transfers program control to a subroutine and allows subsequent return of control
58 GOTO transfers program execution to the specified line
59 GRAD sets grad mode for evaluation and output of the arguments and results of trigonometric functions
60 IF…THEN…ELSE allows statements to be either executed or bypassed depending on the outcome of a logical expression
61 IMAGE specifies the format used with PRINT USING or DISP USING statements
62 INPUT allows entry of values or text from the keyboard during program execution
63 INTEGER declares variables as integer; gives size and dimensions of integer arrays
64 KEY LABEL displays in the lower portion of the CRT, an eight-character prompt for each Special Function Key (softkey) defined by an ON KEY sttatement; also returns cursur to upper left corner of the CRT
65 LET assigns a value to a variable or array element
66 LIST lists the program on the CRT IS device; also outputs bytes remaining at the end of a program
67 NORMAL cancels the effect of PRINT ALL, AUTO, or TRACE statements
68 ON ERROR sets up a branch to the specified line or subroutine anytime an error occurs
69 OFF ERROR cancels any ON ERROR statement previously executed
70 ON KEY# sets up a branch to the specified line or subroutine each time the Special Function Key (softkey) is pressed
71 OFF KEY# cancels the branch set up by an ON KEY# statement
72 ON TIMER# sets up a branch to the specified line or subroutine on a time-dependent interrupt basis
73 OFF TIMER# cancels any interrupts from a timer set up by an ON TIMER# statement
74 OPTION BASE allows specifying lower bound of an array as 1 rather than the default of 0
75 PAUSE suspends program execution
76 PLIST lists the program on the PRINTER IS device
77 PRINT prints values or text on the current PRINTER IS device
78 PRINT ALL sets a mode such that all inputs, messages, and results are printed on the PRINTER IS device
79 PRINT USING prints values and text according to format specified by an IMAGE statement or literal IMAGE
80 PRINTER IS defines device for printer output
81 RAD sets radian mode for evaluation and output of the arguments and results of trigonometric functions
82 RANDOMIZE re-evaluates random number seed
83 READ assigns values from a DATA statement to the variables specified
84 REAL declares full-precision variables as well as the size and dimensions of full-precision arrays
85 REM declares the subsequent characters as remarks for documentation only
86 RESTORE resets data pointer to the start of the specified DATA statement, or the first DATA statement if none is psecified
87 RETURN transfers program control back to the statement following a GOSUB
88 SETTIME sets the system clock with the parameters of seconds since midnight and Julian day in form YYDDD
89 SHORT declares variables as being short-precision as well as the size and dimensions of short-precision arrays
90 STOP suspends program execution (same as END)
91 TAB used in a PRINT or DISP statement to allow information to be placed at a specified character position
92 TRACE traces program logic flow in all or part of a program as specified and prints this information
93 TRACE ALL traces all program logic flow and variable assignments in all or part of a program and prints this information
94 TRACE VAR traces all value changes of specified variables and prints information
95 WAIT holds program execution for the specified number of milliseconds
Mass Stroage Statements
96 ASSIGN# opens a data file by assigning a buffer number to it
97 CAT displays file directory on CRT screen
98 CHAIN loads a new program from the mass storage device and continues executing while retaining any data in common
99 CHECK READ * performs record-by-record data verification during file read / write operations *
100 COPY * copies files or entire storage media
101 CREATE establishes a data file of specified length and record length on mass storage devices
102 ERROM * returns the number of the ROM that issued an error message
103 ERRSC * returns select code of interface module that received an illegal operation
104 GLOAD * loads the contents of a special extended-type file into the graphics display
105 GSTORE * stores the contents of the graphics display onto the mass storage system
106 INITIALIZE * clears, tests, and prepares a flexible disc medium for use in the mass storage system
107 LOAD brings into memory a program previously stored on a mass storage device (not programmable)
108 LOADBIN brings binary program into memory
109 MASS STORAGE IS * defines the default mass storage device; allows use of mass storage ROM commands without specification of a device
110 PACK * removes null files from the disc system
111 PRINT# retrives data from a specified file
112 PURGE erases the specified file from the file directory, rendering it inaccessible
113 READ# retrieves data from a specified file
114 RENAME changes name of an existing file
115 SECURE disallows unauthorized listing, editing, duplicating, or cataloguing of a program
116 STORE records a program onto the mass storage device (not programmable)
117 STORE BIN records a binary program onto the mass storage device
118 TRANSLATE * translates tape-based programs to disc-based programs to allow them to automatically take advantage of the mass storage system
119 TYP * returns the type of the next datum of a data file
120 UNSECURE allows files previously secured to be listed, edited, duplicated, and catalogued (not programmable)
121 VOLUME * establishes a volume label for a disc medium; volume labels let you refer to a disc medium by a name that you specify
* these statements are built into the HP-85B, and, with the exception of the TRANSLATE statement, are also built into the HP-86A, HP-86B, HP-87A and HP-87XM; these statements can be added to the HP-85A via the mass storage ROM;
Graphics Statements
122 ALPHA puts the CRT into alphanumeric mode
123 BPLOT allows plotting any series of dots on the CRT by conversion to an alphanumeric string
124 DRAW lowers the pen and draws a line from current pen position to a specified destination position
125 GCLEAR clears all or a specified lower section of the graphics display
126 GRAPH sets display to graphic mode
127 IDRAW lowers the pen and draws a line of specified incremental length from the present position
128 IMOVE lifts the pen and moves it an incremental distance from the present position
129 LABEL allows printing of text in graphics mode
130 LDIR specifies horizontal or vertical direction of a label
131 MOVE lifts the pen and moves the cursor to a specified absolute location
132 PEN sets pen color
133 PEN UP raises the pen so that plotting is possible without drawing lines between points
134 PLOT moves to a specific point if pen is up; draws a line to the point of pen is down
135 SCALE defines the incremental units and range of x and y on the CRT
136 XAXIS draws a horizontal line of specified length, with or without tic marks, at a specified y-intercept
137 YAXIS draws a vertical line of specified length, with or without tic marks, at a specified x-intercept
Non-Programmable Commands
138 AUTO allows automatic generation of line numbers during program entry
139 CONT allows continuation of a program which has been paused
140 DELETE deletes program lines specified
141 INIT initializes a program by allocating memory for the variables required, and performs a check for certain errors
142 REN renumbers program lines with bspecified increments
143 RUN initializes a program and begins its execution
145 SCRATCH clears memory of all programs and data

Last Updated on 7/20/97
By Eric Bal
--back--