Some notes on the Swiss Micros DM41 series of calculators…

I have a long relationship with Hewlett-Packard portable computing devices; my first experiences programming were on my father’s HP-65, and later the HP-41CV his employer loaned him for his daily work. I had a microcomputer shortly after encountering the HP-65, but learning keystroke programming greatly aided my understanding of assembly language — although I didn’t really recognize that until much later. I later graduated to an HP-28S and then an HP-48SX. In recent years, I have used various HP emulators on the portable devices I use for over ten years; I keep falling back to Free42, because it runs almost everywhere in one port or another. I’ve played with others, and i41CX is what I run on all my iOS devices.

Much has been written about the fine craftsmanship and quality of these early devices — both their physical and electronic design, and the decisions made about their man-machine interfaces. I think exposure to this at an early age definitely has influenced my interest, desire, and recognition of fine design in modern computing products, especially mechanical interactions. I won’t add much here, except that though the bulk of my computation needs now are either so simple that I can do them in my head or on a slide rule (which, yes, I have one on my desk at work) or require real computation to set up, there is still a place for me to use a calculator. It is still faster for me to do some things with a calculator than add formulas to a sheet as I’m analyzing data; once I know what the data is telling me through this exploration, I can then put together the formulas and provide a reasonable presentation. I think because of my upbringing and training, there is something about the cognitive process of using a physical calculator — much as there is in writing with pen and paper instead of typing, a subject much discussed elsewhere.

I have just acquired a Swiss Micros DM41L, their small replica of a HP-41CX calculator. It was a bit of an impulse purchase; I have a working HP-41CX I use occasionally, but don’t take it from the house because I am worried about breaking it or having it stolen (my first one was stolen, in 1988). But I had heard good things, and also wanted to support the effort overall — both by encouraging the good engineering of low-volume products for enthusiasts, and in the hopes that by supporting Michael Steinmann and his company that we’ll see other interesting things (the work on the DM42 is an excellent example of this).

I won’t say much about the HP-41 series of devices, but instead provide links to and There remains an avid user community, and almost all of the original programs that were published in one way or another can be found on the internet. Many remain useful today. There is also a lot to reflect on when considering the culture of information sharing about calculators and calculation programs in the 1980’s and 1990’s, and blogs and enthusiast sites today about things like iOS and Android, or any programming language, especially the small, up-and-coming ones. More on that in a future blog post, perhaps.

I would like, instead, to capture a few specific things about the DM-41 series (I will refer to both the DM41 and the DM41L as the DM41, because the features I’m discussing apply to both device) that are available from various forums and the Swiss Micros site, but necessarily in one place, both for future users and for future me.

The DM41 is a faithful emulator of the original HP-41CX microcode, running on a low-power ARM processor, with a good mechanical keyboard and dot-matrix LCD display. Battery life and CPU speed is of course drastically better, although the memory remains the same (319 registers plus the stack, or just a touch over two hundred bytes), and at present there’s no way to mount external ROM modules, either as physical hardware or as memory dumps. The DM41 is keystroke-programmed in FOCAL using Reverse Polish Notation, which you either love or will never fully understand. (Contrariwise, it wasn’t until I was about thirty-five that I was able to use an infix calculator with any fluency for more than one operation at a time.) Because the calculator is actually an emulator running the original microcode, synthetic programming is supported. Craftsmanship is excellent — I would not say it is a replica that is identical to the original, but carries the same quality and respect for engineering. The display is good, the keys clicky and reliable (although on the DM41L, take a bit more pressure than on an HP product, but I am told that they break in), and the mechanical design sound. There are two variants of the DM41; the DM41L is in “credit card” format, which is the one I bought, and the other in the HP Voyager format. My only complaint, which is my fault, is that the smaller format is almost too small for my big fingers to use. Had I actually held a credit card and thought about it before ordering, this would not be a surprise, so I fault myself, not Swiss Micros. And having something this small means it’s very easy to carry. Because the physical layout is landscape instead of portrait, the keys are laid out differently; this is a bit of problem for my muscle memory, and my first hour with it recalled my “button paralysis” when I switched from the HP-41 to the HP-28, or the HP-28 to the HP-48, or later picked up Dad’s HP-42S to do something with him in his lab and couldn’t find anything. I have not confirmed this, but it seems that some of the alpha keys are mapped differently, too, or else I have forgotten the mappings for the special alpha characters. Unlike the HP-41CX, there is no shortcut sticker on the back of the DM41L, which is probably a good thing, because it would be very small.

