The Museum of HP Calculators

This article is Copyright © 1984 by Hewlett-Packard and is used by permission. The article was originally published in the July, 1984 issue of the Hewlett-Packard Journal. All figures and images were replaced for legibility and are copyright MoHPC. If errors crept in during the scanning process, please contact Dave Hicks.

New Handheld Computer for Technical Professionals

This small computational tool functions both as a BASIC-programmable computer and as an advanced scientific calculator. Equipped with the appropriate modules, it can control instruments, store and retrieve data and programs, perform complex number and matrix calculations, or be used for software development.

by Susan L Wechsler


SINCE 1971, WHEN HEWLETT-PACKARD introduced its first scientific electronic handheld calculator, the HP-35,1 HP handheld calculators have steadily increased in capability. The HP-652 could be programmed and had a built-in motor-driven card reader for mass storage. The HP-41C3 added system capabilities; through the addition of plug-in modules, it could control peripherals and extend its computational capabilities. HP's handheld calculators became more than mere computational tools--they became small computers designed for convenient personal use by the technical professional.

The HP-71B Computer (Fig. 1) is the latest entry in this progression of increasingly more powerful handheld prod products. In addition to retaining almost all of the capabilities of its predecessors, it also can be programmed in a high-level language, using its powerful built-in BASIC operating system with over 240 keywords. The internal math routines have 12-digit accuracy and conform to the proposed IEEE floating-point math standard.4 All of the electronics, the QWERTY-style keyboard with separate numeric keypad, 22-character liquid-crystal display, 64K-byte ROM operating system, 17.5K-byte user RAM, and battery power supply are contained in a 3 7/8 x 7 1/2 x 1-inch pocket-sized package that weighs 12 ounces. (See article for a discussion of the packaging techniques used in the HP-71B.)

The HP-71B has four ports for adding RAM or ROM to the mainframe, which has an address space of up to 512K bytes. Currently, 4K bytes of RAM or up to 64K bytes of ROM can be added to each port. The HP-71B can be further expanded by adding the optional hand-pulled 82400A Card Reader Module for mass storage and the 82401A HP-IL Interface Module for communication and control of peripherals such as display monitors, cassette drives, printers, and instruments.5

To take full advantage of the capability within its compact package, the machine has two modes. CALC mode (see box) is an algebraic calculator environment that makes intermediate calculations easy. BASIC mode is an environment in which programs can be entered, edited, and run. These two modes share the same variables and both have access to the many built-in math and statistics functions. The statistics functions can handle data for up to fifteen independent variables to calculate means, standard deviations, correlations, linear regression, and predicted values.

In all respects, the HP-71B is intended as a useful tool for the technical professional. The design philosophy was to provide the user with maximum capability wherever possible. An example of this philosophy is the implementation of variables. Variables remain intact until the user explicitly destroys them. Hence, variables set from the keyboard are available for use in programs. Also, the HP-71B implements dynamic variable allocation, meaning that users are freed from having to dimension arrays and allocate string variables at the beginning of their programs. Within a program, a variable can be dimensioned and used as an array, later destroyed (using the DESTROY statement), and then used as a scalar or redimensioned as a larger or smaller array. Dynamic variable allocation allows more efficient RAM use, since a program can prompt for input before variable allocation. In this way variables can be dimensioned based on current user input demands, eliminating wasteful RAM use based on worst-case (maximum anticipated size) variable allocation.

BASIC Language

While the HP-71B's custom four-bit parallel processor is optimized for fast, accurate BCD (binary-coded decimal) calculations, it is also well suited to minimize RAM requirements for BASIC code tokens. Each token occupies one or more nibbles (a nibble is four bits), a RAM economy more difficult to achieve with byte-oriented processors. HP-71B BASIC allows multistatement lines for further optimization of RAM use.

The BASIC operating system optimizes program branching. Labels allow branching to any statement. Aside from the added convenience and readability of labels, they are maintained as a linked list to reduce search time. When a line number reference is first encountered, the relative offset to the referenced statement is stored so that subsequent branches are faster.

