{"id":2117,"date":"2018-04-25T01:51:36","date_gmt":"2018-04-25T01:51:36","guid":{"rendered":"http:\/\/www.sydneysmith.com\/wordpress\/?p=2117"},"modified":"2018-04-25T01:59:12","modified_gmt":"2018-04-25T01:59:12","slug":"hp-29c-prefix-keys","status":"publish","type":"post","link":"https:\/\/www.sydneysmith.com\/wordpress\/2117\/hp-29c-prefix-keys\/","title":{"rendered":"HP-29C Prefix Keys"},"content":{"rendered":"<p>How does the HP-29C remember that you&#8217;ve pressed a prefix key? When you press f, g, or even STO or GTO; what happens next is not the normal key function.<!--more--><\/p>\n<h2>The f key<\/h2>\n<p>Here&#8217;s what the f key does:<br \/>\n<code><\/p>\n<pre>\r\nkey_f:\r\n00467: if n\/c goto 0245                    ;\r\n00645: jsb 0000                            ;\r\n00400: delayed rom 2                       ;\r\n00401: if n\/c goto 0167                    ;\r\n01167: 0 -> s 4                            ;\r\n01170: 0 -> s 0                            ;\r\n01171: 0 -> s 14                           ;\r\n01172: 0 -> s 6                            ;\r\n01173: 0 -> s 7                            ;\r\n01174: 0 -> s 8                            ;\r\n01175: 0 -> s 10                           ;\r\n01176: 0 -> s 13                           ;\r\n01177: return                              ;\r\n00646: 1 -> s 6                            ; S=...3.56..9.....F\r\n00647: 1 -> s 4                            ; S=...3456..9.....F\r\n00650: if n\/c goto 0216                    ;\r\n00616: 1 -> s 13                           ; S=...3456..9...D.F\r\n00617: if n\/c goto 0163                    ;\r\n00563: if 1 = s 13 then goto 00124         ;\r\n\r\n00124: ...\r\n<\/pre>\n<p><\/code><br \/>\n01167 clears a lot of existing flags, probably all existing prefix flags. You&#8217;ll see that subroutine a lot.<br \/>\n00124 is a common &#8220;after a function has completed&#8221; bit of code. I haven&#8217;t looked in detail yet, but it looks like it sorts out displaying the result and managing LastX.<br \/>\ns 13 will get cleared shortly after the next key gets pressed (00200, see <a href=\"http:\/\/www.sydneysmith.com\/wordpress\/2106\/hp-29c-keypress-routine\/\">HP-29C Keypress Routine<\/a>) so pressing the f key sets s4 and s6.<br \/>\nThere is more detail in <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/f.txt\" rel=\"noopener\" target=\"_blank\">f.txt<\/a>.<\/p>\n<h2>The g key<\/h2>\n<p>Here&#8217;s what the g key does:<br \/>\n<code><\/p>\n<pre>\r\nkey_g:\r\n00473: if 1 = s 4 then goto 00477          ;\r\n00475: if 1 = s 7 then goto 00662          ;\r\n00477: jsb 0000                            ;\r\n00400: delayed rom 2                       ;\r\n00401: if n\/c goto 0167                    ;\r\n01167: 0 -> s 4                            ;\r\n01170: 0 -> s 0                            ;\r\n01171: 0 -> s 14                           ;\r\n01172: 0 -> s 6                            ;\r\n01173: 0 -> s 7                            ;\r\n01174: 0 -> s 8                            ;\r\n01175: 0 -> s 10                           ;\r\n01176: 0 -> s 13                           ;\r\n01177: return                              ;\r\n00500: if n\/c goto 0247                    ;\r\n00647: 1 -> s 4                            ; S=...345...9.....F\r\n00650: if n\/c goto 0216                    ;\r\n00616: 1 -> s 13                           ; S=...345...9...D.F\r\n00617: if n\/c goto 0163                    ;\r\n00563: if 1 = s 13 then goto 00124         ;\r\n\r\n00124: ...\r\n<\/pre>\n<p><\/code><br \/>\nWe see 01167 again. If we had pressed f before g, 01167 clears s4 and s6 so the g key overrides the earlier one.<br \/>\nWe see 00124 again.<br \/>\nThe g key sets s4 but not s6.<br \/>\ns13 is also set but, as explained earlier, it is short lived and doesn&#8217;t affect the behaviour of subsequent keys.<br \/>\nYou can see more detail in <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/g.txt\" rel=\"noopener\" target=\"_blank\">g.txt<\/a>.<\/p>\n<h2>The STO key<\/h2>\n<p>It is a little more complex for the other prefix keys as it also builds a hex code for a program step. Here&#8217;s the code for STO:<br \/>\n<code><\/p>\n<pre>\r\nkey_sto:\r\n00425: if n\/c goto 0266                    ;\r\n00666: if 1 = s 4 then goto 00675          ;\r\n00670: load constant 10                    ; C=000000000000A0 P= 0\r\n00671: jsb 0000                            ;\r\n00400: delayed rom 2                       ;\r\n00401: if n\/c goto 0167                    ;\r\n01167: 0 -> s 4                            ;\r\n01170: 0 -> s 0                            ;\r\n01171: 0 -> s 14                           ;\r\n01172: 0 -> s 6                            ;\r\n01173: 0 -> s 7                            ;\r\n01174: 0 -> s 8                            ;\r\n01175: 0 -> s 10                           ;\r\n01176: 0 -> s 13                           ;\r\n01177: return                              ;\r\n00672: 1 -> s 7                            ; S=...3.5.7.9.....F\r\n00673: 1 -> s 6                            ; S=...3.567.9.....F\r\n00674: if n\/c goto 0216                    ;\r\n00616: 1 -> s 13                           ; S=...3.567.9...D.F\r\n00617: if n\/c goto 0163                    ;\r\n00563: if 1 = s 13 then goto 00124         ;\r\n\r\n00124: ...\r\n<\/pre>\n<p><\/code><br \/>\n&#8220;g STO&#8221; leads to something else (DSZ) so the microcode first checks the s 4 flag.<br \/>\nWe haven&#8217;t pressed the &#8220;g&#8221; key in this test run so we progress to 00670 which sets C[1,0] to &#8220;A0&#8221;. That is the first of a set of hex codes for instructions &#8220;STO 0&#8221; &#8230; &#8220;STO 9&#8221;, &#8220;STO .0&#8221; &#8230; &#8220;STO .5&#8221;.<br \/>\nWe then clear all prefix flags (subroutine 01167 again) and set s6 and s7 (with s13 also being set temporarily).<br \/>\nBy the time we get back to the wait loop, the &#8220;A0&#8221; has been tucked away in the M1 register.<\/p>\n<p>If we now press &#8220;.&#8221;, we get:<br \/>\n<code><\/p>\n<pre>\r\nkey_dot:\r\n00456: if n\/c goto 0002                    ;\r\n00402: if 0 = s 4 then goto 00407          ;\r\n00407: if 0 = s 7 then goto 00404          ;\r\n00411: if 0 = s 6 then goto 00575          ;\r\n00413: jsb 0363                            ;\r\n00763: m1 exch c                           ; C=050000000000A0 M1=05000000000000\r\n00764: 0 -> s 7                            ; S=...3.56..9..C..F\r\n00765: 1 -> s 8                            ; S=...3.56.89..C..F\r\n00766: 0 -> s 10                           ;\r\n00767: return                              ;\r\n00414: 1 -> s 6                            ;\r\n00415: p <- 0                              ; P= 0\r\n00416: load constant 10                    ; C=050000000000AA P=13\r\n00417: if n\/c goto 0216                    ;\r\n00616: 1 -> s 13                           ; S=...3.56.89..CD.F\r\n00617: if n\/c goto 0163                    ;\r\n00563: if 1 = s 13 then goto 00124         ;\r\n\r\n00124: ...\r\n<\/pre>\n<p><\/code><br \/>\nBecause we pressed STO before this, you get the above combination of s4, s7 and s6.<br \/>\ns10 was already clear anyway but we also clear s7 and set s6 and s8 to note we&#8217;re now at &#8220;STO .&#8221;; instead of just &#8220;STO&#8221;.<br \/>\nYou&#8217;ll also see our hex code of &#8220;A0&#8221; has been updated to &#8220;AA&#8221;. That is the starting point for the &#8220;STO . 0&#8221; &#8230; &#8220;STO . 5&#8221; series.<\/p>\n<p>When we now press a digit, we get something that starts with this:<br \/>\n<code><\/p>\n<pre>\r\nkey_2:\r\n00444: c + 1 -> c[x]                       ; C=05000000000001\r\n00445: if n\/c goto 0332                    ;\r\n00732: c + 1 -> c[x]                       ; C=05000000000002\r\n00733: if 1 = s 4 then goto 00745          ;\r\n00735: if 1 = s 7 then goto 00747          ;\r\n00737: if 1 = s 6 then goto 00756          ;\r\n00756: if 0 = s 8 then goto 00747          ;\r\n00760: if 1 = s 13 then goto 00745         ;\r\n00762: if n\/c goto 0347                    ;\r\n00747: a exchange c[wp]                    ; A=05FFFFFFFFF202 C=05000000000040\r\n00750: m1 exch c                           ; C=050000000000AA M1=05000000000040\r\n00751: a + c -> c[wp]                      ; C=050000000000AC\r\n00752: m1 exch c                           ; C=05000000000040 M1=050000000000AC\r\n...\r\n<\/pre>\n<p><\/code><br \/>\nYou can see that combination of s4, s6, s7 and s8 adds the &#8220;2&#8221; from &#8220;STO . 2&#8221; to the hex code &#8220;AA&#8221; to give hex code &#8220;AC&#8221; which is the code for that combination. A similar thing occurs if we pressed &#8220;0&#8221;, &#8220;1&#8221; or &#8220;3&#8221; to &#8220;5&#8221;.<br \/>\nThe microcode continues on to clear all of the prefix keys (subroutine 01167) and to do the actual &#8220;STOre&#8221; action. It then goes via 00124 back to the wait loop.<\/p>\n<p>If we&#8217;d pressed a digit instead of pressing the &#8220;.&#8221; key, it starts like this instead:<br \/>\n<code><\/p>\n<pre>\r\nkey_3:\r\n00443: c + 1 -> c[x]                       ; C=05000000000001\r\n00444: c + 1 -> c[x]                       ; C=05000000000002\r\n00445: if n\/c goto 0332                    ;\r\n00732: c + 1 -> c[x]                       ; C=05000000000003\r\n00733: if 1 = s 4 then goto 00745          ;\r\n00735: if 1 = s 7 then goto 00747          ;\r\n00747: a exchange c[wp]                    ; A=0500FFFFFFF203 C=05000000000030\r\n00750: m1 exch c                           ; C=050000000000A0 M1=05000000000030\r\n00751: a + c -> c[wp]                      ; C=050000000000A3\r\n00752: m1 exch c                           ; C=05000000000030 M1=050000000000A3\r\n...\r\n<\/pre>\n<p><\/code><br \/>\nWith s4=0 and s7=1, it simply adds the &#8220;3&#8221; we pressed this time to the existing &#8220;A0&#8221; hex code to get &#8220;A3&#8221;. That is the hex code for &#8220;STO 3&#8221; so it makes a lot of sense.<br \/>\nIt is interesting that it didn&#8217;t check s6 or other flags. There is a good chance that the same path gets followed for prefixes like &#8220;g LBL&#8221;, &#8220;GTO&#8221; and &#8220;GSB&#8221;. It may even also get used for &#8220;f FIX&#8221;, &#8220;f SCI&#8221;, &#8220;f ENG&#8221; and others.<br \/>\nPressing a digit completes the key sequence so 01167 gets called here too and all of the prefix flags get cleared.<\/p>\n<h2>STO (op) [.] (n)<\/h2>\n<p>You can also press an operator (- + * \/) after the STO key and then, optionally a &#8220;.&#8221; and, a digit key. That involves some additional prefix states. Here&#8217;s what &#8220;STO &#8211; 3&#8221; looks like, when you press &#8220;-&#8220;:<br \/>\n<code><\/p>\n<pre>\r\nkey_sub:\r\n00441: if n\/c goto 0053                    ;\r\n00453: delayed rom 2                       ;\r\n00454: if n\/c goto 0000                    ;\r\n01000: jsb 0025                            ;\r\n01025: if 0 = s 4 then goto 01033          ;\r\n01033: if 0 = s 6 then goto 01027          ;\r\n01035: if 0 = s 7 then goto 01027          ;\r\n01037: if 1 = s 10 then goto 01027         ;\r\n01041: if 1 = s 8 then goto 01027          ;\r\n01043: m1 exch c                           ; C=000000000000A0 M1=00000000000000\r\n01044: return                              ;\r\n01001: if p = 1 then goto 00773            ;\r\n00773: c + 1 -> c[p]                       ; C=000000000000B0\r\n00774: 1 -> s 8                            ; S=...3.56789.....F\r\n00775: if n\/c goto 0216                    ;\r\n00616: 1 -> s 13                           ; S=...3.56789...D.F\r\n00617: if n\/c goto 0163                    ;\r\n00563: if 1 = s 13 then goto 00124         ;\r\n\r\n00124: ...\r\n<\/pre>\n<p><\/code><br \/>\nAfter STO, s4=0 s6=1 s7=1 s10=0 s8=0 so we put M1 into C then change the &#8220;A0&#8221; to &#8220;B0&#8221;. &#8220;B0&#8221; is the start of the hex codes for &#8220;STO &#8211; 0&#8221; &#8230; &#8220;STO &#8211; 9&#8221;, &#8220;STO &#8211; .0&#8221; &#8230; &#8220;STO &#8211; .5&#8221;.<br \/>\nWe also set s8 (and temporarily s13).<\/p>\n<p>If we press &#8220;.&#8221;, we get:<br \/>\n<code><\/p>\n<pre>\r\nkey_dot:\r\n00456: if n\/c goto 0002                    ;\r\n00402: if 0 = s 4 then goto 00407          ;\r\n00407: if 0 = s 7 then goto 00404          ;\r\n00411: if 0 = s 6 then goto 00575          ;\r\n00413: jsb 0363                            ;\r\n00763: m1 exch c                           ; C=050000000000B0 M1=05000000000000\r\n00764: 0 -> s 7                            ; S=...3.56.89.....F\r\n00765: 1 -> s 8                            ;\r\n00766: 0 -> s 10                           ;\r\n00767: return                              ;\r\n00414: 1 -> s 6                            ;\r\n00415: p <- 0                              ; P= 0\r\n00416: load constant 10                    ; C=050000000000BA P=13\r\n00417: if n\/c goto 0216                    ;\r\n00616: 1 -> s 13                           ; S=...3.56.89...D.F\r\n00617: if n\/c goto 0163                    ;\r\n00563: if 1 = s 13 then goto 00124         ;\r\n\r\n00124: ...\r\n<\/pre>\n<p><\/code><br \/>\nWith s4=0 s7=1 s6=1, we: get M1 to C, clear s7 and set s8 instead. s10 is already 0 and s6 is already 1. Like with &#8220;STO . n&#8221;, we change the hex code &#8220;B0&#8221; to &#8220;BA&#8221; so that we&#8217;re positioned at the start of the &#8220;STO &#8211; .0&#8221; &#8230; &#8220;STO &#8211; .5&#8221; hex codes.<\/p>\n<p>For &#8220;STO + [.] n&#8221; it works very much the same way:<br \/>\n<code><\/p>\n<pre>\r\nkey_add:\r\n00465: delayed rom 2                       ;\r\n00466: if n\/c goto 0004                    ;\r\n01004: jsb 0025                            ;\r\n01025: if 0 = s 4 then goto 01033          ;\r\n01033: if 0 = s 6 then goto 01027          ;\r\n01035: if 0 = s 7 then goto 01027          ;\r\n01037: if 1 = s 10 then goto 01027         ;\r\n01041: if 1 = s 8 then goto 01027          ;\r\n01043: m1 exch c                           ; C=050000000000A0 M1=05000000000000\r\n01044: return                              ;\r\n01005: if p = 1 then goto 00772            ;\r\n00772: c + 1 -> c[p]                       ; C=050000000000B0\r\n00773: c + 1 -> c[p]                       ; C=050000000000C0\r\n00774: 1 -> s 8                            ; S=...3.56789.....F\r\n00775: if n\/c goto 0216                    ;\r\n00616: 1 -> s 13                           ; S=...3.56789...D.F\r\n00617: if n\/c goto 0163                    ;\r\n00563: if 1 = s 13 then goto 00124         ;\r\n<\/pre>\n<p><\/code><br \/>\nSTO was pressed so s4=0 s6=1 s7=1 s8=0 s10=0. We get the A0 from M1 to C. We then add 2 to the &#8220;A&#8221; part to move us to the hex codes starting with &#8220;C0&#8221; (&#8220;STO + 0&#8221; &#8230; &#8220;STO + 9&#8221;, &#8220;STO + .0&#8221; &#8230; &#8220;STO + .5&#8221;). s8 gets set.<br \/>\nIf &#8220;.&#8221; is pressed, it behaves as for &#8220;STO &#8211; .&#8221; but &#8220;C0&#8221; becomes &#8220;CA&#8221; (for &#8220;STO + .0&#8221; &#8230; &#8220;STO + .5&#8221;).<\/p>\n<p>&#8220;STO * [.] n&#8221; and &#8220;STO \/ [.] n&#8221; are also similar.<br \/>\n&#8220;STO * [.] n&#8221; adds 3 to &#8220;A&#8221; for hex codes &#8220;D0&#8221; &#8230; (&#8220;STO * 0&#8221; &#8230;). s8 also gets set.<br \/>\n&#8220;STO \/ [.] n&#8221; adds 4 to &#8220;A&#8221; for hex codes &#8220;E0&#8221; &#8230; (&#8220;STO \/ 0&#8221; &#8230;). s8 also gets set.<\/p>\n<h2>The Story so far<\/h2>\n<table>\n<tr>\n<td>Prefix<\/td>\n<td>s4,6,7,8,10<\/td>\n<td>hex code<\/td>\n<\/tr>\n<tr>\n<td>f<\/td>\n<td>11000<\/td>\n<td>n\/a<\/td>\n<\/tr>\n<tr>\n<td>g<\/td>\n<td>10000<\/td>\n<td>n\/a<\/td>\n<\/tr>\n<tr>\n<td>STO<\/td>\n<td>01100<\/td>\n<td>A0<\/td>\n<\/tr>\n<tr>\n<td>STO .<\/td>\n<td>01010<\/td>\n<td>AA<\/td>\n<\/tr>\n<tr>\n<td>STO &#8211;<\/td>\n<td>01110<\/td>\n<td>B0<\/td>\n<\/tr>\n<tr>\n<td>STO &#8211; .<\/td>\n<td>01010<\/td>\n<td>BA<\/td>\n<\/tr>\n<tr>\n<td>STO +<\/td>\n<td>01110<\/td>\n<td>C0<\/td>\n<\/tr>\n<tr>\n<td>STO + .<\/td>\n<td>01010<\/td>\n<td>CA<\/td>\n<\/tr>\n<tr>\n<td>STO *<\/td>\n<td>01110<\/td>\n<td>D0<\/td>\n<\/tr>\n<tr>\n<td>STO * .<\/td>\n<td>01010<\/td>\n<td>DA<\/td>\n<\/tr>\n<tr>\n<td>STO \/<\/td>\n<td>01110<\/td>\n<td>E0<\/td>\n<\/tr>\n<tr>\n<td>STO \/ .<\/td>\n<td>01010<\/td>\n<td>EA<\/td>\n<\/tr>\n<\/table>\n<p>STO (op) has s4,6,7,8,10 = 01110. It may be followed by &#8220;.&#8221; or 0-9.<br \/>\nSTO [(op)] . has s4,6,7,8,10 = 01010. It may only be followed by 0-5.<\/p>\n<h2>RCL<\/h2>\n<p>&#8220;RCL&#8221; sets s4,6,7,8,10 to 01101 and loads hex code &#8220;90&#8221;.<br \/>\n&#8220;RCL .&#8221; sets s4,6,7,8,10 to 01010 and updates the hex code to &#8220;9A&#8221;.<br \/>\nSee <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/rcl_dot_2.txt\" rel=\"noopener\" target=\"_blank\">rcl_dot_2.txt<\/a> for more detail.<\/p>\n<h2>g LBL<\/h2>\n<p>&#8220;g LBL&#8221; sets s4,6,7,8,10 to 00001 and loads hex code &#8220;F0&#8221;. See <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/g_lbl_0.txt\" rel=\"noopener\" target=\"_blank\">g_lbl_0.txt<\/a>.<\/p>\n<h2>GTO<\/h2>\n<p>&#8220;GTO&#8221; sets s4,6,7,8,10 to 00110 and loads hex code &#8220;80&#8221;. See <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/gto_1.txt\" rel=\"noopener\" target=\"_blank\">gto_1.txt<\/a>.<\/p>\n<p>You can also do &#8220;GTO . n1 n2&#8221; to move to a specific program step. It is not a recordable program step but it is still another prefix sequence. The &#8220;.&#8221; clears s7 and sets s10 so s4,6,7,8,10 becomes 00011. M1 doesn&#8217;t change. Pressing the first digit (n1) doesn&#8217;t change any of the s flags (aside from s13) but M1[2,1,0] becomes &#8220;8(n1)0&#8221;. You can see the full sequence in <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/gto_dot_23.txt\" rel=\"noopener\" target=\"_blank\">gto_dot_23.txt<\/a><\/p>\n<h2>GSB<\/h2>\n<p>&#8220;GSB&#8221; sets s4,6,7,8,10 to 00100 and loads hex code &#8220;70&#8221;. See <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/gsb_2.txt\" rel=\"noopener\" target=\"_blank\">gsb_2.txt<\/a>.<\/p>\n<h2>f FIX\/SCI\/ENG<\/h2>\n<p>&#8220;f FIX\/SCI\/ENG&#8221; sets s4,6,7,8,10 to 01000 and loads hex code &#8220;40\/50\/60&#8221;. See <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/f_fix_3.txt\" rel=\"noopener\" target=\"_blank\">f_fix_3.txt<\/a>, <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/f_sci_4.txt\" rel=\"noopener\" target=\"_blank\">f_sci_4.txt<\/a> and <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/f_eng_3.txt\" rel=\"noopener\" target=\"_blank\">f_eng_3.txt<\/a>.<\/p>\n<h2>Less Obvious Prefixes<\/h2>\n<p>There are some additional prefix combinations. These concern the indirect register, the &#8220;i&#8221; key (g Rolldown). You can use some prefixes with that key so you can get combinations like &#8220;STO &#8211; g i&#8221;. Here&#8217;s the prefixes:<\/p>\n<table>\n<tr>\n<td>Prefix<\/td>\n<td>s4,6,7,8,10<\/td>\n<td>M1[2,1,0]<\/td>\n<\/tr>\n<tr>\n<td>sto g<\/td>\n<td>10100<\/td>\n<td>0A0<\/td>\n<\/tr>\n<tr>\n<td>sto sub g<\/td>\n<td>10100<\/td>\n<td>0B0 (others for other ops)<\/td>\n<\/tr>\n<tr>\n<td>rcl g<\/td>\n<td>10100<\/td>\n<td>090<\/td>\n<\/tr>\n<tr>\n<td>gto g<\/td>\n<td>10100<\/td>\n<td>080<\/td>\n<\/tr>\n<tr>\n<td>gsb g<\/td>\n<td>10100<\/td>\n<td>070<\/td>\n<\/tr>\n<\/table>\n<h2>The Digits 0-9<\/h2>\n<p>In the <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/hp29rom.txt\" rel=\"noopener\" target=\"_blank\">hp29rom.txt file<\/a>, you can see the microcode converting a goto location for a key, to a value in C[x]. Pressing the &#8220;9&#8221; key causes the microcode to goto 00436 and the sequence there sets C[2,1,0] = &#8220;xx9&#8221;.<\/p>\n<p>What is different with this calculator though, is s 13 gets set if the digit is outside the range 0-5. It looks like this:<br \/>\n<code><\/p>\n<pre>\r\n00436: c + 1 -> c[x]                       ; key_9\r\n00437: c + 1 -> c[x]                       ; key_8\r\n00440: if n\/c goto 00420                   ; key_7\r\n00462: if n\/c goto 00421                   ; key_6\r\n00420: c + 1 -> c[x] \r\n00421: c + 1 -> c[x]\r\n00422: 1 -> s 13\r\n00423: if n\/c goto 00463\r\n\r\n00463: c + 1 -> c[x]                       ; key_5\r\n00464: if n\/c goto 00442                   ; key_4\r\n00442: c + 1 -> c[x]\r\n00443: c + 1 -> c[x]                       ; key_3\r\n00444: c + 1 -> c[x]                       ; key_2\r\n00445: if n\/c goto 00732                   ; key_1\r\n00457: if n\/c goto 00733                   ; key_0\r\n00732: c + 1 -> c[x]\r\n<\/pre>\n<p><\/code><br \/>\nThis suggests that s13 will get checked if a prefix key sequence including a &#8220;.&#8221; was pressed. If s13 is set the number is out of range (not .0 through .5).<\/p>\n<p>A lot of effort has gone into the choice of prefix flags, hex codes and the microcode for the digit keys. Regardless of which prefix, if any, was selected; and regardless of which digit gets pressed; every combination goes through a single sequence of microcode at 00733 which starts like:<br \/>\n<code><\/p>\n<pre>\r\n00733: if 1 = s 4 then goto 00745\r\n00735: if 1 = s 7 then goto 00747\r\n00737: if 1 = s 6 then goto 00756\r\n00741: if 1 = s 8 then goto 01045\r\n00743: if 1 = s 10 then goto 00747\r\n<\/pre>\n<p><\/code><br \/>\nWhilst there are 32 possible combinations of the 5 s flags, there are only four possible actions for a digit key. These are: 00745, 00747, 00756 or 01045. Even if none of the flags are set, it &#8220;falls through&#8221; the tests to 00745 &#8211; one of the four actions. This makes 00745 the &#8220;normal action&#8221; (ie un-prefixed action) for a digit.<\/p>\n<p>The 00756 action explains a little:<br \/>\n<code><\/p>\n<pre>\r\n00756: if 0 = s 8 then goto 00747\r\n00760: if 1 = s 13 then goto 00745\r\n00762: if n\/c goto 00747\r\n<\/pre>\n<p><\/code><br \/>\nIf s13 is set, treat the digit as a normal digit. This means, for example, if you press &#8220;7&#8221; after a &#8220;STO .&#8221;; it will ignore the &#8220;STO .&#8221; part and act as if only &#8220;7&#8221; had been pressed. This makes sense because you can only &#8220;STO .&#8221; to &#8220;0&#8221;-&#8220;5&#8221;. There isn&#8217;t a &#8220;.7&#8221; data storage register. It may also mean that &#8220;STO .&#8221; then &#8220;.&#8221; will result in just &#8220;.&#8221;; but we&#8217;d have to check how the &#8220;.&#8221; microcode works &#8211; we&#8217;re only addressing digits for now.<\/p>\n<p>We only get to 00756 if s4=0, s7=0 and s6=1. That means we are considering &#8220;{STO [op]|RCL} .&#8221; or &#8220;{FIX|SCI|ENG}&#8221;.<br \/>\nThe &#8220;0 = s 8&#8221; line, 00756, means we&#8217;re dealing with &#8220;{FIX|SCI|ENG}&#8221; and we can skip the s13 (outside &#8220;0&#8221;-&#8220;5&#8221;) check. FIX\/SCI\/ENG can be followed by any digit 0-9.<\/p>\n<p>For both &#8220;{STO [op]|RCL} .&#8221; and &#8220;{FIX|SCI|ENG}&#8221;, we need to merge the digit (0-5 or 0-9) into the hex code in M1 to get the hex code for the fully merged program step or operation. If 00756 decides the digit is valid for the prefix, it goes to 00747. We can also get to 00747 with other s flag combinations (see 00735 and 00743). That includes LBL, GTO and GSB. This all fairly clearly makes 00747 the microcode for &#8220;add a digit into the current hex code&#8221; (let&#8217;s call it upd_hex:). See above (&#8220;The STO key&#8221;), <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/rcl_2.txt\" rel=\"noopener\" target=\"_blank\">rcl_2.txt<\/a>, or the GTO, GSB or LBL traces to watch how it works.<\/p>\n<p>01045 has similar code to 00747. You get to 01045 if s4=0, s7=0, s6=0 and s8=1. That fits &#8220;GTO .&#8221; which isn&#8217;t going to create a hex code (it can&#8217;t be stored as a program step). Let&#8217;s call 01045 gto_dot:. You can see that in operation in <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/gto_dot_23.txt\" rel=\"noopener\" target=\"_blank\">gto_dot_23.txt<\/a><\/p>\n<h2>Summary<\/h2>\n<p>Pressing f or g sets s4, the &#8220;fg&#8221; flag. You can tell which by checking s6. If set it&#8217;s &#8220;f&#8221;.<\/p>\n<p>For other prefixes or sequences, the current state is stored in a combination of s4,6,7,8,10 and M1. The combinations are:<\/p>\n<table>\n<tr>\n<td>s4,6,7,8,10<\/td>\n<td>M1<\/td>\n<td>prefix\/sequence<\/td>\n<\/tr>\n<tr>\n<td>00001<\/td>\n<td>F0<\/td>\n<td>LBL<\/td>\n<\/tr>\n<tr>\n<td>00011<\/td>\n<td>80\/8(n1)0<\/td>\n<td>GTO . [(n1)]<\/td>\n<\/tr>\n<tr>\n<td>00100<\/td>\n<td>70<\/td>\n<td>GSB<\/td>\n<\/tr>\n<tr>\n<td>00110<\/td>\n<td>80<\/td>\n<td>GTO<\/td>\n<\/tr>\n<tr>\n<td>01000<\/td>\n<td>40\/50\/60<\/td>\n<td> FIX\/SCI\/ENG<\/td>\n<\/tr>\n<tr>\n<td>01100<\/td>\n<td>A0<\/td>\n<td>STO<\/td>\n<\/tr>\n<tr>\n<td>01101<\/td>\n<td>90<\/td>\n<td>RCL<\/td>\n<\/tr>\n<tr>\n<td>01110<\/td>\n<td>B0\/C0\/D0\/E0<\/td>\n<td>STO (op)<\/td>\n<\/tr>\n<tr>\n<td>01010<\/td>\n<td>AA\/BA\/CA\/DA\/EA\/9A<\/td>\n<td>{STO [(op)]|RCL} .<\/td>\n<\/tr>\n<tr>\n<td>10100<\/td>\n<td>A0\/B0\/C0\/D0\/E0\/90\/80\/70<\/td>\n<td>{STO [(op)]|RCL|GTO|GSB} g<\/td>\n<\/tr>\n<\/table>\n<p>The s4,6,7,8,10 combination is a prefix code. s4 is &#8220;fg&#8221; but the others are harder to label separately.<\/p>\n<p>s13 is used when a digit is pressed to flag a value outside the range 0-5.<\/p>\n<p>Some significant microcode addresses are:<br \/>\n00745 digit:<br \/>\n00747 upd_hex:<br \/>\n01045 gto_dot:<\/p>\n<p>Prefix keys in the HP-29C are a lot more complex than previous calculators.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How does the HP-29C remember that you&#8217;ve pressed a prefix key? When you press f, g, or even STO or GTO; what happens next is not the normal key function.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,5,66],"tags":[],"_links":{"self":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2117"}],"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=2117"}],"version-history":[{"count":15,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2117\/revisions"}],"predecessor-version":[{"id":2132,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2117\/revisions\/2132"}],"wp:attachment":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}