First, without further ado, power-on key sequences for the current (v23) firmware:
Keys Function Description
[ON]+[A] time and date
[ON]+[C] serial console switch to serial console (see below)
[ON]+[E] show information firmware version & battery voltage
[ON]+[CHS] LCD settings change LCD contrast with buttons [R/S],[3],[2],[.]
[ON]+[8] change speed toggle between 12MHz and 48MHz
[ON]+[9] key test key test similar to the one known on the other models
[ON]+[STO] -1h set the clock -1h: daylight saving and changing timezones
[ON]+[RCL] +1h set the clock +1h: daylight saving and changing timezones

Second, here’s how to use the USB port to capture RAM dumps. The original HP-41 series had both card reader and HP-IL accessories for disk (then, “disc”) and tape storage; over the years this has been used to get software off of these devices in a variety of formats. The DM41 series has a miniUSB port, and connecting it to a computer — Mac, Windows, Linux, or even Android with USB-OTG — with the serial mode active gives you the ability to exchange full RAM dumps between the DM41 and the connected computer. Setting up a Mac, PC, or Linux is straightforward, and you can find instructions here. For Android, you can use DroidTerm and a USB-OTG cable. I had it running with my Macbook in about five minutes; most of the time was spent digging around for a USB-C to USB-A adapter.

Once you connect the calculator and terminal (38400/N/8/1, please!), and bring up the calculator in serial mode by pressing C (SQRT) and power, you should see the DM41 prompt in the terminal display. From here, you can enter ‘?’ to get help.

There are two commands you’ll use for memory dumping — ‘s’ dumps the contents of the RAM and pertinent registers to the terminal, ‘l’ takes a similarly formatted RAM dump and replaces the contents of the dump with the calculator. The RAM dump is formatted as printable text; you can copy it and paste it into a text editor. Do yourself a favor — if you’ve spent any time at all programming yours, do a RAM dump now and copy the results to a text file, because it’s easy to forget to do that and later lose the calculator contents while experimenting with uploading other programs. (I speak from experience.)

Where things get interesting is the combination of software available on the web at sites like and the programming tool Swiss Micros provides. In this web page, you can paste a well-formatted HP41 FOCAL program listing (no line numbers, though) in the right hand window, and press “encode”, and get a RAM dump you can transfer to the calculator. Even more interesting, you can also install programs you find over the internet that have been saved in the the .raw file format using the programming tool. (You can find .raw files in a lot of places on the Web; a good place for many of the applications that have been written over the years is the library at, which only requires free registration). To transfer a .raw program to the calculator, download it to your PC, go to the programming tool, click “choose file” in the raw box, choose the file, and then “decode raw”. Copy the memory dump in the left hand window, go back to your terminal program connected to the DM41, and type ‘l’, and paste in the memory dump.

Because you’re transferring an entire memory dump, if you want to install more than one program, you need to do this:

  1. Make sure the alphanumeric labels in the program are unique.
  2. Make sure you have enough memory for the combined programs.
  3. Concatenate all of the program listings (without line numbers) together in one listing in a text editor, with END statements between each program..
  4. Copy the combined listing and paste it into the code box on the programming tool.
    Press “encode”.
  5. Copy the resulting memory dump and load it into the calculator as usual with the ‘l’ command.

I’ve done this to load the base conversion programs and the phase-of-the-moon program found on and the HP-41 User Solutions: Calendars collection.

If you want to get a .raw file from a program you’ve written, it’s likely trickier; I’d start by getting a RAM dump, getting the listing from the programming tool, and then running it through something like the third-party HP User Code utility you can find floating around in a few places. I haven’t tried this, though. If you just want to get your program to another emulator, but you might have problems with the fact that most FOCAL listings include line numbers, and the listings provided by the programming tool do not.

