HP Classic Calculator Emulator +
This project gives you
the opportunity to experience 27 different HP calculator models from the late 60's and 70's era.
- Emulates HP01, HP19C, HP21, HP22, HP25, HP27, HP29C, HP31E,
HP32E, HP33E, HP34C, HP37E, HP38E, HP35, HP45, HP46, HP55, HP65, HP67, HP70,
HP80, HP91, HP92, HP95C, HP97, HP9100B
- PC emulator
- Build a real working calculator that emulates 21 models running origial microcode
- Working program cards for HP65, HP67, HP97 and HP9100B
- Emulates the HP19C, HP29C and HP34C continuous memory
- Functional printer for HP19C, HP46, HP91, HP95C, HP97 and HP9100B with save option
- HP9100B also comes with working Marked Card Reader, Plotter and Extended Memory Unit
- Where available, uses original microcode
- Simulator, Assembler, Code Trace and Capture, Single Step
- Text file based program card editor
- Preassembled HP65 DemoPac1, MathPac1, EEPac1,
- Preassembled HP67 DemoPac1 - Works with HP97
- USB interface
- In circuit PIC programming
- PDF schematic and circuit boards layout
- Circuit board design supplied in zipped Gerber format
- Printable keyboard overlays for most calculator models
pottering around the web some time ago I came across the HP-45
scientific calculator which was made by Hewlett Packard back in the
1970’s. Seeing it again fired up feelings of nostalgia and took me on a
journey back to my school days when I used to own one of these so many
years ago. Back in the day the HP-45 was one of the first in a new
breed of pocket calculators which are referred to as the
Calculators are pretty much taken for granted
these days, cheap and plentiful, tossed back into the drawer after use
and even for the technically inquisitive, hardly worth the look inside
when all you see is a small black blob on a circuit board. There was a
time when the calculator was a prized item and although not as fast as
today’s variants, were much faster and more accurate than the well used
slide rule and amazingly some mainframe computers as well. For the
curious, even to this day, there are still interesting goodies inside
to fire up a technical imagination. A few of the carry cases were
nicely crafted items too. Some were made from real leather and others
made from metal with a luxurious leatherette cover with a soft lining
inside. There were also lockable accessory items to chain those
expensive items to the desktop.
Back in those school days we had
to use paper, pencils, grey sandy erasers that loved to munch holes
through your work notes, and awful logarithm books to help solve
multiply and divide problems. Modern technology came to our maths class
one day when we were presented with a pile of odd looking cardboard
computer cards and given a simple problem to try and solve. Armed with
a high tech paper-clip we poked through the pre-punched numbers
imprinted on these cards causing a small snow storm of paper dots that
scattered around the classroom. Well, not that bad, but the cards were
soon gathered up by the teacher and mysteriously sent off to a
university mainframe computer and I’m guessing now that its error
routines went into overdrive as it tried to digest them. A few weeks
passed and the results came back printed on a pile of folded perforated
paper sheets, but sadly our paper clips were probably bent in the wrong
shape and none of us were ready to join the computer age just yet.
was about that time when calculators began to creep into the classroom
and like most I decided that I would like to own one too. Some I had
seen at the time were big with a tiny eight digit display, had the
basic four functions and maybe a square root key. I decided the one I
wanted was the new HP-45 scientific calculator but it had a reduced price tag of
around $240.00 and as my family was one of the usual battlers, the
challenge was up to me to figure out how to get one. No small feat for a wee school lad in those days.
Working before and after school and
on weekends eventually paid off and I found myself in the store
excitedly handing over my hard earned savings to a salesman who
presented me with a large box in return. Bouncing around in an old “Red
Rattler” train during the trip home, I couldn’t wait any longer and I
still remember the strangely sweet but strong plastic odour that rose
up as I opened the box. At the flick of a switch my brand new
calculator came to life with the now familiar [0.00]
displayed in bright red LEDs. Sifting through the box, I found a spiral
bound owner manual, in colour, plus a smaller quick reference guide
which in itself would rival some of today’s manuals, (if any are
supplied), a battery charger and a soft real leather carry case. I
couldn’t wait to try it out at school. Geeks in the 70's, who would have thought....
An example of the HP-65 delivery package compared to todays models.
series of calculators have held their value over the years with many
still working today or have been restored back to working condition and
kept as collector’s items.
an early interest in electronics, after awhile I couldn’t resist and
had to open up the calculator and see what was hiding inside. I didn’t
understand much about the internals then but hopefully here is a better albeit brief
architecture of the Classic Series was similar although the HP-65 had
the unique magnetic card reader. The circuitry was optimized for
floating point operations and because silicon real estate was expensive
back then, the data bus paths were serial not parallel as you might
expect. This meant the circuitry and PCB design could be much simpler
and therefore cheaper. Sections of data such as the exponent of a
number could be intercepted in the serial bit stream and used
individually for the computations. The 3 busses were the SYNC line, the
Is line used for instructions, and the WS line used for gating the
The chips used were MOS/LSI types and included
multiple ROMs, an Arithmetic and Register Circuit (ARC), a Control and
Timing Circuit (CTC), a two phase clock generator, LED anode cathode
drivers and some models had a RAM storage chip having 56 bits per
register. Low power consumption requirements soon meant that CMOS chips
would be used, however at the time the extra gate required more silicon
and the additional manufacturing processes added up to a higher cost.
Negative Logic was used where 0V represented Logic 1 and 6V represented
Logic 0. The Classic Series consumed about 500mW and the switching
power supply transformed the 3.75V NiCad battery output to +6V, +7.5V
and -12V. The batteries would generally last a day, unless left on all
the time and once flat, they would require an overnight recharge.
Internally, numerical data is
made up of 14 digits in binary coded decimal (BCD) format giving a word
size of 56 bits. Ten of the digits were allocated for the mantissa, one
for the mantissa sign, two for the exponent and one for the exponent
ARC executes instructions from the Is line and sends out display data
to the LED anode driver and carry bit information to the CTC chip. It
also incorporates the seven 56 bit working registers A to M which
include the operational stack registers X, Y, Z and T. Not all of these
registers could communicate with each other. For example the M register
could only be accessed through the C register. The CTC controls the
house keeping functions of the calculator including interrogating the
keyboard, checking system status, synchronization and modifying
instruction addresses. The anode driver was responsible for final
decoding of the display data, driving the LED anodes, sending clock
signals to the cathode driver and low power indication which lit all
decimal points. The cathode driver is a 15 bit shift register for
sequentially controlling each display digit.
ROM chips could hold 256 ten bit words using serial address in and
serial data out. Three of these chips were used in the HP-35, shown
below as round cans. More program memory was required in the other
models so DIL packages were produced with four times the memory and
were referred to as Quad ROMs. To save space in models
like the HP-65 and HP-80, all the logic chips, with the exception of
the ROMs were placed on a hybrid chip carrier inside a rectangular
run the internals, a series LC oscillator is used to generate a
frequency of about 800KHz.
This signal was divided down to a 2 phase 200KHz system clock which was
maximum allowed for the chips and gave a CPU word cycle time of 280uS.
LC oscillators are not that accurate, so a more stable crystal
oscillator circuit was used in the HP55 because it had a usable
timer function. The HP-45 had a non
documented timer but could be accessed by pressing RCL and then the
CHS, 7 and 8 keys simultaneously. Word got around that you could modify
the underside of the HP-45 ENTER key and then the timer could be
activated more easily by pressing
RCL then ENTER. It was also possible to install a 784KHz crystal to
make the timer more accurate. The timers were
implemented by a fixed 35 instruction code loop which set the time
delay for a 100th second counter and because there were no software
interrupts, you either had a calculator or a timer.
Some average calculation speeds are as follows:
Add, Subtract 60mS
Multiply Divide 100mS
delays will compound themselves when executing complex algorithms, and
occasionally the calculators would appear to ‘hang’ for brief periods.
Registers A and B are used both for holding display data and for
general software tasks, so while running programs and with some
calculations, the display shows the jumble of data going through these
registers to give some user feedback while the calculator is at work. The following original
demonstration shows the length of time it took for a slide rule and the
new HP-35 calculator to solve the great circle distance between San
Francisco and Miami.
HP-35 2254.093016 65 seconds
fast back in the day no doubt, and many of the engineers quickly
replaced the slide rules in their top pockets with these new
calculators. In fact the HP-35 quickly became a sought after item far
exceeding initial market expectations with over 300,000 units being
delivered in the 3 years following introduction. However, going
unnoticed until after production began, a problem occurred when
calculating the natural log of 2.02 using the ln key. Reversing the
process with the eX key gave an answer of 2 rather than the correct
2.02. This bug was discovered after many units were sold and
while it could have been ignored, all affected owners were notified and
offered replacements. Interestingly some owners decided not to take up
the offer and some of those buggy calculators are still floating
around today as collector’s items.
the Classic calculators had a 15 digit display. The decimal point
position was not part of the 14 digit numerical data. Instead, its
position was decoded by the anode driver and occupied one whole digit
on the display. Its true position could still be seen even if all
decimal points were lit during a low power condition. Register A held
the BCD digits for the display while register B was used as a mask
register. Nibbles in register B were decoded by the anode driver such
that 9 = Digit Off, 0 = Digit On, and 2 = Decimal Point On. On
detecting the decimal point, the anode driver would display it in the
next digit and then add an extra clock cycle to display the following
were formatted in 10’s complement notation with 9’s in the sign digits
numbers and were decoded by the anode driver to
display the negative sign. An interesting feature of the multiplexed
LED display was its brightness and was achieved by using small
inductors to dump their stored charge into each LED segment. Timing was
critical so that the charge would not bleed into adjacent displays
causing them to be partially lit. The inductors had a charge time of
2.5uS and the discharge time through the LED segment was about 5uS and
gave an average single LED current of about 0.73mA.
register is made up of 12 bits and can be used as software flags but
some bits are connected directly to hardware logic. An example is
Status bit  which is set to 1 when a key is pressed and back to 0
when it is released. Register C nibbles 12 and 11 were used to load the
Data register with a RAM address from the instruction [c -> data
address]. The C register could then be loaded with a number and stored
in RAM with the instruction [c -> data], or RAM was transferred into
the C register with the instruction [data -> c].
press values are generated from the CTC scanning process. For example
the ENTER key when pressed returns a value of 62. (60 if modified as
mentioned above.) The key values are transferred to the program counter
by using the instruction [keys -> rom address],
therefore each key
press provides an index to a simple but efficient jump table. In this
part of the
HP-45 code listing from ROM 4 you can see that the two entry points for
the ENTER key do essentially the same thing, which in this case was
after the Shift key was pressed and sets the [Deg] mode of operation.
60 clok: no operation
61 no operation
62 degr: a - 1 -> a[w]
was a lot of effort put into the keyboard operation to make it user
friendly even down to the key spacing and colouring. Each key had an
“oil canning” roll forward operation which gave them a high quality
positive feel and were double injection moulded for longevity and even
after 40 years they still work.
purchasing the calculator I soon realised that the keyboard was missing
the [=] key and confused me for a while. I had never heard of RPN
previously, but it was well demonstrated in the manual and the concept
was easy to learn. I have to say even to this day, I still prefer it
over conventional calculator operation.
A book by Jan
Lukasiewicz in 1951 first demonstrated that arbitrary expressions could
be specified unambiguously without parentheses. In other words, (a + b)
x (c – d) could be specified as:
a (enter) b (enter) [add] c (enter) d (enter) [subtract] [multiply]
This method is referred to postfix notation and became known as Reverse Polish Notation or RPN in honour of Lukasiewicz.
this concept in a computer environment requires an arrangement in
memory called a stack. The Classic Series have 4 levels of stack named
X, Y, Z and T and these appear in registers C, D, E and F. Keying in
number (a) initially goes into the X register and pushes the other
values in the stack up by one level with the value in T being lost.
Number (b) is then entered followed by the operator [add]. This causes
the values in X and Y to be added with the result being placed back
into X. The upper stack levels all drop down by one with the T value
being duplicated into Z.
Stack manipulation in the calculators
is software driven and uses instructions like [c -> stack] which
pushes the stack up 1 level and copies the X register into Y. As an
example, it is used in code when the ENTER key is pressed. The user can
also manipulate the stack by rolling it up or down and swapping the X
and Y registers from the keyboard.
During the design phase,
building the circuits discretely for testing was considered but would
not be practical. Fortunately there was some computing power available
which could simulate designs down to gate level, although the data
input was on punched cards, (presumably better paper clips than mine)
and the output was printed on paper and had to be evaluated.
HP-35 actually had numerical algorithms that exceeded the precision of
some mainframe computers at the time and writing those calculator
algorithms offered some interesting challenges for the engineers.
Maintaining the accuracy of the various calculator functions was
difficult to achieve especially when rounding errors compound
themselves. Calculating SIN(x) for example required a divide, multiply,
subtract, two more divides another multiply, an addition and a square
root, with each process adding to rounding errors creating an
undesirable outcome. The code therefore had to be written using various
mathematical techniques and the engineers did a remarkable job getting
around these problems given the limited hardware available.
code for these calculators was listed in OCTAL format as shown in the
following instruction listing example at address @54 (44dec). The CPU
code is binary with dots representing 0’s.
Address 10 bit CPU
select rom 1
Here’s a small taste of one of the many problems the engineers would have been faced with.
ROM address space is limited to 256 word boundaries even in the Quad
ROMs. After an instruction executes at decimal address 255 the program
counter will wrap around and the next instruction will be fetched from
address 0. This actually happens purposely in some code segments. The
instruction that gives access to the other ROMs is called [select rom
n], where n can be 0 – 7. For the HP-35, n can be either 0, 1 or 2, for
the three available ROMs. However, a limitation is that you cannot jump
to a random address in another ROM, it is always the current program
counter + 1. Imagine the program counter is at address 44 in ROM 0 and
the instruction [select rom 1] executes. The program counter will
increase by one to address 45 as normal, but access is now from ROM
chip 1. That doesn’t sound like a big deal but it can be. For example,
as a talented engineer you try to fix the bug in the HP-35 code by
inserting a “clear register b” instruction into ROM 0 at address @20.
: 0 -> B[W]
No problem, there is ROM space
available and you just insert the instruction and recompile. This would
seem a trivial thing to do, but alas this is not so. Imagine there is a
[select rom 0] instruction in ROM 2 at address @33. After this
instruction executes, the program counter will increment to @34 and the
program continues from ROM 0. Unfortunately the instruction that was
supposed to be there in ROM 0 is now one address higher because of the code
change and the program will now fail. To fix this new problem you will
have to go through the entire code listing and locate every [select rom
0] instruction that is positioned at or above address @20 and move them
up by one address or move the instructions at the other end down by one
address. As you might imagine, this could potentially disturb even more
instructions causing a coding nightmare.
Some calculator models
required more than 8 ROMs so an extra bit was added to enable
addressing for 2 groups of 8 ROMs. New instructions were introduced and
were called [delayed select group] and [delayed select rom]. They were
“delayed” because they only preset the ROM or group addressing bits and
had no effect until a jump or subroutine instruction was executed. That
way you could select a group and a ROM prior to the address change. As
a bonus they also allowed jumps to random addresses which simplified
the programmer’s job quite a bit.
HP-65 and HP-67 were unique in that they incorporated a miniature magnetic card read/write
mechanism and with 100 words of usable program memory (224 for the HP-67) they were
formidable devices. The program elements were just copies of the key
codes and each occupied 6 bits in memory, (8 bits for the HP-67). In some cases two or three keys could
be saved as one code and therefore conserve expensive memory space. Merging key
codes like this was a new concept back then and in the HP-65, they were allocated to
25 commonly used key combinations such as STO 1, which stores the
displayed number into memory 1. The HP-67 had many more merged codes available.
HP-65 program memory was essentially a 600 bit serial buffer. It had
provision for a
fixed top of memory marker, plus a program pointer and a subroutine
pointer which were both free to circulate inside the buffer. The single
subroutine pointer allowed for one level of subroutine only.
The magnetic card read/write mechanism posed many
mechanical and electrical design difficulties such as card alignment,
low battery, temperature problems and greasy cards to name but a few.
They were eventually overcome and the result was a calculator that was
only slightly deeper in size than the others in the Classic Series. It
was impressive engineering for the day and without modern CAD systems
some cases were moulded in clear plastic to see how things would fit
inside. The HP-67 used 32 x 56 bit RAM registers to store the program
data. The memory cards for this calculator could also store data memory
and if required the programs and data could be stored on 2 cards.
memory cards stored the program data, a header and checksum
and were written onto the magnetic media at 300 bits per inch. It took
about 2 1/2 seconds for the card to move over the head for the
read/write process. Once stored in the calculator memory, individual
program functions were generally activated from the A to E or R/S keys. If
desired, you could use a marker pen to write program details onto the
face of the card which you could slide into a slot above the keyboard
for reference. Many programs were available for purchase and you could
write and share your own which was quite popular.
Try Out Your Own
The PC emulator
program allows you to use these calculators by themselves on screen and
open them up to simulate, set break points, modify, compile and experiment with all
operating code and registers.
Build A Real Working Calculator
design files are provided to create a real calculator that can
be built from cheap and easy to get components and is
based on the PIC18F47K40. The one circuit emulates the original
code and functionallity for 21 calculator models and
includes slide switches for
functions like the Run-PGM-Timer function used on the HP-55 and
the Run-W/PGM functions
for the HP-65 and HP-67. Keyboard overlays for each calculator
available. If you
choose to build the
real calculator then the PC program also communicates with it via the
USB port and
lets you upgrade the driver software,
change calculator models and transfer a large range of
programs for the HP-65 and HP-67 memory cards and programs
for other programmable models like the HP-25. Any of the 21
calculator models can be set by the PC or by using an inbuilt menu
directly from the PIC.
project was put together using freely available documentation from the
web, however some coding information proved to be unreliable and some was
unavailable so in these cases a "best guess" approach was used to fill
in the blanks and do the repairs, however all calculators operate as
presented in thier respective owner handbooks and documentation.
The micro code for the HP-10 will probably never become availabe as it
is embedded inside a single chip so it was written completely from
scratch using HP microcode and the PC emulator described here.
Downloads - Windows only
The software was developed in a 32
bit Win 7 environment,
but seems to work ok on XP, Win 8 and Win 10. The cce33 download
includes the PC emulator, Help file, PIC HEX file, schematics, PCB
design files, and key
After installation, see the help file (PDF) for setup information.
This file also includes construction details to build the real working calculator.
The other downloads
are modules that implement the respective calculator.
files are in zipped format. Download cce33.zip and unzip into a
directory of your choice. All calculator modules (except stand alone applications) must be unzipped into
this directory or they won't work.
over 150 program cards, each with memory card graphics
HP-67 includes 24 program cards for all the demo programs from the owners handbook
HP-91 now has original microcode thanks to Bernhard at Panamatik
HP-9100B includes: Marked Card Reader, Plotter, Printer and Extended Memory.
on board calculator memory can store up to 306 programs total for the
HP65 or HP67 plus a total of 320 programs for the other programmable
The HP-10 and HP19c
both have a printer, so the PIC calculator will transfer all the
printer instructions to the PC (if it connected to the USB port) and
ther PC will display the printer output from these models.
The owner handbooks for some calculators and
some of the quick reference guides and patent documents are also
* Models not supported with current PIC code
alone application. Does not need cce33. Unzip into any
NOTE: The HP35 bug download requires the HP35 download to be installed before use.
is a totally new version based on a PIC 18F47K40 chip, and
unfortunately due to the complex code changes, it was not possible to
make it compatable with the earlier hardware calculator based on the
PIC16F1519. If you want to keep using the original version and also
want this one, download to a new directory.
The seperate calculator modules remain unchanged..
documents in the download are a bit grainy. If you would like to get some better ones
and also see a lot of interesting HP calculator information, take
a leisurley visit to the HP Museum.
Purchase Calculator Project
emulator project is a nostalgic trip for the author and as such the calculator project is offered at a not for profit cost
price of $Aus52.00 plus postage. The postage will usually be in the
vicinity of $Aus10.00 but will depend on the final location.
The PCB design is based on surface mount parts, so they can be preassembled before shipping if desired.
Payment can be made through Paypal.Me, however you must hava a Paypal account to use the link.