User Tools

Site Tools



RPN hex 4 banger


A flash resident(!) sample program, this time a dirt-simple 4 function hex calculator (32 bit ints only).


Use SAM-BA or any other comfortable flash programming tool to install the .bin file. It's less than 3kB. Of course, you will lose any existing firmware in your HP-20B, so be sure you backup the stock HP firmware before erasing it.

Expect RAM to be corrupted if you decide to reload the stock HP firmware.

Install this firmware at your own risk.


Another basic sample program for the HP20B. This time it's a four banger 32 bit hex calculator. I think it's RPN, but it may not be exactly correct…

Use the top row (N → Amort) for the A → F hex digits.

Active keys include “(” (roll down), “Input” (enter), “+/-” (chs), “CE” (ce), “←” (backspace/ce), and the four functions. Oh, the shift key now works. The only shifted function is off, which is shift+on.

The “Input” LCD annunciator will be active when an unterminated value is present in the X register. (The RPN annuciator comes on at boot to show that the program is running.)

The scancode of the last keypress is shown in the exponent area of the LCD.

Runs from flash, Thumb mode, trashes memory, and requires some sort of flash programming tool to install.

There's no keypad debouncing–the code simply waits for the key to be released. I'm sure that spinlock is very coin cell friendly. I measured less than 100nA (very hard to measure, my Tek TX3 current meter is too noisy for a clean measurement) in off mode, and about 2mA while running. There is no power management at all–no sleep mode, no halts, no interrupts, and no auto off timer.

I'll add source as soon as I've had a chance to double check and add some comments.

Disclaimer: Yes, the code is ugly. Fix it at your own risk. Consider it nothing more than a toy to demonstrate that we know a little about the hardware.

Happy HP Hacking!

20b/software-flash_4_banger.txt · Last modified: 2008/07/30 22:23 by newell