I don’t know a lot about the DM41 memory format, even after looking at some posts on both the Swiss Micros and the forums (the latter is especially recommended). What’s obvious, though, is that each row consists of four registers in hexadecimal (fifty-six bits per register, separated by spaces), and that it includes some, but not all, of the CPU registers. You’ll see the A, B, C, S, M, N, and G registers, but not the other ones. C is the processor store for the user-visible X register; S is the register holding the status flags. M and N are processor registers for interacting with the X register, as is G (a single-byte register used for alphanumeric mode, I gather).  (If you’re interested in the HP-41 internals, there’s a short summary of processor internals at, and of the HP-41 memory map at A quick forum post (thanks grsbanks!) helped me understand that the dumps don’t show anything that’s all zeros.


edits 2017-06-24: Explained missing lines, removed registers not in the HP Nut CPU (I was conflating Nut and Saturn.) Minor typo, link fixes.

Two podcasts to check out…

So, the cassette player thing is going well! I have a small stack of tapes from some great musicians on Bandcamp — if I get organized, I may blog about one or two of my favorites over the holiday weekend.

In the meantime, I wanted to share two podcasts with you: Norelco Mori and Tabs Out. Both are reviews of new cassette music releases — but in many ways cannot be more different.

Before I contrast them and make some general comments, I should say of both of these that they are very well produced. Audio quality is high throughout — clear, well-enunciated voices, little background noise, and good diction and speech. From that perspective, both are a real pleasure to listen to. I’m actually pretty fussy about this — I try a lot of podcasts, and don’t stick with many past the first half episode. If the audio is noisy, has too much echo, or if the speaker(s) voice(s) annoy me, off it goes. Similarly, what’s said and how it’s said is important too — we all “um” and “ah” somewhat, but there’s only so much of that — or just plain bad writing or poorly organized thoughts — that I can take before I want to drive into the opposite lane of traffic and put myself out of my misery. Both Norelco Mori and Tabs Out do very well in all of these regards — they’re what I’d call “professional” quality, on a par with good podcasts released by radio stations and other serious podcast networks like TWiT.

They are, however, very different. Norelco Mori prides itself as a podcast with “minimal talk”, and in that it delivers. The host, Ted Butler, does a bit at the beginning telling you what you’re going to hear, and then there’s about an hour of different works, and then a bit at the end about each artist and their method. Because of this, you can listen as actively or as passively as you wish (although I think you get a lot more from it from active listening). I’ve loved everything featured on the podcast, and it’s been difficult not to go to the computer after listening and just queue up a bunch of orders for new music.

Tabs Out is styled more as a radio program a la radio DJs. Honestly, I have a harder time following it; Mike Haley is joined by other hosts, each obviously with a different personality. I’ve never really enjoyed radio programming like that, and I kept wondering when they’d get to the music when I listened to the first episode I downloaded. When they finally do, they pick good music, though. But the format, for me, makes it harder to follow the music and really absorb their selections. It may well appeal to you, though, especially if you’re a fan of traditional radio programming.

If you’d like to discover some new, interesting music with a twist on cassette releases, they’re both worth checking out. I’m finding it easier to discover new stuff this way than surfing Bandcamp or Soundcloud, probably because my on-line time at home is somewhat limited, and I find most music recommendation algorithms just plain suck when it comes to knowing what I’ll like. These podcasts give me a chance to hear some great work by independent musicians when I’m driving to and from work, and their web sites let me follow up with them when I get a chance.

First short drone track from the OP-1…

I’ve had a Teenage Engineering OP-1 for about six months, and just generally plink away at it when I have a bit of free time. I love the instrument; it’s incredibly flexible, and the built in four-track and album recorder means that I can use it as a sketchpad without needing a computer running a DAW for simple things.

I’m mostly interested in assembling drone and ambient music, and it’s taken a while to figure out how to get the sounds I’d like from it.

Here’s my first attempt:

First hike of spring!

I got out today for the first time since this winter for a real hike — not just a quick walk with the dog, but something that takes more than half an hour and is worth bringing the camera.

I went out to Fall Creek, down in Felton; there’s some nice history along the trail there. In the late 1800’s and early 1900’s, this valley’s economy was driven by lumber and lime — much of early San Francisco was constructed with resources drawn from here. Anyway, up the Fall Creek trail are the remnants of old lime kilns and a limestone quarry run by I.X.L. Lime Company.

Fall Creek

I started out to the lime kilns first; it’s about two kilometers from the parking lot up the South Fork of Fall Creek. The park was packed — I was hiking between a family taking visitors out and a bunch of families with small children.

Once at the lime kilns, I waited until the people had moved on and got some photos. The kilns are huge; they’d pile wood in the bottom and then the limestone over it, and it would apparently burn for days. It must have made an amazing amount of heat. Above the kilns you can see bits of the rail car system used to bring the limestone down to the kilns, although you have to look hard to find it.

Lime Kilns

Then I continued past the powder store and up the canyon to the barrel site, where the barrels for the lime were made. This is another couple kilometers from the site; I would assume — although I don’t know — that the primary reason for putting the cooperage where it was was because of the water power needed to run the sawmill, and the trees to cut for the wood for the barrels. There’s still a fair amount of old equipment, too.

Barrell Mills

Once there, I walked back along the North Fork of Fall Creek. Hiking along the creek is an interesting experience; the photos don’t really do it justice, but you’re usually sandwiched between canyon walls separated by tens of meters, with the trail sharing the bottom of the canyon with the creek. The creek’s eroded the base of the canyon and the trail quite a bit; there’s lots of places where you cross the creek, or have to trek up the canyon wall a few meters and back down because a shift in the creek has eroded the logical place for the trail.

I took quite a few photos, although none of them really capture the size of the trees or creek canyons. You can see them in my photo album.

Overall, a good day to be out!

And now for something completely different!

I’ve been dabbling in Haskell since at least 2005, but I’ve never gained fluency. The reason is simple: I’ve never programmed anything of reasonable size in it. I use it a lot for little functional calculation programs, things like utilities for computing the great-circle distance between two points, stuff like that, but haven’t taken the plunge and done anything big enough to really push my understanding forward.

At the Day Job(tm) at Nokia, most of my work is still Qt, with an increasing amount of web technologies (WebGL/HTML 5/CSS/JavaScript) thrown in to visualize results from the research work being done. I feel like I’m stagnating though — I’m comfortable enough with all of those things that I can easily get the job done, and I’m not really learning anything new. Worse, most of the time I feel like I’m writing the same code over and over, parameterized in only a couple of dimensions.

I could lobby for Haskell at the office, but unfortunately that would probably go over like a French kisser at a family reunion — the team has settled on Matlab for prototyping, C++ for performance computation using OpenCV for its vision libraries, Python for data wrangling, and Mongo for databases, with WebGL/HTML 5/CSS/JavaScript and Python in front of the database for data visualization when our older Qt/C++ visualization stuff looks ragged around the edges. I played a part in this decision-making process, and stand by the advice I gave — we’re a cross-disciplinary team with clear objectives in both research and product development, and unfortunately there’s just not room for the hit that coming up to speed and moving all of our existing code to Haskell would take. Moreover, the teams where our code goes after we’re done with it would balk as well — they’re doing some really big compute stuff in Hadoop, and made their bed and will lie in it.

But that leaves me at loose ends; I spent some time working on a book project this winter that’s sort of stalled out (my fault, need to find a publisher and finish it), and looking to sink my teeth into Haskell again. And I think I’ve found the project. There’s a collection of documents from Quakers I want to collect and put in a database, first and foremost for me, but others may benefit as well. Slapping a web front end on the database makes for an easy UI to the database, and would scale well once I collect the data if I decide to share it with other people.

Enter Yesod, a Web framework written in Haskell. It looks to be stable and highly performant, and well-documented, too — some good Web tutorials, and even a book (which of course I’ve already ordered.)

So I’ve decided that rather than using a framework like I know a little about and knock together something in an evening, I’ll stretch a bit and do it in Yesod instead. Building a front end to the database for the data I want to collect in Yesod should get me past the baby steps of writing a few type classes and a bunch of simple functions, with the occasional higher-ordered function thrown in. And, once I get some data in the database, if I decide to open up the data to other users, it’ll need a more robust front end, which requires more bits of Haskell, I’m sure.

In the process, I’ll capture what I do on the project here. It doesn’t pertain to the last book I wrote, or the book before that, but hopefully it’ll be of use to others, and writing for an audience (no matter how small) always forces me to understand what I’m doing better than if I do it alone.

Expect a post or two a week, some weeks more, some weeks less, as time permits. I have some good chunks of time in the next couple weeks to get started, then I go on vacation for a bit — during which either I’ll post a lot less or a lot more, depending on how I feel about things.

Improving Interaction Between the Sony eReader and Mac OS X

I have always read a ridiculous amount. Sadly, in recent years as I’ve taken greater advantage of resources such as the Association for Computing Machinery‘s Digital Library, what that really means is that I print a lot.  There’s a definite advantage to paper; you can stick it in your bag, or put your feet up and lean back more so than with a laptop or desktop PC. At the same time, I don’t archive what I read on paper; I either make notes citing the papers I’ve read, or if the paper is really important to me, I archive a copy of the PDF itself. As a result, my professional reading workflow is one of researching, printing, reading, and recycling the results. This is a tremendous waste of paper.

While I’ve tried various ebook solutions on PDAs over the years, I’ve never been particularly happy with PDF handling on mobile devices.  I’ve watched with interest the growing market for ebooks on devices including the Sony eReader and the Amazon Kindle, although until recently neither has had particularly good PDF handling either.

Last month I laid hands on a Sony eReader, and really liked what I saw. PDF presentation with later firmware in the PRS 505 is much improved over previous firmware releases, and both the PRS 505 and PRS 700 support Secure Digital cards. As USB devices, these products show up as a mass storage device when mounted on Mac OS X. As an added bonus, Kovid Goyal’s Calibre application supports both format translation and automatic harvesting of Web content from RSS feeds. I have to admit that it’s pretty spiffy to get up in the morning, grab the eReader from my desk and have the latest content from both The New York Times and The Economist at my fingertips. In conjunction with the large number of freely available books from Feedbooks, it’s a leisure reader’s dream.

Although the eReader’s appearance as a mass storage device in the Mac OS X Finder is useful, I quickly tired of downloading papers and manually copying them to the device. Intuitively, it seemed that what I wanted to be able to do was to treat the eReader as another printer.

Upon reflection, this idea is quite compelling. It doesn’t require me to change my work flow at all; moreover, there is something cool about the idea of an eInk device being directly accessible as a printer.

Continue reading Improving Interaction Between the Sony eReader and Mac OS X

The obligatory first post…

Installing and configuring WordPress has been on my personal to-do list for an absurdly long amount of time. Back in February 2002, I started a personal blog on LiveJournal, which I kept up-to-date on an intermittent basis. I’d always planned on using it both as a professional soapbox and a personal journal, although it quickly became more of the latter than the former. In recent years, it’s largely lain fallow, a victim of benign neglect as I tackle professional writing and engineering commitments.

With the imminent publication of my latest book, Beginning Javaâ„¢ ME Platform (Beginning from Novice to Professional), it’s again apparent that I should put more effort into reaching out to both those I know and those who read my work. Not only is this an important part of publicity for me as an author, but it’s also a service to you, my readers, because it gives me an opportunity to keep you up to date. I only hope that I am more successful in keeping you up to date than I am self-publicity, something I have generally neglected. 

Hence, this blog.

I’m not certain what all I will post here, or how frequently I will post. You can certainly expect any updates or feedback on my books, of course, but I’m also planning on using this as a working notebook for other technical musings. I don’t have any plans to become a career blogger and make this a central part of my professional activities; to be frank I think there’s too much of that on the Internet already! Instead, I think this is going to fill a very narrow nice, with me posting the occasional update to a previous (probably paper) publication, various tips and tricks I’ve picked up in my engineering career, and possibly some engineering notes about things I’ve found difficult in the hopes that capturing it here will help others.

Thanks for stopping by!