HP-71B BASIC provides a real-time clock and three timers. Many of the programmable statements interact with the clock and timers so that with the addition of the optional 82401A HP-IL Interface Module, the HP-71B is an ideal choice for a low-cost, battery-powered controller.

The implementation of subprograms on the HP-71B helps make it an especially powerful handheld computer. Parameters can be passed to a subprogram by reference or by value. Subprograms can be written in BASIC or HP-71B assembly language. (Assembly language subprograms offer increased system access as well as faster execution.) Whether the called subprogram is written in assembly language or BASIC, all variables and execution stacks in the calling environment are preserved.

A useful subprogram feature in the HP-71B is recursive programming By allowing a subprogram to call itself, some advanced calculations can be done much more easily.


A one-line, liquid-crystal display (Fig. 2) provides a 22-character window into a 96-character line. The display consists of 132 columns of eight dots each, called pixels. Each character displayed uses six columns. The sixth column is blank for character spacing. The display contrast and optimum viewing angle can be adjusted to one of 16 values for user convenience by using the CONTRAST command.

The standard character set contains 128 characters and an alternate set of 128 characters can be defined by the user. This character set may reside in RAM or a plug-in ROM, giving applications added flexibility in conveying information through the display.

In addition to increasing the character set, the user can take complete control of the pixels in the display. This allows simple graphics and eye-catching patterns to be displayed. It is also possible to read the pattern of pixels from the display, modify the pattern, and then redisplay it. This allows a number of useful applications to be written in BASIC, including column scrolling and a graphics editor.

To work around the limitations of the small display, special editing keys are included on the keyboard. These keys allow character inserting, replacing, and deleting, scrolling the 96-character line to the left or right, and deleting from the cursor position through the end of the line.

A command stack contains a history of the last five lines entered, so that the display is actually a window into a 96-character-by-5-line field. It is possible, through BASIC, to extend the command stack to 16 lines. The command stack is a major factor in the user friendliness of the HP-71B operating system, in that it allows easy error recovery, reduces user keystrokes, and minimizes dependence on an external monitor for editing large programs. For example, if an operation generates an error, the user can recall several lines to the display to determine what caused the problem. Often, when the problem is recognized, only one or two keystrokes are required to modify previous input, and using the line editing keys, lines are easily edited and reentered. The convenience of this becomes apparent when input lines contain up to 80 or 90 characters.


The HP-71B has a QWERTY-style keyboard for alphanumeric entry and a numeric keypad for convenient entry of numerical data (Fig. 1). To simplify programming alla calculations, forty-two typing aids on the keyboard cover the most commonly used BASIC keywords and math and statistics functions. Accessed by using the gold f shift key, these typing aids are arranged in logical groupings of Program branching, I/O, file management, trigonometry, and statistics keywords. Coupled with the user's ability to add or substitute typing aids with redefined keys (discussed later), this holds user keystrokes to a minimum.

To further reduce user keystrokes, an implied DISPlay statement was implemented. Implied DISP almost eliminates the need to type in the keyword DISP, even in statements embedded in multistatement lines.

Customization and Expansion

A major question faced by the design team was how to build a useful handheld computer with maximum potential for expansion and customization. Part of the answer was to use LEX (language extension) files to extend and customize the operating system. LEX files do this in two ways. First, they provide a means of adding BASIC keywords to the operating system. Up to 256 keywords can be added per LEX file, in addition to the keywords already available in the base operating system and other LEX files. No capability is sacrificed when adding keywords to the machine--the operating system is just further enhanced. Second, LEX files can contain machine language routines called poll handlers that have an opportunity to respond when a particular piece of operating system code is executed. For example, poll handlers can be used to take over control of the display and keyboard, add file types to the system, and substitute local language messages for the existing English ones, making it easy to adapt software on the HP-71B to other languages. The challenge to the design team was to provide the hooks, known as polls, in all the key parts of the operating system so that the HP-71B could be customized for virtually any application.

Key Redefinition

