{"id":1078,"date":"2015-09-15T13:27:48","date_gmt":"2015-09-15T13:27:48","guid":{"rendered":"http:\/\/www.sydneysmith.com\/wordpress\/?p=1078"},"modified":"2017-05-14T00:48:45","modified_gmt":"2017-05-14T00:48:45","slug":"hp65-program-codes","status":"publish","type":"post","link":"https:\/\/www.sydneysmith.com\/wordpress\/1078\/hp65-program-codes\/","title":{"rendered":"HP65 Program Codes"},"content":{"rendered":"<p>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&#8217;s the point.<\/p>\n<p>Internally, the calculator stores a program code for each key press or combination of key presses. With the HP65 it is mostly &#8220;one key press, one stored code&#8221; but there are a few combinations it recognises and saves as one program code. These are called &#8220;merged program steps&#8221;.<br \/>\n<!--more--><\/p>\n<p>When you are in &#8220;W\/PGM&#8221; mode and press keys, the display shows a key code for each key press (or combination). If you &#8220;SST&#8221; (single step) through a program it displays the same key codes to show you which keys it would be executing.<\/p>\n<p>A key code looks like &#8220;11&#8221;. This is the key code for the [A] button at the top left of the HP65 keyboard. The &#8220;11&#8221; means &#8220;1st row, 1st column&#8221;. If you are using the calculator you have the keyboard right in front of you and can easily see that &#8220;11&#8221; is the [A] button. &#8220;12&#8221; is the [B] button (next one to the right) and &#8220;21&#8221; is the [DSP] button, just under the [A] button. It is pretty simple and people pick it up pretty fast.<\/p>\n<p>A merged key code looks like &#8220;33 05&#8221;. Number keys ([0] to [9]) are easier to remember as &#8220;00&#8221; to &#8220;09&#8221; so they are the one exception to the row &#038; column rule. So, &#8220;33 05&#8221; 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.<\/p>\n<p>Key codes are great for people. As I&#8217;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&#8217;s just how it works.<\/p>\n<p>The numbers it uses internally are:<br \/>\n<img loading=\"lazy\" src=\"http:\/\/www.sydneysmith.com\/wordpress\/wp-content\/uploads\/2015\/09\/65-prog-codes.png\" alt=\"65-prog-codes\" width=\"430\" height=\"298\" class=\"alignnone size-full wp-image-1079\" srcset=\"https:\/\/www.sydneysmith.com\/wordpress\/wp-content\/uploads\/2015\/09\/65-prog-codes.png 430w, https:\/\/www.sydneysmith.com\/wordpress\/wp-content\/uploads\/2015\/09\/65-prog-codes-300x208.png 300w\" sizes=\"(max-width: 430px) 100vw, 430px\" \/><\/p>\n<p>The chart is in &#8220;Octal&#8221; so the [A] key (key code &#8220;11&#8221;) is actually stored in the calculator&#8217;s program memory as 36 (Octal) &#8211; from the chart &#8211; or (3*8+6=) 30 decimal.<\/p>\n<p>Normally you&#8217;d never see or know what it uses internally for the program codes. You&#8217;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&#8217;m talking about came much later on and gave us emulators for the original hardware.<\/p>\n<p>You don&#8217;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.<\/p>\n<p>I found the chart on <a href=\"http:\/\/home.citycable.ch\/pierrefleur\/HP-Classic\/HP-ClassicPrgmCode.html\">http:\/\/home.citycable.ch\/pierrefleur<\/a>.<\/p>\n<p>Here is the same thing as a list you can open in Excel (and sort by whichever column you need):<br \/><a href=\"http:\/\/www.sydneysmith.com\/wordpress\/wp-content\/uploads\/2015\/09\/65-prog-codes.csv\">65-prog-codes<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"https:\/\/www.sydneysmith.com\/wordpress\/1078\/hp65-program-codes\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">HP65 Program Codes<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,5,39],"tags":[9,29],"_links":{"self":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/1078"}],"collection":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1078"}],"version-history":[{"count":7,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/1078\/revisions"}],"predecessor-version":[{"id":1393,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/1078\/revisions\/1393"}],"wp:attachment":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}