HP65 Program Codes

When you program a programmable calculator like the HP65 you press buttons and it remembers the steps you are telling it. Then when you run the program, it re-does those button presses again to calculate the result. Every time you run the program it does those steps. This happens even though you only entered them once. That’s the point.

Internally, the calculator stores a program code for each key press or combination of key presses. With the HP65 it is mostly “one key press, one stored code” but there are a few combinations it recognises and saves as one program code. These are called “merged program steps”.

When you are in “W/PGM” mode and press keys, the display shows a key code for each key press (or combination). If you “SST” (single step) through a program it displays the same key codes to show you which keys it would be executing.

A key code looks like “11”. This is the key code for the [A] button at the top left of the HP65 keyboard. The “11” means “1st row, 1st column”. If you are using the calculator you have the keyboard right in front of you and can easily see that “11” is the [A] button. “12” is the [B] button (next one to the right) and “21” is the [DSP] button, just under the [A] button. It is pretty simple and people pick it up pretty fast.

A merged key code looks like “33 05”. Number keys ([0] to [9]) are easier to remember as “00” to “09” so they are the one exception to the row & column rule. So, “33 05” means press the key 3 down and 3 in (the [STO] key) then the [5] key. This is the sequence to STOre a value in memory 5. The merged key code is two key presses but one program step. Both keys show in the display as a single step.

Key codes are great for people. As I’ve said, they are fairly easy to remember. However, internally, the HP65 stores every key code (single or merged) as one 6-bit number (0 to 63). That’s just how it works.

The numbers it uses internally are:
65-prog-codes

The chart is in “Octal” so the [A] key (key code “11”) is actually stored in the calculator’s program memory as 36 (Octal) – from the chart – or (3*8+6=) 30 decimal.

Normally you’d never see or know what it uses internally for the program codes. You’d only see the single and merged key codes. However, a bunch of really clever people did some amazing things many years ago to work out how the HP calculators work. Whilst a lot of friendly rivalry existed at the time and some reverse-engineering probably did happen, the people I’m talking about came much later on and gave us emulators for the original hardware.

You don’t need to know anything about the above table unless you are building an emulator. Its main benefit for a normal user is that it shows you which key combinations are single and which are merged.

I found the chart on http://home.citycable.ch/pierrefleur.

Here is the same thing as a list you can open in Excel (and sort by whichever column you need):
65-prog-codes.

It's only fair to share...Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUponDigg thisPin on PinterestEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *