The architectural decision everything else follows from: a decimal calculator should store numbers as BCD — one decimal digit per 4-bit nibble. A standard byte-oriented CPU (Z80, 6502) fights that layout constantly. So I designed a small custom CPU in Verilog where 4 bits is the natural data width and memory is nibble addressable.
What the project covers:
- Custom CPU: Harvard architecture, 12-bit ISA, 8-state execution FSM, hardware stack guard with a FAULT state for microcode debugging
- CORDIC for trig functions, verified to 14 significant digits
- Two-pass assembler in Python (~700 lines)
- Verilator + Qt framework: same Verilog source runs in simulation, as a desktop GUI debugger, as WebAssembly, and on real hardware
- Scripting language on top of the microcode for adding functions without touching hardware
- Custom PCB (EasyEDA/JLCPCB), battery, charging circuit
Write-up: https://baltazarstudios.com
Hackaday: https://hackaday.com/2026/05/13/build-the-cpu-then-build-the...
What is the trick to engineering HP calculator keys? Nobody gets keys right like the old HP calculators.
In this age of 3D printing and fast prototypes, we really ought to be able to crack this.
They showed us how they computed the key dimensions and typography with an (HP) minicomputer, then had it print out the commands for some kind of numerically controlled cutting machine on paper tapes using an old ASR33 teletype.
The cutting machine generated moulds for the injection moulding machines making the keys.
The keys are in two parts: light coloured digits and symbols and darker plastic forming the shape of the key itself and surrounding the lighter symbol plastic. As a result, they can be worn down but they can never wear out.
"Sure!" (hands over HP-25C)
<start counting seconds...>
"Hey, where's the equals key?"
Blog post 6 had an error where the picture of a HP-71B (I have one and used its Forth/Assembler ROM manual to write the first HP-48 ROM decoder) where the caption says it is a 48GX (both used a Saturn CPU).
I'm holding in my hand a 4-bit Von Neumann Mostek MK50310N that my father and I used to use to build calculators long ago. Although Mostek made chips for HP (such as the HP-35), they weren't commercially available, but the 50310 was. We could only dream of a project such as yours. I was happy when the "open source" NumWorks was released, but this project aligns more with my interests.
Will definitely install the Qt simulator - would be even better to build one IRL!
I have in my hand (I guess I like using that phase today), my father's original receipt for the HP-45 (it's with the box and manual). $299.00 in 1975, which is $1,850 today(!!!).
Relatively speaking, electronics are very, very cheap today compared to what they used to be. Still appreciate that my $30 CASIO does 90% of that the NumWorks can do, but I'm happy to support upstarts such as NumWorks.
https://baltazarstudios.com/files/calculator-d/Calculator.ht...
https://baltazarstudios.com/files/calculator/Calculator.html
This WebAsm code is compiled using Qt and Verilator so it runs the "hardware" and its microcode inside the simple UI shell that provides the calc interface. In the debug version you can list the ucode, set breakpoints, see regs etc.
This is why network RFCs talk of "octets", to avoid the ambiguity. Octets are always 8 bits.
Zilog Z80 improved this, so that on it DAA could also be used after a subtraction, when it would correctly adjust the result for implementing BCD subtraction.
This was one of the Z80 improvements that were considered important at the time of its launch.
While I have never considered worthwhile to do BCD arithmetic instead of converting the decimal numbers to binary numbers, the DAA instruction on all Intel 8080 successors, including on IBM PC compatible computers, was very convenient for converting binary numbers to their ASCII character string hexadecimal representation, for printing or display purposes (because the decimal adjusting happens to add the correct ASCII offset between '0' ... '9' and 'A' ... 'F', so the conversion to ASCII can be done branchless).
Really hoping that ghidra can add support for non-byte aligned memory regions some day. So many cool 4-bit architectures out there and attempting to shoehorn them into ghidra produces not great results
are there videos available?
Creating the kind of quality video we're all used to seeing is beyond my skill level and ... motivation.
Also, let us all hate on denomals! :)