The Museum of HP Calculators

This article is Copyright © 1975 by Hewlett-Packard and is used by permission. The article was originally published in the November 1975 issue of the Hewlett-Packard Journal. The photos linked in this article are Copyright © David G. Hicks, 1995, 1996, and 1997. The diagrams were redrawn for better legibility. If errors crept in during the scanning process, please contact Dave Hicks

Three New Pocket Calculators: Smaller, less Costly, More Powerful

HP's second-generation pocket calculator family now includes a basic scientific model, a programmable scientific model, and a business model.

by Randall B. Neff and Lynn Tillman

IN 1972, HEWLETT-PACKARD INTRODUCED the HP-35 pocket scientific calculator1, the first in a family of calculators that eventually grew to include six members, from the original HP-35 to the sophisticated fully programmable HP-65.2

Now there is a second generation of HP pocket calculators. Currently this new calculator family has three members, designated HP-21, HP-22, and HP25. The HP-21 is a basic scientific calculator that replaces the HP-35, the HP-22 is a business calculator, and the HP-25 is a programmable scientific calculator. State-of-the-art technology has been applied in the new family to achieve the major design goal of low cost with no sacrifice in reliability or quality.

Most parts are common to all three calculators, the fundamental differences occurring in the read-only memory (ROM) that contains the preprogrammed functions. In each calculator is an integrated circuit that is a small, slow, but powerful microcomputer. It executes microprograms that are stored in the ROM. When the user presses a key, a microprogram is activated to perform the function corresponding to that key.

The ROM comes in blocks of 1024 ten-bit words. Each block adds factory cost. But until all of the ROM has been allocated, features can be added, omitted, or modified and functions can be made more or less accurate without increasing factory cost at all. The firmware designer's challenge is to make these no-cost choices in some optimal way for each calculator.

HP-21 Scientific

The HP-21, the first calculator in the new family, was designed as a direct replacement for the HP-35. Because the HP-21 was to have 33% more microprogram ROM than the HP-35, everyone involved in the project wanted additional features and functions.

New features were packed in until all the ROM was used. The HP-21 has all the functions of the HP-35 plus controlled display formatting, polar to rectangular conversions, radian mode in trigonometric calculations, and storage arithmetic.

One major change in these HP-21 family calculators from the HP-35 family is a shorter twelve-digit display. The HP-35 display had fifteen digits: two signs, ten mantissa digits, two exponent digits, and a decimal point. The new twelve-digit display was required because of the narrower plastic case of the new family.

In spite of the shorter display, there was still a requirement that the calculator have ten-digit precision. To meet this requirement, the decimal point was moved so that it appears next to a digit. Also, a decision was made to show a maximum of eight mantissa digits when an exponent is displayed, so two of the display digits do double duty, sometimes as mantissa digits, and other times as exponent sign and digit.

The HP-21 never gives a misleading zero answer. When the user has specified fixed notation and the non-zero answer of a function would be formatted as a zero, the HP-21 changes to scientific notation for that answer. When the HP-21 shows zero, it means the answer is zero to ten digits.

HP-22 Business

The HP-22, the business member of the new calculator family, was intended to be an "HP-70-Plus". Again, experience from programming the HP-70 and many new microinstructions allowed the product to grow functionally until it provided an array of mathematical, statistical, and storage capabilities in addition to the financial functions we had originally hoped to add.

The HP-22 is the first of our financial calculators to include ex and ln functions on the keyboard. It is also the first of our financial calculators to provide linear regression and linear estimate. These functions, as well as arithmetic mean and standard deviation, are executed using data automatically accumulated with the sum+ key. In combination, the arithmetic and statistical functions allow calculation of such things as exponential and logarithmic regression, power curve fit, and trend lines with uneven periods, a powerful set of computational tools for the financial analyst and forecaster.

Greatly expanded storage is available to the user. There are ten user-addressable registers with storage arithmetic similar to that of the HP-25. There are also five financial storage registers--one associated with each of the basic financial parameters (n, i, PMT, PV and FV). The basic functions defined by these five top row financial keys are the same as those in the HP-70 and HP-80.4

These registers combined with internal status indicators (one for each parameter) and an internal data-input counter form a flexible system for solving financial calculations. When the calculator is turned on, the system might be thought of as looking like this:

The financial functions require that the contents of exactly three of the financial parameter registers be specified as input data, that is, three status indicators must be set and the data input count must equal three.

When data is entered the associated status indicators are set and the data input counter is incremented. For example, if two items of data have been entered (say n = 360 and PMT = 341.68) the system might look like this:

If a status indicator is already set, entering data for that parameter will simply overwrite the previous register contents. For example, pressing n in the above situation would cause the 360.00 to be overwritten with whatever was in the display. The status indicator would remain set and the counter would remain at 2. Once three status indicators are set, pressing a financial key for which the status indicator is not set will trigger an attempt to execute that function.

Say the system looks like this:

Pressing PV will cause calculation of PV in terms of n, i and PMT while pressing FV will cause calculation of FV in terms of n, i and PMT.

When a function is executed and an answer is calculated, the answer is stored in its associated register for possible later calculations. The status indicators and counter remain unchanged because the input parameters have not changed.

There is a reset function, which resets all five status indicators add resets the counter to zero, allowing a different combination of input parameters to be specified. However, the data remains in the registers and can be recalled using the RCL prefix key.

Besides the new flexibility in the basic financial functions some new functions have been added: %sum (percent of sum), ACC(accumulated interest), BAL (remaining balance), and the annuity switch (BEGIN/END).

A running total can be kept using the sum+ key. The %sum function can then be used to find what percent of that total any given number is.

Accumulated interest and remaining balance are also new. Just enter the loan amount PV, the periodic interest rate i, and the payment amount PMT. To find the accumulated interest between two periods. say from payment 13 through payment 24 enter the payment period numbers in storage registers 8 and 9 and press shift ACC. If you then press shift BAL the HP-22 will calculate the remaining balance on the loan after the payment indicated in register 9 is made (in this case after payment 24).

Annuities are often referred to as being "ordinary, annuities" or "annuities due". These terms distinguish situations where periodic payments are made at the beginning of the period (for example, rents or leases are annuities due) from payments made at the end of the month (a mortgage, for example, is an ordinary annuity). The HP-22 features the annuity switch to make this distinction Place the switch in the BEGIN position and any annuity calculations will be made assuming that payments occur at the beginning of the payment period Place the switch in the END position and annuity calculations will be made assuming that payments occur at the end of the payment periods.

The HP-22 uses the same general solution techniques for the financial functions as the HP-80. Execution of the equations involves numerous internal subroutine calls to +, -, x, , y^x and In (this is particularly true for the iterative solutions for i). This means that the standard round-off errors. in these routines are compounded by the time the final solution is reached. To improve the final results given by the HP-22, improvements were made to the standard HP-21- family arithmetic subroutines. The y^x algorithm was extended to handle negative numbers to integer powers--for example (-2)^2 or (-2)^-2--and a subroutine was developed to calculate the expression (1 +y)^x, which occurs frequently in financial equations.

HP-25 Programmable Scientific

The HP-25 was originally conceived as an advanced scientific calculator. It was specified as having 2048 microinstructions, twice as many as the HP-21. Also, it was to contain a new integrated circuit, a sixteen-register data storage chip. Because of improved microinstructions and experience gained by microprogramming the HP-21, the HP-25 finally appeared not only as a scientific calculator with many more functions than the HP-21, but more importantly, with 49 steps of user programming.

The real power of the HP-25 is its easy programming. The programming is based on key phrases rather than keystrokes. A key phrase is simply a sequence of keystrokes that together perform one function or operation. For example. both f SIN and STO + 5 are key phrases, but they contain two and three keystrokes, respectively. The program memory contains numbered locations for 49 key phrases When the user writes a program, the calculator merges keystrokes into key phrases and stores the instructions in program memory.

Editing a program is particularly easy. In program mode, the display shows the step number and the key phrase stored there (see Fig.). The key phrase is displayed as the row-column coordinates of the key- strokes that make it up. The digit keys are represented by a zero followed by the digit, and the other keys are described by a row digit followed by a column digit. For example, the f key is in the first row of keys and the fourth column, so its coordinate is 14. The key phrase f SIN appears as 14 04, and STO + 5 appears as 23 51 05.

One innovative feature of the HP-25 is the behavior of the SST (Single Step) key in run mode. This key was designed to help the user debug programs. It allows the user to execute his program one key phrase at a time. When the SST key is held down, the display shows the line number and the key phrase that is to be executed next. Releasing the SST key executes just that key phrase, and the numerical results appear in the display. This new feature makes debugging programs quite easy because the user can tiptoe through his programs, seeing both the key phrases and their results, one phrase at a time. The display when the SST key is held down includes the step number, so checking program flow and branching is easy.

The HP-25 contains a number of functions that make programming simpler. In program mode, the SST key and the BST (Back Step) key allow the user to step forward and backward through the program memory. Eight comparisons allow the program to react depending on the data in the calculation stack. Together with the GTO (Go To step number) operation, programs can branch and loop based on numeric results. A function that is new to pocket calculators is PAUSE. When encountered in a program, the calculator stops for a second, displays the most recent result, and then continues the program. This is useful when programming iterative functions because one can watch the function converge or diverge.

The HP-25 has line-number-based static programming. Key phrases go into numbered locations in memory, overwriting the previous contents. Branching in the program is to the step number of a phrase. This is in contrast to the HP-65 type of programming.3  In the HP-65, keycodes shift around in the unnumbered memory as steps are inserted and deleted, and branching goes to label keycodes contained in the memory.

The HP-25 merges keystrokes into key phrases using a microcoded finite state machine. The machine carefully checks for undefined key sequences. When a valid key phrase is completed, an eight-bit code is fabricated. If the calculator is in run mode, the code is immediately decoded and executed. In program mode, the code is copied into the program memory and then decoded to generate the row-column display. The data registers used for program storage are 56 bits long. Each register can contain seven key phrase codes. Seven such registers comprise the program memory, so all together there are 49 key phrase locations.

