{"id":2133,"date":"2018-04-25T12:33:54","date_gmt":"2018-04-25T12:33:54","guid":{"rendered":"http:\/\/www.sydneysmith.com\/wordpress\/?p=2133"},"modified":"2018-04-25T22:00:05","modified_gmt":"2018-04-25T22:00:05","slug":"hp-29c-and-s9","status":"publish","type":"post","link":"https:\/\/www.sydneysmith.com\/wordpress\/2133\/hp-29c-and-s9\/","title":{"rendered":"HP-29C and s9"},"content":{"rendered":"<p>There are a series of &#8220;s flags&#8221; in the Woodstock (and Classic) series calculators. What they are used for, often varies according to the calculator model. While we were <a href=\"http:\/\/www.sydneysmith.com\/wordpress\/2117\/hp-29c-prefix-keys\/\">looking at prefixes<\/a>, we saw what a number of the s flags do (s4,6,7,8,10) and saw a little bit about the s13 flag. We also saw the s9 flag but never even mentioned it. Here&#8217;s the detail<!--more-->.<\/p>\n<p>We were in <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/rcl_2.txt\" rel=\"noopener\" target=\"_blank\">rcl_2.txt<\/a> and skipped over what happens after we press the &#8220;2&#8221;. Here&#8217;s a summary of some of it:<br \/>\n<code><\/p>\n<pre>\r\nkey_2:\r\n00444: ...\r\n00751: a + c -> c[wp]                      ; C=00000000000092\r\n00752: ...\r\n06027: a -> rom address                    ; A=...92, 0x9=1001=011\r\n06011: ...                                 ; hex codes 90..9F (RCL 0-.5)\r\n06270: 0 -> c[p]                           ; C=00000000000002 (0-.5 to 0-F)\r\n06271: c -> addr                           ;\r\n06272: data register -> c 0                ; C=00000000000000 (RCL 2)\r\n06273: ...\r\n06250: if 0 = s 9 then goto 00253          ;\r\n06252: c -> stack                          ;\r\n06253: ...\r\n00070: 1 -> s 9                            ;\r\n00071: ...\r\n\r\n00124: 0 -> s 11                           ;\r\n<\/pre>\n<p><\/code><br \/>\nYou can see it get the contents of memory 2 (ram[02]) to C in step 06272. However, what is interesting is 06250 and 06252. If s9 is set C gets pushed up the stack. If not, the &#8220;c -&gt; stack&#8221; bit gets skipped.<\/p>\n<p>If we think about it, a RCL would normally push the current X value into the Y register, the Y value into the Z register, and so on. The stack lifts. The only times that wouldn&#8217;t happen are if we&#8217;d just pressed CLx or ENTER.<\/p>\n<p>The s9 flag is looking very much like the &#8220;auto_enter&#8221; flag.<\/p>\n<p>In CLx, you&#8217;ll see:<br \/>\n<code><\/p>\n<pre>\r\nkey_clx:\r\n00505: if 0 = s 4 then goto 00535          ;\r\n00535: ...                                 ; C=05600000000004 (hex code 04)\r\n00565: c -> a[w]                           ; A=05600000000004\r\n00566: ...                                 ; C=05600000000000 M1=05600000000004\r\n06027: a -> rom address                    ;\r\n\r\nhex_0x:\r\n06000: if n\/c goto 0034                    ;\r\n06034: decimal                             ;\r\n06035: shift left a[x]                     ; A=05600000000040\r\n06036: delayed rom 13                      ;\r\n06037: a -> rom address                    ;\r\n\r\nfunc_clx:\r\n06404: if n\/c goto 0357                    ;\r\n06757: if 0 = s 12 then goto 00762         ;\r\n06762: delayed rom 4                       ;\r\n06763: jsb 0235                            ; ram[46] -> c\r\n02235: ...                                 ; P=0 C=03493428400200\r\n02241: return                              ;\r\n06764: 0 -> c[w]                           ; C=00000000000000\r\n06765: c -> data register 15               ; 0 -> ram[47], X\r\n06766: if n\/c goto 0311                    ;\r\n06711: 0 -> s 9                            ; S=...3.5.........F\r\n06712: ...\r\n00062: 0 -> s 12                           ;\r\n00063: jsb 0323                            ; c -> b; LastX -> c\r\n00323: ...                                 ; B=00000000000000 C=05600000000000\r\n00330: return                              ;\r\n00064: if n\/c goto 0114                    ;\r\n00114: jsb 0315                            ;\r\n00315: if 1 = s 2 then goto 00321          ;\r\n00317: if 0 = s 1 then goto 00322          ;\r\n00322: return                              ;\r\n00115: binary                              ;\r\n00116: delayed rom 2                       ;\r\n00117: jsb 0167                            ; clear prefixes & s 0,13,14\r\n01167: ...\r\n01177: return                              ;\r\n00120: b -> c[w]                           ; C=00000000000000\r\n00121: if 1 = s 2 then goto 00223          ;\r\n00123: 0 -> s 1                            ;\r\n\r\n00124: ...\r\n<\/pre>\n<p><\/code><br \/>\nkey_clx sets the hex code (04) and then jumps to a routine for codes 00-0F.<\/p>\n<p>That jumps to a routine for hex code 04, func_clx.<\/p>\n<p>func_clx puts 0 in c and ram[47] which saves the X value when switched off (in cmos \/ continuous memory), clears s9, gets LastX back, decides it doesn&#8217;t need it, and finishes with 0 in C.<\/p>\n<p>The microcode for ENTER is (see <a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/4_ent.txt\" rel=\"noopener\" target=\"_blank\">4_ent.txt<\/a>):<br \/>\n<code><\/p>\n<pre>\r\nfunc_enter: ; (hex code 01)\r\n06401: if n\/c goto 0307                    ;\r\n06707: b -> c[w]                           ;\r\n06710: c -> stack                          ; D=04000000000000 E=01000000000000\r\n06711: 0 -> s 9                            ; S=...3.5......C..F\r\n06712: ...\r\n\r\n00124: ...\r\n<\/pre>\n<p><\/code><br \/>\nYou can see the main actions are: push the stack (E-&gt;F, D-&gt;E, C-&gt;D) and clear s9.<\/p>\n<p>It goes on to do other things, but these are what we&#8217;re interested in here.<\/p>\n<p>s9 is the auto_enter flag.<\/p>\n<p>For a higher level view, here&#8217;s 4 ENTER 5 ADD and the register values at the wait loop:<br \/>\n<code><\/p>\n<pre>\r\n(power on)    C=00000000000000 S =...3.5...9......\r\n(press 4)     C=04000000000000 S =...3.5...9..C...\r\n(press ENTER) C=04000000000000 S =...3.5..........\r\n(press 5)     C=05000000000000 S =...3.5...9..C...\r\n(press +)     C=09000000000000 S =...3.5...9......\r\n<\/pre>\n<p><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are a series of &#8220;s flags&#8221; in the Woodstock (and Classic) series calculators. What they are used for, often varies according to the calculator model. While we were looking at prefixes, we saw what a number of the s flags do (s4,6,7,8,10) and saw a little bit about the s13 flag. We also saw &hellip; <a href=\"https:\/\/www.sydneysmith.com\/wordpress\/2133\/hp-29c-and-s9\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">HP-29C and s9<\/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,66],"tags":[32,34],"_links":{"self":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2133"}],"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=2133"}],"version-history":[{"count":3,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2133\/revisions"}],"predecessor-version":[{"id":2136,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2133\/revisions\/2136"}],"wp:attachment":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}