Post Reply 
Yet another HP simulator (using C + X11)
11-28-2021, 07:48 PM (This post was last modified: 01-17-2022 11:54 PM by Mike T..)
Post: #1
Yet another HP simulator (using C + X11)
Simulators for the HP 35, HP 80, HP 45, HP 70, HP 21, HP 22, HP 25C, HP 27, HP 29C, HP 31E, HP 32E, HP 33C, HP 34C, HP 37E, HP 38C and HP 67 written in C using only X11.

Use of any language extensions or non standard language features has been avoided in order to try to make the code as portable as possible, and the code should compile without modification on Linux, VAX/VMS, and Tru64 Unix.

The source code can be found on GitHub.

[Image: x11-calc-31.png] [Image: x11-calc-32.png] [Image: x11-calc-33.png] [Image: x11-calc-34.png] [Image: x11-calc-37.png] [Image: x11-calc-38.png]

[Image: x11-calc-21.png] [Image: x11-calc-22.png] [Image: x11-calc-25.png] [Image: x11-calc-27.png] [Image: x11-calc-29.png]

[Image: x11-calc-35.png] [Image: x11-calc-45.png] [Image: x11-calc-67.png]


HP 35 - Working

HP 80 - Working

HP 46 - Working

HP 70 - Working

HP 21 - Working

HP 22 - Working

HP 25C - Working

HP 27 - Completed
  • Not fully tested.
HP 29C - Working

HP 31E - Working

HP 32E - Working

HP 33C - Working

HP 34C - Working

HP 37E - Completed
  • Not fully tested.
  • Fails self test.
HP 38C - Completed
  • Not fully tested.
HP 67 - Working (apart from card reader)
  • Has continuous memory.
  • Cannot read or write to magnetic cards.


To build the simulator on Linux check that you have all the prerequisites installed then download the source code from github and unzip it (a new folder will be created to automatically). Then change directory to the new folder run 'make all' to build all the available simulators.


$ wget
$ unzip
$ cd x11-calc-master
$ make all

$ ./bin/x11-calc-29
x11-calc-29: Version 0.4 [Commit ID: 81c55be] 16 Oct 21 21:15:00 (Build: 0067)
ROM Size : 4096 words

Keyboard Shortcuts

The following keyboard shortcuts should work on Linux:

'0' - '9', '+'. '-'. '*'. '/' and 'Enter' should do what you expect them to (when using numeric key pad you need to use numlock as usual).

'f' and where applicable 'g' and 'h' correspond to the shift keys.

'Esc' or 'Backspace' corresponds to 'Clx', 'c' to CHS, 'e' to 'EEX', and on financial models 'n' and 'i' correspond to 'n' and 'i' where these functions are not shifted.

On programmable models 'A' - 'E' correspond to the function keys where they exist and 'Space' to 'SST' if not shifted

'Ctrl-Z' Quits, and 'Ctrl-C' does a reset. For models with continuous memory 'Ctrl-Z' saves the current register contents, and 'Ctrl-C' restores them to the original saved state.

Loading and saving

For models with continuous memory the contents of program memory and data registers are saved in a hidden file in the users' HOME directory (~/.x11-calc-nn.dat) when the program exits or the calculator is switched off, and restored from this hidden file when the simulator is loaded or reset using 'Ctrl‑C'

When starting the simulator the name of the data file used to restore the saved state can be specified on the command line allowing previously saved copies of programs to be loaded automatically when the simulator starts or the simulator is reset using 'Ctrl‑C'. However, any changes will be saved in the hidden data file.


Clicking on the On/Off switch will turn the simulator on and off, but if you hold down the off switch down for two seconds the program will exit.


You can start the simulation in trace mode using '‑t', or in single step mode using '‑s', and set a breakpoint using '‑b <octal address>' or an instruction trap using 'i <octal opcode>'.

'Ctrl‑T' also toggles trace mode when running, 'Ctrl‑S' executes the next instruction, 'Ctrl‑Q' resumes execution, and 'Ctrl‑R' displays the contents of the CPU registers .

Known Issues

On UNIX/Linux a 24‑bit colour display is required, while on VMS the simulator requires a black and white display.

Keyboard shortcuts only work on Linux.

On a Raspberry Pi the display is not updated properly if either FKMS or KMS graphics overlays are enabled. The following entries in '/boot/config.txt' should be commented out as shown.


HP 67 is unable to read or write to magnetic cards.

HP 37E fails self test.


Debian 10 (Buster), GCC 8.3.0, x64

Debian 10 (Buster), GCC 8.3.0, arm

Debian 9 (Stretch), GCC 6.3.0, arm

Debian 5 (Lenny), GCC 4.2.4, alpha

Fedora 34, GCC 11.2.1, x64

Ubuntu 20.04, GCC 9.3.0, x64

VAX/VMS 5.4-3, VAXC 3.2, VAX (simh)

If you get it working on your system please post the details below (OS version, gcc version and architecture).


The following packages are required to build and/or run the simulator.

Debian : gcc, make, libx11‑dev, libc6‑dev, xfonts‑base

Ubuntu : gcc, make, libx11‑dev, libc6‑dev, xfonts‑base

Fedora : gcc, make, libx11‑dev, libc6‑dev, xorg‑x11‑xfonts‑base

Gentoo : gcc, make, libx11‑dev, libc6‑dev, font‑misc‑misc


Many thanks to those whose original works and encouragement have helped me get this far including Jacques LAPORTE, David HICKS, Greg SYDNEY-SMITH, Eric SMITH, and in particular Tony NIXON and Bernhard EMESE. I can't believe quite how far I've come with their help.
Find all posts by this user
Quote this message in a reply
Post Reply 

User(s) browsing this thread: 1 Guest(s)