The HP-25 contains a data storage integrated circuit with sixteen registers of 56 bits each (14 BCD digits). Seven registers are for user programming, eight are for user data, and one is used for the LAST x function.

Another innovative feature of the HP-25 is a new mode of formatting the displayed result, called engineering notation. This is a selectable format that makes calculated answers easier to understand. Imagine a problem that deals in physical units of measure, such as seconds. Say the answer to the problem in scientific notation is 5.00  -05. Now this is a valid answer, but not as clear as it could be. Setting the HP-25 into engineering notation gives the answer as 50.0  -06 which is easy to read instantly as 50 microseconds. Engineering notation forces the power-of-ten exponent to be a multiple of three and adjusts the decimal point to give the correct answer. If the above answer is multiplied by 10, it gives 500.  -06 or 500 microseconds. Multiplying again by ten gives 5.00  -03 or five milliseconds.

Design Details

Several improvements in the instruction set of the HP-21-family microprocessor made life much easier for the microprogrammer. Three of the most useful improvements were 12-bit subroutine addresses, the digits-to-ROM-address instruction, and the data register instructions.

In the HP-35 microprocessor, the microinstruction address was only eight bits long. Each 256-word ROM would turn itself on or off as ROM-select instructions dictated. There was only one level of subroutine and the return address had only eight bits. The HP-21 microprocessor uses a twelve-bit address. A given ROM responds only when it sees an address it contains. Subroutines can be located on different ROMs and easily return to the correct next instruction. The new processor can save two twelve-bit subroutine return addresses. Two levels make it possible for one subroutine to call another.

A new processor instruction takes two calculated digits as the next microprogram address. This instruction is exactly like a computed GO TO instruction in some programming languages. This instruction made the HP-25 possible. It is used for both key phrase execution and key phrase display. The eight-bit key phrase code is broken down into groups of phrases such as GTO codes, STO codes, f, and g codes. Then the code is either used to generate a display (for the SST key) or is executed (run mode).

The data storage chip used in the HP-35 family required that a calculated address be sent from the processor to activate one register. Then the register could be written into or read from. When the HP-25 data storage chip was designed, this mode of operation was retained, because a calculated address is needed for STO, RCL, and programming. However, enough microinstructions were available to define separate instructions to read or write in each register. This simplified the HP-22 microprogramming by allowing any financial register to be accessed internally with a single microinstruction.

One change in the system design of the HP-21 family was putting the display segment drive in the ROM integrated circuit. Which segment to power is determined by an accessory ROM composed of sixteen words of seven bits each. The words 0 to 9 are used to generate the digits. One word, 15, is a blank. Three of the remaining words generate the letters E, r, and o, which the HP-21 family uses to spell "Error," telling the user that an operation is illegal. One remaining word generates the letter F. This is used by the HP-25 to spell "OF" when a storage register overflows. Since the display generator is a tiny ROM on the microcode ROM, it can be changed to create new characters for new calculators.


We would like to express our appreciation to: Chung Tung as section manager for the products; Don Mackenroth for the HP-21 and HP-25 owner's handbook; Jan Weldon and Kent Henscheid for the HP-22 owner's handbook; Guy Armstrong for the HP-25 Application Book; Maureen Paris, Ellen Mayhew, and Lyman Alexander for evaluation of proposed financial functions; and Dennis Harms for development of the improved arithmetic functions and subroutines used in the HP-22.2


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

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

3. R.K. Stockwell, "Programming the Personal Computer," Hewlett-Packard Journal, May 1974.

4. W.L. Crowley and F. Rode, "A Pocket-Sized Answer Machine for Business and Finance," Hewlett-Packard Journal, May 1973.

Randall B. Neff

Randy Neff did the microprogramming for the HP-21 and HP-25. Born in Houston, Texas, Randy attended Rice university in Houston, receiving his BS and MS in electrical engineering in 1972 and 1973. He joined HP's Advanced Products Division in 1973. A member of ACM, he s now a programmer in the integrated circuit laboratory of Hewlett-Packard Laboratories Randy enjoys reading science fiction and working with wood He s married and lives in Palo Alto, California.

Lynn Tillman

Lynn Tillman did the microprogramming for the HP-22 and its predecessor, the HP-70 With HP since 1973, she's now production engineer for the HP-22 Lynn received a BS degree in secondary education from the University of Texas at Austin in 1969 After teaching ninth-grade science for a year, she returned to the campus, this time at the University of California at Berkeley, and received an AB degree in computer science in 1972. Born in Mattoon, Illinois. Lynn grew up in Gallup. Illinois, Lynn grew up In Gallup, New Mexico, working weekends and summers in an Indian trading post She's married, lives in Los Altos, California, and relaxes by producing handmade rugs and collecting glassware from the 1930's.

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