The Museum of HP Calculators
By Richard M. Spangler
MODEL 9830A IS THE LATEST AND MOST POWERFUL CALCULATOR IN THE 9800 SERIES. Its keyboard design, programming language, memory size, I/O capability, and flexibility make the 9830A more like a desktop computer than a calculator. Yet it maintains the convenience and user interaction that makes a programmable calculator so easy to use. The user can still set the machine on his desk, turn the power on, type in 2+2, and see 4 on the display.
Like the 9810A and 9820A, the 9830A (Fig. 1) is a ROM-driven general-purpose minicomputer with specialized peripherals built in. In its minimum configuration, the 9830A contains 7.5K words of read-only memory (ROM) and 2K words of read/write memory (RWM). The memory is expandable to 16K words of ROM and, initially, to 4K words of RWM. The display register contains 32 alphanumeric characters, and uses the same 5 x 7 LED dot matrix as the 9820A.
A built-in tape cassette unit is included in the mainframe in place of the magnetic card reader used in previous HP calculators. The I/O structure of the 9830A is identical to that of the 9810A and 9820A, so all the 9800-Series peripherals operate with the 9830A. The new 9866A page-width thermal line printer (see Fig. 2) is designed to be the primary output peripheral for the 9830A. It fits directly on top of the calculator. It can print 80-column lines at a rate of 250 lines per minute.
The keyboard of the 9830A represents its most significant departure from the traditional concept of a programmable calculator. It is not a key-per-function keyboard, but rather an alphanumeric keyboard like that of a typewriter or teleprinter terminal.
Besides the alpha section of the keyboard, there are three groups of special keys that facilitate use of the 9830A. The first group is a calculator section, which contains the digits and the most commonly used arithmetic operators. The second group contains special control keys used in operating, editing, and debugging programs. The keys in the third group are definable by the user.
The use of an alphanumeric keyboard rather than a key-per-function keyboard removes the major restriction to programming language definition and language expandability. It is not necessary to add a new key to the keyboard whenever a new function is added to the language. Rather, a new function is assigned a mnemonic which can be entered as a sequence of alpha characters.
In the development of the 9830A, it was decided not to define another new and unique programming language The language of the 9830A is BASIC, which is well known among users of small computer and time-shared systems. All of the changes that have been made in BASIC in the 9830A are additions to standard BASIC, so programs written in versions of BASIC that are close to the standard version will run on the 9830A with little or no modification. This means that a tremendous program library is already available.
Besides being well known and used extensively, BASIC has several other characteristics which make it well suited for a programmable calculator. Since the language was originally designed for use in time-sharing environments, it is interactive and conversational. The 9830A fully exploits these characteristics by communicating through the 32-character alphanumeric display and the thermal line printer.
BASIC is easy to learn because the commands closely resemble English and there are very few tricky syntax rules to memorize. Each statement in a program is given a line number by the programmer, and the BASIC operating system automatically places the statements in order.
Program editing is easily accomplished simply by retyping any incorrect statement or assigning a line number between two existing lines to a statement to be inserted in a program. The 9830A has expanded on this editing capability by providing complete character-by-character editing. The user may recall a line of program to the display, edit the characters within that line, and store the corrected line without retyping the whole line. If an error is made while typing a statement, the incorrect line can be recalled and edited.
BASIC is also well suited for implementation by an interpreter rather than a compiler. With a compiler, the user's program is transformed before execution time into machine-language instructions, which are executed directly by the machine processor. With an interpreter, the user's program remains in memory in source form and an interpreting program examines the source program and calls on the appropriate execution routines. The main advantage of an interpreter in an interactive system like the 9830A is that only one copy of the user's program is needed for program editing and execution. With an interpreter, only minor additions are required to implement calculator functions such as TRACE or single STEP, or execution of statements directly from the keyboard.
The BASIC language has several important features which are new to programmable calculators. The most important is the type of variables that are allowed. Simple numeric variables, single- and double-subscripted array variables, and string variables may all be used. Array variables permit the analysis of large numbers of data items. String variables, which are strings of alphanumeric characters, permit such things as names and addresses to be analyzed and stored. Each variable is named by any letter of the alphabet, so the user can use R for resistance, Q for quota and N for the number of elements in an array. The calculator interpreter reserves only enough memory space for the variables currently in use.
Another feature of the BASIC language is user-definable functions. Standard BASIC restricts these functions to single arithmetic expressions, and allows only one parameter.
Like standard BASIC, 9830A BASIC allows only one parameter. However, the definition of the function can consist of more than one statement. For example, a function to evaluate N factorial may be defined as follows.
100 DEF FNF(N) 110 N1 =1 120 FOR N2 = 1 TO N 130 N1 = N1 * N2 140 NEXT N2 150 RETURN N1
To assign a function to a user-definable key, the user presses the key labeled FETCH and then presses any of the ten definable keys. This puts the calculator into the key-definition mode. The user then enters his function and presses the END key. Now whenever he presses that particular key, the calculator responds with the name of the function--for example FNF for the factorial function. The user can then enter the argument, 5 for example, followed by the EXECUTE key. The calculator responds with the answer 120. Functions assigned to keys can be called either from the keyboard or from a program.
Single- or multiple-line functions are one of three categories of operations that can be assigned to the user-definable keys. These keys can also be used to store entire programs.
The user may also assign typing aids to his user-definable keys. A typing aid is simply a string of alphanumeric characters. Whenever a typing aid key is pressed, the characters that are assigned to that key are entered into the display just as if those characters had been entered individually from the keyboard. For instance, each of the keys could be assigned a mnemonic such as PRINT, INPUT, READ, and so on. These keys could then be used in typing BASIC programs. These functions of the user-definable keys make the 9830A act more like a calculator.
A severe limitation of BASIC is its restricted formatting capability. In the 9830A, four new statements have been added to make output formatting more flexible. Two statements, FIXED and FLOAT, allow the user to specify the format for the numeric output in his PRINT or MAT PRINT statements. Two other statements called WRITE and FORMAT give the user formatting capability similar to FORTRAN.
A series of tape operating commands has also been added to 9830A BASIC to control the built-in tape cassette. A command called MARK is used to initialize a cassette and set up a structure of fixed length files. These files can then be accessed randomly by file number. Three types of information can be stored and recalled from the cassette: user programs, numeric and string data, and sets of user definable keys. The command structure is simple yet flexible.
The most unique feature in the 9830A BASIC interpreter is its modularity. Each statement or function is accessed through a series of tables in ROM. Tables can be accessed on as many as eight optional add-on ROM modules, or even in the read-write memory. These add-on ROM modules, each containing 1024 words, are available both in small plastic cases and as printed-circuit modules that can be plugged into the 9830A. After a ROM is in place, the calculator can understand the commands implemented by that ROM and the interpreter can jump to the execution routines stored in it.
Five add-on ROMs are now available. The Matrix and String Variable ROMs include commands that are part of many BASIC systems, but are not needed by all BASIC users. The MAT commands on the Matrix ROM allow initialization of an array to all ones, all zeroes, or the identity matrix, or reading of the values for an array from DATA statements. Matrix arithmetic functions--addition, subtraction, multiplication, and multiplication by a scalar--are easily called for, and functions to take the inverse and transpose are also included. This ROM also includes two commands that are not common in BASIC. They are a REDIM statement to redimension an array without changing the values of any elements, and a DET function for taking the determinant of a matrix.
The String Variable ROM allows the BASIC program to handle strings of alphanumeric characters. The program can initialize, change, examine, and test these strings, and it can ask the operator to input character strings through the keyboard. The simplest example of the value of string variables is an operator typing "YES" or "NO" in response to a question posed by the program. This add-on ROM makes the 9830A truly conversational.
The Plotter ROM adds several new statements to the 9830A language and provides the drivers needed to control the 9862A X-Y Plotter. Some of the most significant capabilities added are automatic scaling, convenient axis drawing, absolute and incremental plotting, and plotting relative to any origin. Labeling plots and axes has been made simple by a LABEL statement. This statement allows the user to draw alphanumeric characters of any height and width, at any angle of rotation.
The Extended I/O ROM adds statements and functions which provide convenience and flexibility in controlling input and output peripherals. The two most important features in this block are an ENTER statement that is used to input data from a peripheral in either free field or formatted form, and an automatic code conversion capability which allows the 9830A to communicate wit) peripherals using character codes other than ASCII. The Extended I/O ROM communicates through the standard interface scheme of the 9800 Series, and uses the standard interface cards.
The fifth ROM that is presently available with the 9830A is a Terminal ROM. This ROM gives the 9830A the unusual capability to act as a computer terminal. It can communicate with a time-sharing service through a modem at any speed from 3 to 300 baud. This optional ROM overrides the standard keyboard input routine and bypasses the syntax routines so that lines of free text can be stored in memory. For example, a FORTRAN program may be entered into the 9830A, edited, and saved on cassette. After a program has been entered and edited, the user can call up his time-sharing service and have the 9830A transmit the program automatically. The user may also have his time-sharing service transmit a program to be saved in the memory of the 9830A. The editing, execution and storage capabilities of the 9830A make it a very powerful computer terminal.
Underlying the modularity and expandability of 9830A BASIC is the modular structure of the firmware (machine-language programs) stored in ROM in the 9830A. Each shaded block can accept optional ROMs to expand its capabilities.
The keyboard input routine and keyboard monitor perform the user interaction and editing functions. The syntax routines, the pre-execution processing routines and the statement execution routines are the essential elements of the BASIC interpreter. There is a separate syntax routine and execution routine for each different statement type.
The syntax routines accept an input record from the keyboard routines. This record is a string of the characters that were entered at the keyboard. The syntax routines examine the input record, character by character, checking for proper statement syntax, and transform the string of characters into a series of operation and operand codes that can be more easily used by the execution routines.
The key to the modularity of the syntax firmware is a table search routine which scans a series of name tables on each of the option-block ROMs and the main system ROM. The table search routine searches for a match between the characters in the input record and the characters in the tables in ROM. If a match is found, two codes are stored in the translated format of the input record, a code for the command, and a code for the ROM block where the command is located.
Two codes of information are also stored for each operand, a five-bit code for the letter naming the operand, and a five-bit code for the variable type. The type code is used to distinguish, for example, A, A(1), A1, and A$, which all have the same variable name. During syntax analysis, numeric constants are converted to a floating point format, and line numbers are converted to 16-bit integers. After syntax analysis, control is passed to the memory management routines to store the statement in program memory, or to the initialization routine, which prepares the calculator to execute the statement directly.
The interpreter uses a symbol table to keep track of the variables that are currently in use. It is the job of the pre-execution processing routines to set up this symbol table at the start of program execution. When the RUN command is given, old symbols are deleted, and then the current program is scanned. Any array variable names and their dimensions are saved in the new symbol table.
After the program scan, storage is reserved for each array and a pointer giving the starting memory address for each array is saved in the symbol table. A special key causes the pre-execution processing phase to be performed without the execution phase. This allows the user to set up his symbol table for array variables so they can be used from the keyboard.
Symbol table entries for simple variables and user-defined functions are made during the execution phase. This allows simple variables to be defined by a statement executed directly from the keyboard. The calculator user needn't be aware that a symbol table is being used. Any variable he wants to use is available immediately.
The execution monitor uses the code stored with each statement to locate the proper block of memory and branches to the execution routine for that statement. The execution routines examine the operation and operand codes and call upon subroutines to perform the arithmetic execution. The statement execution routines also call upon driver routines for control of the cassette, printer, display and any external input or output devices.'
Go back to the HP Journal library
Go back to the main exhibit hall