Another design decision was to allow the keyboard to be redefined. Every key on the keyboard, along with its shifted definitions, can be redefined, except for the gold and blue g shift keys. There are three types of key redefinitions. Two are typing aids. When these redefined keys are pressed, the characters assigned to the key are added to the display contents. One of the typing aids includes an implied END LINE, so that whatever the redefined key enters in the display line is then immediately executed. The third type of key redefinition executes the operation assigned to the redefined key without altering the display first. This type of key redefinition is useful for emulating RPN (reverse Polish notation) operation, in that a key can be redefined to call a program that reads the display for input and then performs the desired calculation. Then, all the user has to do to use RPN is type the input and hit the redefined key.

A keyboard redefinition is stored in a special file, known as a KEY file. For each application, a different KEY file can be created. These files can be maintained in RAM or stored on a mass storage medium such as a card. A particular KEY file can be designated as the current keyboard configuration whenever the corresponding application is being used.

File Management System

The HP-71B has a sophisticated file management system. Its memory can contain multiple files--the number is limited only by the amount of available RAM. The operating system recognizes seven file types (BASIC, DATA, SDATA, TEXT, LEX, BIN, and KEY), and allows LEX files to support additional types as needed.

The HP-71B gives users the capability to partition the internal and plug-in RAM. Unless configured otherwise, plug-in RAM automatically extends system RAM, which contains not only files, but program control information, saved environments, and variables as well. However, RAM partitioned with the FREE PORT command is maintained as a separate, independent entity with its own set of files. RAM maintained in this way is called independent RAM. Once a RAM is freed in this manner, files can be created and edited on that RAM with the same commands that are used to edit a file in system RAM; the operation is transparent to the user. Files can be copied from an independent RAM to system RAM and vice versa. This memory partitioning can speed program execution in a number of ways. When files in memory are referenced with their optional location specifier, file search time is reduced. Having several smaller memory partitions instead of one very large one minimizes time spent moving memory when files change size or are purged. When the files on an independent RAM are no longer required and the RAM is needed to extend system RAM, the CLAIM PORT command is used to undo the FREE PORT command.

Dynamic memory movement, a complicated process to implement in any machine, was further complicated by the independent RAM capability. Every time files move (purging a file or changing the size of a file), all affected address references must be changed to reflect the new memory layout. To accomplish this, a reference adjust routine is called that adjusts all address references, including those saved on execution stacks (FOR...NEXT loops, GOSUB) and in saved environments. The algorithm for adjusting addresses had to take into account several factors:

Updating addresses was among the bigger software design challenges in making the user interface to files on independent RAMs friendly and transparent.

The added capability of independent RAMs required that some file commands previously defined for the HP-75 Computer be extended and that some new commands be added. For example, since files of the same name can exist simultaneously in system RAM and in independent RAM, the file catalog information indicates where in memory a file resides. In addition, all file commands (COPY, PURGE, EDIT, TRANSFORM, CAT, and LIST) allow an optional device specifier to indicate which memory device is being referenced. The SHOW PORT command was added to display information on all ROMs and independent RAMs configured in the system.

File Security

Included in the file management system are two levels of file security--secure and private. The SECURE statement allows users to protect their files from inadvertent modifications; it guards users against making a mistake they may regret. A secured file cannot be purged or modified, but can be unsecured with the UNSECURE statement. On the other hand, making a file private by executing the PRIVATE statement prevents people from copying software that they shouldn't have access to. A PRIVATE file can only be executed or purged; it cannot be modified or copied. Once a file is made private, it remains so--privacy cannot be undone. However, a PRIVATE file can be protected against erasure by using the SECURE statement and later unsecured by the UNSECURE statement so that it can be purged.

A global protection capability is also available by using the LOCK statement. With this statement, a user can prevent unauthorized use of an HP-71B by assigning a password. Then when the HP-71B is turned on, it requests the password, and if the entry is not correct, the HP-71B turns itself off. The password can only be bypassed by clearing all memory, in which case there is nothing left to protect.

The issue of security presented many design challenges. Since the CLAIM PORT command destroys any files in the independent RAM, special code was added so that use of the CLAIM PORT command results in an error message if any files in the RAM are secured. But the biggest challenge in maintaining file security was related to the implementation of the PEEK$ and POKE commands. Supporting file security from BASIC without PEEK$ and POKE was easy. However, once the decision was made to implement these two keywords, security became very complicated. The execution code for POKE contains many special checks to ensure that a protected file stays that way. POKE does not alter a protected file, but that alone is not sufficient. For example, the HP-71B file chain is a linked list in which each file header contains an offset to the next file in the chain. Hence, a special check was added to the POKE routine to guard against poking into the file length field. Otherwise, poking a larger offset into the length field of an unprotected file could make the following (possibly secured) file look like part of the preceding unprotected file, allowing it then to be poked at will.

