Icon    HP-67 emulator by Christopher Neufeld    Icon



First, a picture of a real HP-67 from David Hick's Museum of HP CalculatorsPhotograph of an HP-67 calculator

Here you will find the two versions of the HP-67 emulator which I've written, one in the form of a CDA for the Apple ][GS, the other as an ncurses-based program running under UNIX, designed and tested on Linux.

 I found it can be very annoying to be sitting in front of a fairly sophisticated piece of computing hardware, but then when you find you want to take the cosine of an angle, have to go scrambling off in search of a calculator built ten years earlier. So, my first HP-67 emulator, written in C on the Byte Works ORCA/C compiler, was a Classic Desk Accessory for the Apple ][GS. For people raised on MS-DOS machines, this is somewhat like a terminate and stay resident program which can be brought to the foreground by a certain sequence of keypresses, no matter what other things the computer may be doing at the time.

 The original CDA package, as it was released, is available here. One interesting challenge to writing this was that a CDA has only two hundred and fifty six bytes of stack space available to it. That's a quarter kilobyte, and library and toolset calls use some of that. This severely limits the number of auto variables you can put into a C program!

 Then, I decided to learn C++, and needed a project to work on. Rewriting the calculator from scratch for UNIX seemed like a reasonable project. I've tried to keep the user interfaces fairly consistent, though there are some changes which I consider improvements in the new version. The package, including a statically linked Linux binary for people without C++ dynamic libraries installed on their systems, is available here. The manual page, roughly converted to HTML, is also available.

A sample program included with the package performs Simpson's rule integration. Most of the features of the programming language are used.

Here are a few of screenshots of the emulator running in an 80x24 xterm window.

Usermode screen shotThe user-mode screen. Valid commands are listed in the table along the top of the page. A numeric keypad is available on the right edge. The display is set for scientific mode display, but also allows fixed mode, engineering, and hexadecimal. Named memory is in a column in the middle of the screen, and the stack and input line at the left side. The labels with the valid commands and the characters on the numeric keypad are sensitive to ncurses mouse events. If the execution environment has mouse event support under ncurses, the functions can be invoked by clicking on the appropriate part of the window.



Programming mode screen shotThe programming screen. Stack and memory space are not visible, but the numbered program steps are. The list of valid commands is different from that of the user mode. In program mode there are some conditional flow-control statements which cause the calculator to skip the next program step unless a test succeeds. The arrow marks the insertion point, new steps are inserted after the line pointed to, and the delete key deletes the line pointed to.



Stepping through a programIn order to facilitate debugging of programs, there is a stepping mode. The display space available to stack and memory reduces in order to show the next line to be executed, and its context. Each time the "step" command is issued (or its shortcut key, ALT-SPACE), the calculator executes another step in the program, changing the memory or stack accordingly.



There's much more detailed information about the abilities of the HP-67 emulator in the manual page.

 


Back to Christopher Neufeld's home page.
Christopher Neufeld / neufeld@caliban.physics.utoronto.ca