Java  HP16C  Emulator


Please do not re-post or re-distribute this software without permission.


This website provides a fully functional emulator of the Hewlett Packard HP16C Computer Scientist calculator.   Two  versions of the emulator have been provided, one is a web applet, and the other is a downloadable application.  Both emulator versions were written in java, and they require the java runtime environment 1.4 or higher in order to run.  While this emulator should run on any operating system with java installed, it has only been tested on Windows XP.


Please note that this emulator and website is not endorsed by nor affiliated with Hewlett Packard in any way.


Current beta versions of emulator:

Last updated:  8/15/2005

(note .h16 files created before 8/11/2005 will not work with the latest emulator version)





Save the following file to your computer and then double click the file to run.    (74 KB file)


Help with Keyboard Shortcuts:


History of the HP16C:

The Hewlett Packard hp 16c was first introduced in July of 1982.  It was the first calculator specifically designed as an aid for programmers.  Its flexibility, programmability, and functionality made it a valuable tool for many Computer Scientists. This calculator had the flexibility to operate with registers sizes between 1 and 64 bits.  Also, it could be set to function in unsigned, 1ís complement, and 2ís complement modes.  Integer results could be displayed as either hexadecimal, decimal, octal, or binary values.  The calculator also supported floating point operations.  The use of a register stack allowed for multiple calculations to be performed without the use of parentheses (Reverse Polish Notation).

Programmability was another powerful feature that the hp16c provided.  The hp16c could store up to 203 programmed instructions.  Instructions included the ability to take conditional branches, iterate through loops, and nest subroutines up to 4 levels deep.

The hp16c provided an impressive number of functions, over 100 in total.  This includes numerous logical, arithmetical, memory access, and program flow functions.

The hp16c was officially discontinued in 1989.  Original HP16Cs can be difficult to find, and calculators in mint condition sell for hundreds of dollars at auction.  If you are fortunate enough to own an original, there might not be anyone available to fix it if you ever encounter any problems.  These were the motivating factors for building this simulator.  Providing an accurate simulation of the hp16c could be a valuable tool for expert hp16c users as well as new Computer Science students.  Hopefully this emulator will help keep the hp16c from becoming nothing more than a collector's item. 


Differences between Emulator and Original:

Speed:  The emulator is much faster than the original hp16c.  This is particularly noticeable during program execution, where the emulator can be up to 1000x faster than original (when iterating through a loop of floating point operations).  Programs that used to take hours to run will now finish in just a few seconds.  During regular calculator operation, all functions should finish executing in a fraction of a second (this is only a few times faster than the original).

Display:  The original hp16c could only display up to 8 digits at a time in the display window (10 in floating point mode).  This emulator always displays the entire register X value in the display window.  As a result, window shifting functions (WINDOW, <, >) are unnecessary and have been implemented as NO-OP commands.

Register Stack Display:  This emulator allows the user to easily view the register stack of the hp16c.  This does not change the functionality of the calculator, it just makes it easier for the user to understand how a function is working by being able to see the changes to all registers at once.

Programmed Instruction Display:  This emulator will display all currently entered instructions.  The ability to view more than one instruction at a time makes it much easier to enter and edit long programs.  Displaying the current instruction and number of instructions is also helpful when stepping through a program and debugging.

(Application only):  The application also supports the ability to switch the display from the row/column format (original hp16c) to an easy-to-read function name format.

Save/Load State (Application only):  The application version of this emulator allows the user to save or load the state of the emulator.  These commands will store or replace the memory, programmed instructions, and register stack values.  The emulator also has the ability to load only part of a .h16 file (either the programmed instructions only or everything but the programmed instructions).

The application will also automatically load the previous state the calculator was in when it is opened, and save its state when it is closed.  This is done by writing a file called default.h16 to the same directory that the hp16c.jar file is stored in, so please make sure you have full read/write access to this directory (do not try to run program from a CD or other read-only device).  Unfortunately these extra features are not available in the applet due to the security limitations of unsigned java applets.

Export State as a Text File (Application only):  The application version of the emulator has the ability to export the state as a text file.  This file will show the state of the calculator in an easy to read format, including the register stack, programmed instructions (original display and function name display), and all memory contents.  Note that this file cannot be read back in by the emulator (export only, import of text files not supported).

Cancel f (orange) or g (blue):  This emulator allows you to just press the button (f or g) a second time to cancel the prefix.  Beginning users should especially find this useful, since they are much more likely to accidentally press the prefix key.  On the original hp16c, the g-prefix could not be cleared without having to set the f-prefix.  The f-prefix and all other prefixes can only be cleared by calling the clear prefix function ("f" then "BSP").  It should also be noted that this same button sequence is used to show the 10 digit mantissa in floating point mode (which will terminate digit entry).  You can still clear prefixes in the same way with the emulator, it just provides another option for clearing the prefix which users might find easier.

Revert to Factory Settings (Application only):  The application version of this emulator allows the user to revert the settings on the calculator back to the original factory settings.  The original calculator required the user to press and hold two buttons at the same time to accomplish this task.  The application version of the emulator instead has an option under the File menu.  The revert to factory settings function on the applet is not provided because the applet will always start out with the factory settings every time you visit the applet webpage.


The following are the differences which are not necessarily positive:

No Delayed Button Release:  The original hp16c had a delayed button release for functions which temporarily changed the calculator display.  Functions such as STATUS ("f"-".") would show the calculator status while the button was held down.  The original would then continue to show calculator status for approximately 2 seconds after the "." button was released.  This emulator eliminated the 2 second delay after button release.  This difference was needed in order to keep the speed advantage of the emulator as well as its thread-safe property.  The lack of a delay does cause one slight difference during program execution, if you add SHOW HEX (or other show base) instruction into a program, followed by a pause instruction, the original calculator will show the current register X value in hexadecimal mode for 2 seconds (because of the button delay).  These same two instructions in the emulator have a slightly different effect.  The emulator will only show the register X value in decimal mode (or whatever mode the calculator was in) during the pause.  To get a similar display with the emulator, the original two instructions should be replaced by these three instructions:  HEX,  PAUSE, DEC.

Period Only Supported Radix Symbol:  The original hp16c allowed the user to hold down a sequence of keys and set the calculator so that it would reverse the use of periods and commas in floating point mode.  Apparently in some regions of the world the floating point number "1,000.00" would typically be displayed as "1.000,00".  This emulator does not provide the ability to switch to the other mode.

Keyboard Shortcuts may not work for International Users:  International users with non English keyboards may not be able to use some or all of the standard keyboard mapping.  This is mainly due to accent symbols and other non-English characters.  If you encounter this problem, you might have to spend about $5.00 and buy a standard English keyboard to use Keyboard Mapping on this emulator.

Button Testing Not Implemented:  Since this project is a software emulation, the user does not have to worry about buttons breaking in the same way as they might on an actual calculator.  Therefore there was no need to implement these button testing features on either the applet or application version of the emulator.



Please send any questions, comments, requests or defects to: