The DM16L (swiss micros or HP)

Almost half a decade ago (haha, fancy way to say 4 years) I purchased on a whim a beautiful calculator from swiss micros. I’ve been using the spartan dc in the command line since I discovered it and battled to understand what was going on. Quite similar to my first foray with vim almost 15 years go (oh well, getting old here). But since then, I got used to what’s called the Reverse Polish Notation, and swiss micros provides just that, RPN calculators.

This is a very niche post about a piece of hardware made out of love and nostalgia for the old HP calculators. I don’t even know why I write about it, more than it’s been my companion calculator for those 4 years, always in my backpack and I needed an excuse for a post.

On Calculators

Calculators may seem a thing from the past, we mostly carry smartphones with us that have their own calculator (or emulators of what I’m using), and on your laptop there are various alternatives: the stock OS calculator, dc, bc, speedcrunch (one of my fauvorites), or even start an interactive shell with python, perl etc..

So, why a calculator of all things? Well, I have to say for me it was an impulse buy, coupled by the fact that swiss micros is a maker effort from one enthusiast guy that loves his calculators and started creating replicas of them, I felt really enticed to support his endeavour.

That being said, a calculator has its advantages, although it’s still a tough sell. You can clearly see what I mean, on the official swiss micros page there is a tab about why buy a calculator?.

But if you are reading this, I’m not going to sell you anything, just talk about a nice piece of hardware!.

Programmer calculator

There are different models of HP/Swiss-micros calculators, but the one I have here is what is called a computer programmer's calculator. What does that mean? mainly that it provides integer operations, bit operations, and number representation in different bases, all within a user-provided word size.

I have to say, it’s quite useful when working with register flags and such operations like shifting, masking and all the bit manipulations you expect to use in C… although in my current line of work is mostly useless, it’s good to have around when tampering with small Arduino projects.

here’s a little shaky GIF showing how it changes between bases.

From the command line I usually went with bc to do so, to change from binary to octal:
echo "ibase=2;obase=8; 1010101" | bc

On the DM16L would be:
[BIN] 1010101 [OCT]

Of course, bc accepts any arbitrary base 😀 but you would rarely find anything outside 2,8,10,16 in computing.

With other software calculators it’s a matter of a key combination too, for example, pressing F6.

Different word sizes

What surprised me the most is the approach the calculator takes with word-sizes and complements. This is something I barely use at all. But should you ever want to simulate performing operations on a computer with a word-size of 6 bytes using 1’s complement this calculator can handle it 😀

[DEC] 6 [f][WSIZE] -> sets the word size
[f] 1'S -> sets 1’s complement (button 1, second function 1’s)
And now start performing operations

As you can see, it’s quite esoteric. Most I’ve ever worked with these days are 2’s complement in 8 to 64 bit micros. So, for me, these capabilities are mostly unused, my calculator stays at 32-bit word size most of the time. But this is a calculator based on hardware from 1982, a different time compared to 2015.

Floating point

There’s also a rather basic floating point mode (very barebones, compared to her sisters of course). But enough to get me by on a daily basis.

It’s important to notice that the DM16L is replicating what the HP16C did, and this means the floating point format is anything but IEEE_754. Also, a number that you just typed in integer mode won’t play nicely with float mode, so you have to either transform it, or re-insert (hint, re-inserting is easier). This is a small annoyance if you, for whatever reason, are programming in the calculator itself and jump between integer mode and floating point mode.

The manual provides an appendix to transform from IEEE floating point binary to HP16C binary, it’s only 50 keystrokes away! (oh, the irony). Not that you’ll ever need to use it nowadays, but it’s a good reminder.


The draw of this calculators, apart from the basic usage described previously, is the ability to store programs. You can think about it as macros, where you start PGRM mode, press all the keystrokes you need, and voilà, you have a program to run.

Directly extracted from a scan of the HP-16c manual

Here’s a pretty small dump of a program that assumes Z register to be income, Y register to be expenses and the DM16L in float mode.

001  LBL A        | 43 22 A
002  Rv           |       33
003  -            |       30
004  1            |       1
005  0            |       0
006  0            |       0
007  /            |       10
008  2            |       2
009  0            |       0
010  *            |       20

To run, we simply press [GSB] [A]. It starts running the defined steps. Those mainly are decrease income by expense and end up with 20% of that value. (Taxes, yay!)

  • Roll the stack up
  • Decrease Expenses into our Incomes value
  • X = 100
  • Divide
  • X = 20
  • Multiply

Or another, that given a value and a bit index will tell you if that bit is set on that value, which is a little bit more involved, and has a couple of jumps. Assumes the value in register Z and the bit index in register Y. Although, now on reading it, it may be easier by using [f][B?] instead of masking!.

