{"id":1134,"date":"2015-10-02T13:32:18","date_gmt":"2015-10-02T13:32:18","guid":{"rendered":"http:\/\/www.sydneysmith.com\/wordpress\/?p=1134"},"modified":"2017-05-14T01:38:34","modified_gmt":"2017-05-14T01:38:34","slug":"the-hp67-keypress-wait-loop","status":"publish","type":"post","link":"https:\/\/www.sydneysmith.com\/wordpress\/1134\/the-hp67-keypress-wait-loop\/","title":{"rendered":"The HP67 Keypress Wait Loop"},"content":{"rendered":"<p>This is the microcode in a HP67 calculator that waits for a key press.<\/p>\n<pre>\r\n00167: 0 -> s 3\r\n00170: CRC 1500\r\n00171: if 1 = s 3\r\n00172: then go to 0263\r\n00173: 0 -> s 1\r\n00174: CRC 300\r\n00175: if 1 = s 3\r\n00176: then go to 0204\r\n00177: if 0 = s 11\r\n00200: then go to 0206\r\n00206: 0 -> s 3\r\n00207: CRC 560\r\n00210: if 1 = s 3\r\n00211: then go to 1324\r\n00212: if 0 = s 15\r\n00213: then go to 0167\r\n<\/pre>\n<p>It spends most of its time in this loop just checking to see if there is anything to do.<\/p>\n<p>The addresses above are in octal. All of them are &lt; 256 decimal so they are all in rom 0 of the first &#8220;quad rom&#8221; (one chip with 4 lots of 256 microcode instructions). Roms 0, 1, 2 and 3 are in the first quad.<\/p>\n<p>The CRC instructions are &#8220;card reader circuit&#8221; commands.<\/p>\n<p>CRC 1500 checks a flag in the card reader and if set, sets the s 3 flag in the calculator (and clears the card reader flag). I don&#8217;t know what the flag means yet but 0263 is likely to answer that.<\/p>\n<p>CRC 300 checks the run-w\/prgm switch. If you are in &#8220;W\/PRGM&#8221; then it sets the s 3 flag. It clears it if you are in &#8220;RUN&#8221; mode.<\/p>\n<p>CRC 560 checks whether a card has been inserted into the card reader. If so, s 3 gets set. If not, s 3 is 0.<\/p>\n<p>s 15 gets set when a key has been pressed. This suggests that 00214 onwards deals with a key press.<\/p>\n<p>s 11 is a mystery at present. If does seem to go into code that checks whether MERGE has been selected so it may be card reader related.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the microcode in a HP67 calculator that waits for a key press. 00167: 0 -> s 3 00170: CRC 1500 00171: if 1 = s 3 00172: then go to 0263 00173: 0 -> s 1 00174: CRC 300 00175: if 1 = s 3 00176: then go to 0204 00177: if 0 &hellip; <a href=\"https:\/\/www.sydneysmith.com\/wordpress\/1134\/the-hp67-keypress-wait-loop\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">The HP67 Keypress Wait Loop<\/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,3],"tags":[30,32],"_links":{"self":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/1134"}],"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=1134"}],"version-history":[{"count":4,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/1134\/revisions"}],"predecessor-version":[{"id":1359,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/1134\/revisions\/1359"}],"wp:attachment":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}