HP-16C
Hewlett-Packard's 1982 "Computer Scientist" pocket calculator, a keystroke-programmable RPN machine whose integer mode could imitate any word size from 1 to 64 bits in unsigned, one's or two's complement arithmetic.
Created by Hewlett-Packard, Corvallis, Oregon (software: Eric Evett, John VanBoxtel, Rich Carone)
The HP-16C Computer Scientist is a programmable pocket calculator that Hewlett-Packard sold from 1982 to 1989. It was built for people who work with bits. Switched into integer mode, it shows numbers in hexadecimal, decimal, octal or binary, and it can be set to match the arithmetic of a particular computer: any word size from 1 to 64 bits, treated as unsigned, one’s complement or two’s complement. It then sets carry and overflow flags the way that computer would. Its programming language is HP’s keystroke programming: a program is a recorded sequence of key presses operating on a four-level RPN stack, with labels, subroutines, flags and conditional tests. The Museum of HP Calculators calls it HP’s “first (and so far only)” programmer’s calculator.
History and Origins
By the early 1980s HP’s Corvallis, Oregon division was building the Voyager series, a family of landscape-format pocket calculators with low-power LCDs and continuous memory, which keeps programs and data while the calculator is off. The HP-16C was the Voyager for programmers and logic designers. HP’s May 1983 Journal described the problem it was meant to solve:
“A large amount of tedious paper work is often required to convert among number bases, perform logic operations, shift and rotate bits in a word, or check processor instruction flow.”
The same article credits the software team. Eric Evett, who also wrote parts of the HP-11C and HP-15C microcode, wrote the article; John VanBoxtel “developed many of the fundamental design concepts”; Rich Carone worked on the software design and wrote the display formatting routines; Stan Blascow did much of the testing; and Diana Roy wrote the owner’s handbook.
The 16C was introduced in 1982 at $150 and discontinued in 1989, according to the Museum of HP Calculators. Wikipedia’s infobox gives a price of $120 by 1989. The 16C shares the keystroke-programming system of its Voyager siblings, the HP-11C and HP-15C. Like them, it runs on HP’s “Nut” processor architecture; the modern SwissMicros replica describes its own firmware as an ARM microcontroller “emulating the NUT processor”.
Design Philosophy
The museum sums up HP’s approach: rather than doing generic binary arithmetic, the 16C was designed to be “configurable to match the computer the user was currently working with”. Three settings define that machine:
- Number base:
HEX,DEC,OCTorBIN, for display and entry. Hex digits appear asA b C d E F, with lower-case b and d so they cannot be confused with 8 and 0 on a seven-segment display. - Word size:
WSIZEtakes any value from 1 to 64 bits. In unsigned mode with 64-bit words, the largest number is 2^64 − 1 (18,446,744,073,709,551,615). - Complement mode:
1'S,2'SorUNSGN.
Once set, ordinary keys behave like that machine’s ALU. Addition sets the carry flag on a carry out of the most significant bit, a left shift sets it when a 1 falls off the left end, and the overflow flag is set whenever the true result cannot be represented in the chosen word size and complement mode. The display normally shows the eight least significant digits, and it can be scrolled a digit or a window at a time to see the rest of a long binary number.
The calculator also has a decimal floating-point mode, entered with FLOAT, but outside the programmer functions its mathematics is deliberately thin: the four arithmetic operations, square root and reciprocal.
Key Features
Bit manipulation
| Group | Operations |
|---|---|
| Logic | AND, OR, XOR, NOT |
| Shifts | logical left/right (SL, SR) and arithmetic right (ASR) |
| Rotates | one position or n positions, left or right, with or without the carry (RL, RR, RLC, RRC, RLn, RRn, RLCn, RRCn) |
| Masks and bits | MASKL, MASKR (masks of n bits), SB/CB/B? (set, clear and test a bit), #B (count set bits), LJ (left-justify) |
| Double-word arithmetic | DBLx (single × single → double result), DBL÷ and DBLR (double-length dividend) |
Integer and floating point together
Switching modes is itself a conversion tool. When you press FLOAT, the integers y and x in the Y and X registers are combined into the floating-point value y × 2^x. Pressing a base key turns the X value back into a pair of integers: y is a 32-bit mantissa and x an exponent. HP used this to write routines that pack and unpack other machines’ binary floating-point formats.
The programming model
The 16C uses keystroke programming in its “fully merged” form, where a shifted key and its argument take a single step. Programs work on the RPN stack (X, Y, Z, T, plus LSTx). According to the 1983 Journal, the language provides:
- 16 labels:
0–9andA–F, called withGSBand jumped to withGTO. - Subroutines nested up to four levels deep.
- Conditional tests that skip the next step when false, such as
x≠0andF?(flag test). - Six flags. Flags 0–2 are general-purpose. Flag 3 shows leading zeros, flag 4 is the carry (the C annunciator), and flag 5 is overflow (the G annunciator).
- Editing and debugging: insert, delete, back-step, single-step and go-to-line.
- An index register, I, used for loop counters (
DSZ,ISZ) and indirect addressing.
Memory: 203 bytes, shared
There are 203 bytes of user memory, and each program step takes one byte. Storage registers are carved from the same space and their size follows the word size, so with 8-bit words and no program there are 203 registers, while 16-bit words leave 101. The museum notes that register size is rounded up to the nibble, so a 15-bit word size also yields 101 registers. Each program step added takes away from the register pool.
An example from HP
This routine is reproduced from Evett’s 1983 article. It simulates a CPU add-with-carry instruction (Y + X + carry → X), using flag 4 as the carry flag and flag 0 as scratch:
| |
With 2'S, HEX, an 8-bit word size and the carry cleared (CF 4), keying FE ENTER 72 GSB A displays 70 with the C annunciator lit, because FE + 72 = 170 hex overflows 8 bits.
The binary-to-Gray-code conversion from the same article shows how compact the bit operations make such work:
| |
Evolution
The HP-16C itself never changed in production; it was a single model from 1982 to 1989. Its ideas moved on in three ways:
- Into later HP calculators. According to Wikipedia, HP incorporated many of the 16C’s functions into later scientific and graphing models; the HP-42S (1988), for example, has number-base conversion and bitwise logic in its BASE menu. HP never built another dedicated programmer’s calculator.
- Into re-creations. SwissMicros sells the DM16L, a titanium-cased replica in the original’s size and layout, which runs the original code on an emulated Nut processor using a 32-bit ARM Cortex-M0 microcontroller. In 2023, HP’s licensee shipped the HP-15C Collector’s Edition with an undocumented 16C emulation mode reached through the test menu. In 2026, Moravia released an official HP-16C Collector’s Edition, reportedly limited to 10,000 units. Retailers describe it as adding program save and restore and as faster than the original; some coverage repeats an “up to 100× faster” figure, but no benchmark or test program has been published, so treat that number as marketing. It is reportedly built on the same kind of ARM-based platform as the 15C Collector’s Edition.
- Into software. Many simulators exist. Bill Foote’s JRPN, started in 2021, is a clean-room 16C (and 15C) simulator still releasing in 2026, and Wikipedia describes the public-domain, open-source WRPN as one of the oldest HP-16C simulators still in development.
Current Relevance
The 16C is a collector’s item. The Museum of HP Calculators notes how much mail it receives praising the model, even though HP never followed it up, which the museum takes to mean sales were poor. For anyone who wants to use the language today, there are three options: an original calculator, which keeps its program in continuous memory on three button cells; the 2026 Collector’s Edition; or a simulator such as JRPN. No Docker image exists, and none would make sense, because the “runtime” is a calculator.
The problem the 16C solved has not gone away. Embedded programmers, reverse engineers and people who write device drivers still check two’s-complement overflow, build masks and convert between hex and binary. The programmer modes of many modern software calculators cover much of the same ground.
Why It Matters
The HP-16C was an early, and unusually thorough, attempt to put a configurable model of a computer’s arithmetic in a shirt pocket. Many programmer’s calculators could convert between bases; the 16C let you declare that your machine had 12-bit one’s-complement words and then calculate exactly as that machine would, flags included. Its keystroke language was small: 203 bytes, 16 labels and four subroutine levels. Combined with that instruction set, though, it was enough to simulate missing CPU instructions or unpack a minicomputer’s floating-point format, as HP’s own engineers showed in 1983. More than forty years later, it was still in enough demand for HP’s licensee to put it back into production.
Timeline
Notable Uses & Legacy
Simulating processor instructions
HP's own 1983 article shows the 16C programmed to behave like a CPU instruction it lacks: an 11-step add-with-carry routine that adds X, Y and the carry flag and sets the carry on overflow out of the top bit, run in 8-bit two's complement hexadecimal.
HP 3000 floating-point conversion
The same article lists a pair of subroutines that convert between the HP 3000 minicomputer's 32-bit FORTRAN real format and decimal, using the 16C's FLOAT mode change and 16-to-32-bit word-size switching. The routines also have to reverse bit numbering, because the HP 3000 calls its most significant bit bit 0.
IEEE floating-point format work
According to the Museum of HP Calculators, HP supplied two programs to convert between the 16C's floating-point format and the IEEE binary format, which was still only a proposed standard when the calculator shipped.
Logic design and code conversion
Evett's article presents the 16C as a tool for digital electronics as well as programming, with five- and ten-step routines for converting between binary and Gray code and a routine for extracting an arbitrary bit field from a word.