001  LBL A        | 43 22 A
002  CLX          |    43 35
003  0            |       0
004  x<>y         |       34
005  SB           |    42 4
006  AND          |    42 20
007  x#0          |    43 48
008  GTO B        |    22 B
009  GTO C        |    22 C
010  LBL B        | 43 22 B
011  1            |       1
012  RTN          |    43 21
013  LBL C        | 43 22 C
014  0            |       0
015  RTN          |    43 21
  • Clears whatever is in X
  • Sets X=0
  • Swaps X and Y
  • Performs a SB Set Bit (with 0 and our Bit index)
  • Performs an AND between our mask and value
  • Checks if X!=0 and goes to B if true, and to C if false
  • B label, X=1 and returns
  • C label, X=0 and returns


And how do you write and modify those programs? well with the calculator of course!

You could edit programs directly on the browser and dump the result in the DM16L via Serial interface.

But, the machine itself provides some editing capabilities that I’ve used to write the two programs above (and then dump the results into the decoder website).

[g][P/R] Will enter and exit programming mode, and then, show you something like:

not cryptic at all 🙂 It mainly tells you the current line and what is there. Right now, it’s label A in line 001

[SST] and [g][BST] Will go up on down the program lines. Showing the different instructions on each line.

[GTO][.] + 3 numbers goes to the keyed in line.

Typing anything when you are on a given line, will append that instruction. So if you are on line 010 on program mode, and press [+] you will add that instruction in line 011 pushing everything else down.

Pressing [BSP] (A left arrow in DM16L) simply removes that line (and pushes everything else up)

It works, although on a first view it’s kind of a guess what each line refers to. You literally see numbers. But on a closer inspection and playing around a bit, it becomes apparent that the keycodes are arranged in a matrix, where each column is indexed from 1, and last column is number 0. The one-key inputs have a direct code. It’s clear to understand with an image:

PRGM mode keys

Except the direct input keys ([A] to [F], [0] to [9], the rest of the keys are referenced by position in the keyboard.

So, for the previous example, 001 - 43,22,A it simply means [g][LBL][A]. Once that is clear, following a program is a piece of cake since you have the cheatsheet of what every code mean in front of you.


Editing would be a pain without debugging. And fortunately, the DM16L provides step by step execution of instructions in memory.

The same [SST], while in run mode (normal mode), will show the instruction in the current program line while pressed, and execute it when released.

This is a godsend to see what’s going on. You can also send the run into a specific line or label with [GTO]. This will go to that line, but nothing is executed.

What else do you need? 🙂

Final Thoughts

I did not discuss the build-quality of the swissmicros DM16L. After all, one of the selling points of the originals is their roughness and build quality. I’m no expert, but the DM16L feels well made, with satisfying clicks and responses on all keys. Alongside a sturdy case.

A big difference between the HP16C and the DM16L is the keycaps shape, while the original HP16C had a slanted design (where the sub-function of each key was typed in the slanted part), the DM16L is just plain keys. I understand that manufacturing-wise it was probably cheaper to do so. I have no complain on that part.

The only thing I don’t like that much is that the [ON] key has a lower profile than the rest (also somewhat noticeable in my [+] key). Don’t know if it’s by design, but looks and feels strange to me.

You can play with a simulator of the HP16C online, or using nonpareil calculator simulator, or even directly on the web (the web one does not seem 100% accurate, but I tried programming it and it works too).

I can’t tell in good faith that I’ve used all this calculator capabilities, but it happens the same with most of the programs or tools we have (If we don’t count hammers and rulers :-)). So, when I need to do a quick calculation, or check the binary representation of a 32bit register and I have the DM16L in hand (almost always) it’s very fast to check values, perform simple ANDS, SHIFTS and MASKS and is perfect for address manipulations. It fulfils its purpose for me. Same with the smallish floating point capabilities, it gets the job done.

As said, it’s mostly a niche calculator that embedded engineers who like tinkering with things will probably enjoy to have close, or in the drawer. All and all it feels like a small oldish and odd computer that is easy to wrap into your head and program small macros in.

It makes me curious about newer calculators. Since I’ve never had any graphing calculator at all (my de-facto calculator when in college was a Casio fx300W, which did all it had to do and more) the newest HP and TI calculators look crazy.




Filed under curious

2 responses to “The DM16L (swiss micros or HP)

  1. Pingback: The Microsoft Sculpt | Castells

  2. Michael

    I have 2 HP16C calculators, the first I bought 40 years ago as a new Computer Science graduate and I have used it ever since, there is nothing else to touch it, if you do low level bit manipulation like I do in C/C++ its perfect.
    In the good old days there were many various bit sized computers, from 6,8,12,16,32,64 etc. Hence the variable word size. In 1982 I could do a 64 x 64 bit multiply and get a 128 bit result. When did windows catch up ?.
    ones completement was used in some computers as it allowed for a +ve and -ve zero.
    Imagine in 1982 having a calculator that could work in 64 bit mode. Thats mind blowing, HP were so far ahead of anybody else. My calculator still looks new.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.