Open Machine Concept and Documentation

The HP-71B is designed as an "open machine" to make it easier for others to do customization and expansion. The open machine concept is a statement of the design team's objective to maximize the scope of applications addressable by the HP-71B, acknowledging that individual users and outside vendors will help accomplish this.

To support this concept, a full detailed set of documentation was developed--a three-volume IDS (Internal Design Specification). The first volume contains information pertaining to the operating system design, such as data structures, system RAM configuration, file header layout, explanations of statement parse and decompile, how to write a LEX or BIN file, and how to write a poll handler. The second volume contains information on every supported entry point in the machine, including entry and exit conditions, subroutine level use, and register use. The third volume contains all the source code and documentation for the entire 64K-byte operating system. The first two volumes include a table of contents and an index.

As mentioned above the PEEK$ and POKE statements were implemented to allow low-level interaction with the operating system from BASIC. This is one of many areas in Which Volume I of the IDS can be a valuable resource.


The optional 82401A HP-IL Interface Module (see box) enables the HP-71B to interface with a variety of peripherals at an enhanced data transfer rate of 5000 bytes per second, which is 25 times the HP-IL data rates on the earlier HP-4 1C Computer. The function set available in the 82401A eliminates any need for a separate I/O ROM for the HP-71B.


The software pacs currently available for the HP-71B include Finance, Circuit Analysis, Surveying, Text Editor, Curve Fit, Math, and FORTH/Assembler. The Finance Pac has most of the functions of the HP-12C Calculator, with its user interface modeled after the arrangement of the HP12C's top row of keys.

The Circuit Analysis Pac runs several times faster than previous circuit analysis software written for HP's Series 40 and Series 80 Computers. In addition, it can handle much larger circuits and is designed for use in a portable environment.

The Surveying Pac has a friendly file management system and solves for angular and linear relationships between multiple coordinate points.

The Text Editor Pac allows easy editing of TEXT files and provides formatting capability for any HP-IL printer, including ThinkJet. One of the many features of the formatter is the ability to write a single letter or memo and then specify a distribution list so that each document is personalized as it is formatted.

The Curve Fit, Math, and FORTH/Assembler Pacs are discussed in detail in the articles on pages 22, 24, and 37, respectively.


Engineers who contributed significantly to the design and implementation of the operating system include Janet Placido, Bruce Stevens, Nathan Meyers, Steve Abell, Steve Chou, Mark Banwarth, and Frank Hall. Stan Blascow, Paul McClellan, and Joe Tanzini implemented the mathematics and built-in statistics. Richard Carone and Eric Evett were very influential in the operating system design through their guidance as project managers.


1. T.M. Whitney, F. Rode, and C.C. Tung, "The 'Powerful Pocketful': an Electronic Calculator Challenges the Slide Rule," Hewlett- Packard Journal, Vol. 23, no. 10, June 1972.

2. C.C. Tung, "The 'Personal Computer': A Fully Programmable Pocket Calculator," Hewlett-Packard Journal, Vol. 25, no. 9, May 1974.

3. B.E. Musch, J.J. Wong, and D.R. Conklin, "Powerful Personal Calculator System Sets New Standards," Hewlett-Packard Journal, Vol. 31, no. 3, March 1980.

4. W.J. Cody, et al, "DRAFT: A Proposed Radix- and Wordlength- Independent Standard for Floating-Point Arithmetic," IEEE Micro, (to appear August 1984).

5. R.D. Quick and S.L. Harper, "HP-IL: A Low-Cost Digital Interface for Portable Applications," Hewlett-Packard Journal, Vol. 34, no. 1, January 1983.

6. D.E. Morris, A.S. Ridolfo, and D.L. Morris, "A Portable Computer for Field, Office, or Bench Applications," Hewlett-Packard Journal, Vol. 34, no. 6, June 1983.

