User Tools

Site Tools



RPN hex 4 banger


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


Boot calc into test mode (to allow stock firmware to configure and init the chip), connect a debugger, halt the chip, download the image, and let 'er rip. It'll probably corrupt anything you had in ram before.


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.

The “Input” LCD annunciator will be active when an unterminated value is present in the X register.

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

Runs from ram, Thumb mode, trashes memory, and requires some sort of JTAG debugger to load and start the program. OCD Commander reports a starting address of 0x002FF000, in case your debugger can't figure it out.

Under OpenOCD, I do a “soft_reset_halt”, then a “load_image hex_4_banger.hex”, followed by a “resume 0x2ff000”. The startup code wants to run in ARM mode, so be sure the core is set accordingly. Once it jumps to main, it should switch cleanly into Thumb mode. (Or at least it seems to for me, single-stepping through it.)

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.

Source added. Have fun with it, but try not to laugh too hard.

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-hex_4_banger.txt · Last modified: 2008/07/28 19:36 by newell