Category Archives: Uncategorized

Building a puzzle

I was able to find time over several nights to assemble a metal puzzle.  In a Google+ posting, Linus Torvalds mentioned working on a Star Wars model, and I was curious to see what other models were available by Fascinations.  I eventually ordered this:

It sat, unopened, on my desk for a few months, but I finally tore open the packaging and started putting it together.  After about 15 minutes, I realized I wasn’t going to be able to do it with just fingernails, I needed a proper tool, very fine needle-nosed pliers.  So, I ordered those, and waited a few days.

Some of the tabs were very hard to place, I needed to borrow a magnifying visor to get the tabs into the slots, but things went relatively smoothly.  I broke three pieces.  Two of the breaks aren’t noticeable, there were enough tabs to hold everything together.  The last piece broke when I was trying to remove it from the metal sheets, you can see a gap near the front of the upper cupola on the model where some of the length of that piece broke off.  Here’s the final version:

Overall, it was a fun experience.  Not frustrating, but it did require patience.

Poking head up for a moment

So, turns out that the birth of a new baby does reduce the amount of time available to other activities.  With the baby turning 2 years old soon, and starting to do things on her own, I might be able to get back to writing here again in a while.

So, what have I been up to?  My stack of books to be read continues to grow much more quickly than I can possibly read them.  Right now, I’m reading

Products from

I’ve had to cut my list of authors to read down quite a bit recently, just to keep my stack of books from growing too much.  I still prefer physical books to e-books, though there are many times I’ve wished that I could continue a book on my phone while waiting for something.  I’m not willing to pay twice for the same book for that privilege, and the Amazon Unlimited books don’t seem to have much overlap with my reading list, so I haven’t signed up for that.

Meanwhile, Chin Yi and I managed to watch a movie this week,

Products from


With the baby going to sleep around 10:00, and various chores to finish off after that, it can take a few nights to get through a movie.

I’m posting now mostly because I want to continue using my Amazon API account when running the tellico program to keep track of books and movies that I own.  They changed their terms today, and so I had to sign up as an Associate, to put in advertising links to their products.

The HP-67 emulator, fixing the program mode in the ncurses UI

Now, there are just a few more minor details to fix up in the ncurses UI in programming mode.  We have to display the contents correctly, allow inserts part-way through, and implement a special behaviour.  In programming mode, the GOTO key, when followed by a dot and three numeric digits, caused the calculator to move to that step number instead of inserting a new program step.  This is the only context in programming mode in which a keypress is not recorded, but is acted upon, so we’ve added special-case code in the engine to handle it.

We also need a way to exit programming mode.  I’ve decided that the exit keypress, CTRL-D, will, in program mode, exit back to run-mode, rather than exiting the calculator entirely.  A patch was put in for that.

The current code is checked into the git repository under the tag v2015-01-03.

Here’s a screen shot of the calculator in programming mode.  We will be inserting additional lines before the “+” in this program.


The HP-67 emulator, display program memory in the Curses CLI

Next, we want to make programming mode useable.  It should display the program memory when we’re in programming mode, not the stack and memory registers.  It will also display more valid keys, but that code was already in place, it just happened automatically when we entered programming mode.

The HP-67 calculator doesn’t have a key to press to enter programming mode.  Instead, it has a slider that switches between interactive and programming modes.  The Curses CLI needs a key definition for this operation, as anything the user can do will be through logical keypresses.  So, we’ve defined a key for that, with a location that is not part of the normal calculator keypad.  You’ll note that we haven’t actually defined a key yet for the reverse operation, but we will get to that soon.

With the latest changes, keypresses entered in program mode are stored into program memory, and not executed.  They are then available for display in the UI.  Here is a screenshot of this behaviour:


This is a program that, when “gosub A” is executed, adds 10 to X and stores the result in memory register 4.  It then returns to the calling context.

The current version of the code can be found in the git repository under the tag v2014-12-14.