Calculator Mode for a Handheld Computer

As a computer, the HP-71B speaks BASIC. But how should it behave as a calculator? While BASIC allows the user to evaluate arithmetic expressions freely, experience has shown that this alone is unsatisfactory for experimental calculation--too much is hidden by the process. And RPN (reverse Polish notation), the simple but powerful language used by other HP calculators, seems inappropriate on this machine because its format differs from that used in BASIC expressions.

What's left? One possibility is the display-driven feedback loop used by some other handheld computers. This system is based on reparsing the contents of the machine's display buffer. It is easy to explain to the user and it delivers intermediate results but all of the digits in those intermediate results must be in the display if accuracy is to be maintained. This is a very annoying property in a scientific calculator.

As a better alternative, the HP-71B uses an operator-precedence parser with value substitution (OP/VS). It accepts standard arithmetic expressions, just as BASIC does, but it evaluates them as they are entered, maintaining 12-digit accuracy regardless of the display setting. Also, it detects syntax errors in a very forgiving way.

A simplified version of this algorithm is presented by the flowcharts shown in Fig. 1 and Fig. 2. The simplified parser outlined in Fig. 1 recognizes expressions composed of integers and binary operators. Functions, monadic operators, and parentheses all add modest complications to the actual algorithm.

Fig. 1
Fig. 2

The use of OP/VS on the HP-71B Computer is called CALC mode. Aside from showing intermediate results, it has several helpful features that set it apart from other calculators:


Special thanks to Eric Vogel, Bruce Stephens and Frank Hall for assistance with the development of CALC mode, and to Stan Mintz for insisting that it be done.

