Nonpareil ad nauseum


I've been fixing bugs in Nonpareil, and improving the SCons build files I use instead of Makefiles.

I've finally got the 14/15-digit display mode of the Woodstock processor (ACT) working correctly, as far as I can tell. That's used in the HP-19C, HP-67, and the HP-9x printing desktop calculators. I'm trying to get the HP-67 running.

The HP-67 normally uses the "KEYS -> A" instruction to read the keyboard, then does fairly complicated stuff to the value in A to determine where to branch. Earlier calculators just used "KEYS -> ROM", which directly replace the low eight bits of the program counter with the hardware keycode (not the same as the user-visible keycode). I was not able to figure out what the hardware keycodes should be from Tony Duell's reverse-engineered schematics, which is not his fault, but rather because I don't have enough documentation on the ACT. I tried to figure out what they should be by studying a microcode disassembly, and by trial and error, but it was very slow progress and it wasn't easy to figure out the correct codes because many incorrect codes map to normal operations. I finally decided that the best thing to do was to write a test program to run on the actual calculator. I don't currently have a means to do that, but I wrote the program and tested it on the simulator. As each key is pressed, it displays the hardware keycode as a three-digit octal number.

Bernhard Engl build a EPROM-based ROM emulator and has it interfaced to an HP-67 in place of the normal ROM chips, so I sent him my code. He burned it into EPROMs and ran it, and we were both surprised that it worked correctly the first time. He was able to determine all of the hardware keycodes and email them to me, and when I plugged them into the KML file and fixed a few minor bugs, the HP-67 started partially working in simulation. Bernhard says that he'll send me some photos of his hardware setup.

I've studied a lot of disassembled Woodstock code, but that's the first Woodstock code I've written. Just reading and studying the code others have written before wasn't enough to give me a full appreciation for how challenging it can be, due to the non-orthagonality of the registers. I'm thinking about writing a game in microcode to get more practice. Too bad most people will never be able to play it except on the simulator.

Currently the HP-67 simulation works until you do anything that requires the calculator to search for a label in program memory. The search routine enters an infinite loop. The loop is entered with P=1, and each iteration through the loop P gets incremented by 2. The maximum value of P is 13, beyond which it wraps to zero, so the next loop value after 13 is 1. However, the test for the end of the loop tests for P=0. An engineering spec for the ACT states that when P wraps on either an increment or decrement, the position "disappears" for one cycle. I suspect that this vague description is wrong, and that in this particular case P happens to have a transient value of 0 at the time the comparison is made. It's possible that this behavior is different than that of the earliest ACT chips; it is known that some revisions of the HP-67 and HP-97 microcode are not compatible with all ACT chips, and perhaps this could be why.

Typical SCons "Builders" take one source file and produce one target file. To define a rule that produces multiple target files, it is necessary to write an "Emitter". As part of the Nonpareil build process, the uasm microassembler gets built, then uasm is used to assemble microcode for several calculator models. Although it's not strictly necessary, I want the assembly to result in listing files as well as object files. I tried to write an Emitter for that months ago, based on the examples in the SCons documentation, and didn't get very far. Now that I know a tiny bit more Python, I hacked on that a bit more, and now it's basically working. The remaining problem is that I want the listing files to go into the obj subdirectory where the object files go, but it's actually creating another obj directory under that for them, so that they are in paths like obj/obj/hp45.lst.

It turns out that I'm not the only person that has been surprised that SCons doesn't come with good support for building source code distribution tarballs. Only recently this has come up on the scons-users mailing list, and Paul Davis posted a nice source tarball Builder. I tried to get it working with the Nonpareil SConstruct and SConscript files, and get an error I don't understand. So I created a simpler test case, and it works for that. Seems to be something about the way my hierarchy works. I hope to have it figured out soon, since I want to package a new source release.

Possibly Related Threads...
Thread Author Replies Views Last Post
  Nonpareil Rom files davorin 2 556 09-20-2013, 06:20 PM
Last Post: Didier Lachieze
  HP35 Ad. from 1972 with calculation error reused in 2009? Michael Kathke 46 4,497 05-14-2013, 03:52 PM
Last Post: Dieter
  Nonpareil + HP10C Mike (Stgt) 0 390 05-13-2013, 04:58 AM
Last Post: Mike (Stgt)
  Nonpareil stuck Arnaud Amiel 3 579 08-05-2011, 10:00 PM
Last Post: Eric Smith
  HP65 in Nonpareil Harald 4 666 01-28-2011, 02:05 PM
Last Post: Harald
  HP 50g in full-page newspaper ad Eric Rechlin 5 731 09-17-2010, 03:24 PM
Last Post: Massimo Gnerucci (Italy)
  36-year-old calculator ad Don Shepherd 13 1,267 06-23-2010, 07:44 AM
Last Post: Pierre Brial
  Warning: GRiD cards ad for 48GX Richard Reed 3 564 10-04-2009, 08:42 PM
Last Post: Richard Reed
  A webserver running on a HP-41 and HPIL patch for nonpareil Khanh-Dang Nguyen Thu-Lam 10 1,161 02-01-2009, 12:59 PM
Last Post: Khanh-Dang Nguyen Thu-Lam
  MOD file format differences for V41 vs i41cx/Nonpareil PeterP 3 578 10-16-2008, 04:36 AM
Last Post: Meindert Kuipers

Forum Jump: