I couldn’t sleep on Sunday night, so I hacked on CASMSIM a bit. That’s my microcode-level simulator for first-generation HP calculators; currently it simulates the HP-35, HP-45, and (mostly) HP-55. It’s written in C and uses Xlib for display. Dave Hicks translated the simulator to a Java applet so you can run it in your web browser.
The HP-45 and HP-55 microcode listings were published in U.S. patents, and when I started the project back in 1995 I typed in the code and wrote an assembler. More recently Peter Monta extracted the HP-35 microcode by using a dremel tool to remove the tops of the metal cans the ROMs were packaged in, taking a photmicrograph of the die, and writing software to extract the bits. He then wrote a disassembler in Python to produce “source code” suitable for input to my assembler. It produces lots of warnings, but assembles to the right bits.
So Sunday night I decided to try to clean up the 35 source code to get rid of the warnings. In the process, I noticed that much of the code is identical to that of the HP-45, so I started copying the relevant labels to the HP-35 source, which makes it much easier to read. This is now in CASMSIM release 0.14. There were no changes to the simulator source code.
Last night I started rewriting the user interface portion of CASMSIM to use the GTK+ 2 toolkit instead of Xlib. I had a bit of trouble at first figuring out how to compile and link GTK+ 2 applications. It’s probably documented somewhere that you have to use pkg-config rather than gtk-config, but I wasted time looking for gtk2-config or the like, and failing to find that, trying to figure out all the correct compiler and linker options myself. Sigh.
I’m currently using a GtkFixed widget to hold the buttons and display, because I don’t really want things to scale. It’s hard enough to get the keyboard legends to look right when only worrying about a single size. Also, I should probably switch to using pixmaps for the overall calculator and the keys, to make it look more like the real thing. Anyhow, the keys work fine. But I tried using a GtkLabel for the display, which should be light red characters on a very dark red background, and discovered that seeting a background color on a GtkLabel has no effect. If there’s not a way to get this sort of color scheme with a standard widget, I suppose I’ll either have to use a GtkDrawingArea, or write my own widget.