by Stephen Abell Software Designer
(formerly a development engineer at HP's Portable Computer Division)

HP-IL Interface Module for the HP-71B Computer

The HP 82401A HP-IL Interface Module is designed to complement and extend the HP-71B Computer's capabilities by providing a powerful, flexible I/O structure. HP-IL (Hewlett-Packard Interface Loop) is Hewlett-Packard's standard serial interface for portable, battery-powered computers.1 Major objectives for this plug-in module were I/O speed, flexibility, and easy integration with the HP-71B electronics and operating system. The module extends the print, display, and file transfer capabilities of the HP-71B, and provides a general I/O capability for use with instruments and other controllers, particularly in portable applications.

The 82401A consists of a plastic case, HP-IL input and output connectors, a custom eight-bit I/O processor, a 16K-byte ROM, and discrete components to reduce EMI (electromagnetic interference) and provide protection against damage caused by ESD (electrostatic discharge). (See Fig. 4 on page 20 for an exploded view of the HP 82401A.) This package plugs into a recess in the back of the HP-71B. A 254-page user manual explains and illustrates the use of the module and its software.

Module Architecture

A block diagram of the 82401A HP-IL Module's architecture is shown in Fig. 1. The module's 8-bit I/O processor, which draws its power from the HP-71B mainframe, handles the HP-IL protocol. This frees the HP-71B's CPU from the chores of driving the loop, thereby enhancing the overall speed of the system. The 16K-byte ROM enclosed within the module provides keyword extensions to the HP-71B BASIC operating system. These keywords allow the user to perform I/O operations such as device control, file transfer, and remote operations. The software in this ROM also provides support for up to three interface loops on the HP-71B. Secondary addressing provides I/O capability for using up to 930 devices on each loop.

Fig. 1

The dual-CPU architecture combined with hardware optimized for automatic retransmission of frames in the module's I/O processor makes the HP-71B one of the fastest HP-IL controllers to date, with data transfer rates exceeding 5000 bytes per second.

I/O Processor

The module's I/O processor is an 8-bit CMOS microprocessor with on-chip ROM, RAM, and custom I/O interfaces. A building block design approach reduced development time and the amount of external circuitry required to support the module, The major blocks in this microprocessor are the CPU, an 8-bit prescalable timer/counter, an interface to the HP-71B system bus and an interface to the HP-IL transmitters and receivers.

The I/O processor's firmware allows a higher-level interface to HP-IL than the traditional HP-IL Interface IC.2 Rather than interfacing to the loop at a frame-by-frame level, the module's I/O processor enables the HP-71B to send commands such as "Address the loop" or "Find a device of this class". Data and commands are passed between the two CPUs through an eight-byte-wide mailbox, with each CPU controlling four bytes. Hardware-aided handshaking simplifies the message sending process.

The I/O processor provides input and output data buffers, each about 65 bytes long. The I/O processor implements the loop protocol until data is received or requested or an interrupt condition is met. By requesting service on the HP-71B system bus, the I/O processor signals the HP-71B that one of these conditions has occurred. The I/O processor maintains loop integrity--powers up the loop, keeps the frame timeouts--and maintains various loop conditions such as controller, talker, listener, and serial poll responses. With this information tucked away in the I/O processor, it is a natural extension to plug in another I/O processor, enabling multiple HP-IL loops to reside on the HP-71B.


The module's 16K-byte ROM provides 50 keywords that extend the HP-71B BASIC operating system. Some are new keywords, and others are extensions to existing commands. Syntax for the keywords follows the I/O command syntax used on HP Series 80 and Series 200 Computers. File manipulation capabilities in the HP-71B are extended to work with HP-IL mass storage devices such as digital cassette and flexible disc drives. These extensions allow files to be created, purged, read, written, and protected. In addition, conversion between internal BASIC files and TEXT files is extended to HP-IL mass storage devices. Files specified in RUN and CHAIN statements are automatically copied from HP-IL as required.

The COPY keyword has been extended to allow file transfers to and from devices other than mass storage devices. This ability to copy a file to and from an interface (e.g., HP-IL to HP-IB) makes communication with other computers easy.


When the HP-71B is powered up, the 82401A scans the loop, identifying the types and locations of printer and display devices. Automatic PRINTER IS... and DISPLAY IS... assignments route printer and display output to appropriate peripherals, freeing the user from having to configure the machine manually to available peripherals. The display output is tailored to match the type of display device. For example, if a printer is assigned as the DISPLAY IS... device, the display output is sent after the user presses the END LINE key on the HP-71B. This avoids having any of the previous editing sequences appearing in the printout. If the loop is disconnected or the module is removed, output from PRINT and DISP commands reverts to the HP-71B's display.


Flexibility in creating an application is enhanced through the implementation of six device specification modes. Two of these modes indicate a specific location of a loop, three modes identify a device by its name or device class, and the last refers to the volume label of a mass storage medium. An example is the specification of a device by describing its class. For instance, the command COPY BUDGET TO :TAPE will copy a file BUDGET from the HP-71B s RAM to the first HP 82161A Digital Cassette Drive found on the loop. The command CAT .MAIL will return catalog information for the first mass storage volume found with a volume label MAIL.

Instrument Control

Multiple keywords are provided to simplify finding, polling, and setting up an instrument. All the various formatting options provided by the HP-71B mainframe are available for use with the HP-IL keywords for entering and outputting data. For special applications, the user can control devices at a frame-by-frame level.

The HP-71B can act either as system controller or as a device under the control of another computer on the loop. Keywords provided in the module's ROM allow the user to exchange control with other computers on the loop. An extension of this general capability allows another controller on the loop to give commands to the HP-71B as if they were coming from its keyboard. If the HP-71B is off at the time a command is received by the I/O processor, the HP-71B automatically turns on to process the command. In addition, the HP-71B has the capability to recognize and respond to interrupts from the HP-IL while it acts as a device. This capability allows small-scale local area networking, resource sharing, and multipoint data collection applications.


Steve Chou assisted greatly with the 16K ROM code for the 82401A Module.


1. R.D. Quick and S.L. Harper, "HP-IL: A Low-Cost Digital Interlace for Portable Applications," Hewlett-Packard Journal, Vol 34, no 1, January 19t33.

2. S L Harper, "A CMOS Integrated Circuit for the HP-IL Interface," ibid.


Nathan Zelle Development Engineer Portable Computer Division

Jackie Hunt University of Colorado at Boulder (formerly a development engineer at HP's Portable Computer Division)

Go back to the HP Journal library
Go back to the main exhibit hall