Simple exponents on an HP-16c
By Michael Doornbos
- 3 minutes read - 443 wordsI’ve been on the prowl for an HP-16c for quite some time to add to my rather large calculator collection. My daily driver for the last 25 years is an HP-32SII. Simple, rugged, reliable, and does everything I need it to do.
I stumbled on a kit that runs an emulated HP-16c and took the plunge. It was about 1/4 of the price of even the cheapest original devices on eBay and with an aluminum frame, it looked worth a try. Plus, there’s something cool about assembling things yourself.
If I’m being honest, about 90% of the time, I’m on PCalc on my iPhone when I need a calculator. But there’s value in a device made to do only one thing. Also, it’s fun. I don’t have to explain my art to you Warren!
It does a lot of programming things and not a whole lot else
It was really the only mainstream calculator targeted at programmers, and it is loved for its one-button base conversion. Vintage Assembly programmers (like yours truly) to a lot of $d012
to 53266
stuff.
While it does almost everything an Assembly programmer needs, it curiously lacks ANY scientific functions other than square root and 1/x. This is fine, and I know that cramming functions onto 1982 hardware was quite a task.
Luckily it has a reasonably robust programming environment. So let’s write a quick program to do exponents. I happen to do y^x quite a bit and it would be nice to have on this thing.
I wrote this out on paper but keeping with my trend of sparing you from deciphering my handwriting…
Enter the programming mode with P/R
and you probably want to clear the program area.
Step | Keystrokes | Displayed | Code Notes |
---|---|---|---|
001 | LBL E | 43,22,E | Set a convenient entry point |
002 | Enter | 36 | Push the stack up 1 |
003 | 1 | 1 | Counter is zero based so count from 15 to 0 |
004 | - | 30 | |
005 | X<>I | 42,22 | Push 15 onto the increment/decrement counter |
006 | X<->Y | 34 | Swap places |
007 | STO A | 44 A | Store |
008 | Enter | 36 | Push stack up 1 |
009 | LBL 0 | 43,22, 0 | Label to loop back to |
010 | X<->Y | 34 | Swap |
011 | RCL A | 45 A | Put a back in X |
012 | * | 20 | |
013 | Enter | 36 | Push stack up 1 |
014 | DSZ | 43 23 | Decrement and go to LBL 0 if not == 0 |
015 | GTO 0 | 22 0 | |
016 | RTN | 43 21 | Return |
To use this remember we’re doing y^x:
- 2 Enter
- 16
- GSB E
iPhone camera doesn’t love video capture of this screen. It looks MUCH better IRL. That’s it. Pretty easy right? Give it a try.