{"id":2149,"date":"2018-05-05T23:09:33","date_gmt":"2018-05-05T23:09:33","guid":{"rendered":"http:\/\/www.sydneysmith.com\/wordpress\/?p=2149"},"modified":"2018-05-05T23:09:33","modified_gmt":"2018-05-05T23:09:33","slug":"hp-29c-input-mode","status":"publish","type":"post","link":"https:\/\/www.sydneysmith.com\/wordpress\/2149\/hp-29c-input-mode\/","title":{"rendered":"HP-29C Input Mode"},"content":{"rendered":"<p>When you press digits on the HP-29C, you go into &#8220;Input Mode&#8221;. What is that, and how does it work? <!--more--><\/p>\n<p>The input_mode process is quite lengthy as you need to see what happens before and after pressing the decimal point &#8220;dot&#8221; key, and you also need a few digits on each side to see how it deals with tens as well as ones, and hundredths as well as tenths.<\/p>\n<h2>Short Summary<\/h2>\n<p>The short version is: it saves the display formatted value in ram[30] and also adds two settings in there. The sign digit gets set to 1 if the decimal point has already been pressed. ram[30][0] is the exponent for the current value.<\/p>\n<p>It is clever to save the display formatted value and decimal point settings. That IS the current state during input mode and it is easy to add digits and update the display accordingly. But, boy oh boy, it isn&#8217;t simple to follow.<\/p>\n<p>You won&#8217;t believe it but, the following is what started as the <strong>summary<\/strong> of how input mode works.<\/p>\n<h2>First Digit<\/h2>\n<p>When you press the first digit, it sets input_mode by setting s12.<br \/>\nIt also shuffles the digit to the left of the display and updates ram[30] and ram[47].<\/p>\n<p>The sequence looks like:<br \/>\n<code><\/p>\n<pre>\r\n00173: if 0 = s 15 then goto 00152         ; 4 pressed s15=1\r\n00175: display off                         ;\r\n00176: ...\r\n00222: a -> rom address                    ; A=0000FFFFFFF340\r\n\r\nkey_4:\r\n00464: ...                                 ; C=00000000000004\r\n\r\ndigit:\r\n00745: c + 1 -> c[p]                       ; C=00000000000014 (hex code)\r\n00746: ...                                 ;\r\n01167: ...                                 ; clear prefixes (s 4,6,7,8,10) and s0,13,14\r\n00563: ...                                 ; A=00000000000014 M1=00000000000014\r\n01167: ...                                 ; clear prefixes (s 4,6,7,8,10) and s0,13,14\r\n00570: ...                                 ; C=00000000000000 (B->C)\r\n06025: p <- 12                             ; P=12\r\n06026: 0 -> s 11                           ;\r\n06027: a -> rom address                    ;\r\n\r\nhex_1x:                                    ; hex codes 10-19 (digit 0-9), and others\r\n06001: ...                                 ;\r\n07014: ...                                 ; check 1x, x is 0-9\r\n07164: ...                                 ;\r\n07400: if 1 = s 12 then goto 01417         ; if not first digit\r\n07402: if 0 = s 9 then goto 01405          ; if auto_enter\r\n07404: c -> stack                          ;    push existing X up the stack\r\n07405: 1 -> s 9                            ; endif (and set auto_enter for nxt)\r\n07406: 0 -> c[w]                           ; X=0\r\n07407: binary                              ;\r\n07410: c - 1 -> c[w]                       ; C=FFFFFFFFFFFFFF\r\n07411: 0 -> c[s]                           ; C=0FFFFFFFFFFFFF\r\n07412: f exch a                            ; A=00000000000010\r\n07413: 0 -> a[x]                           ; A=00000000000000\r\n07414: f exch a                            ; A=00000000000004\r\n07415: 1 -> s 12                           ; S=...3.5...9..C..F input_mode\r\n07416: if n\/c goto 0022                    ;\r\n;\r\n; shift digit from A[0] to correct position\r\n07422: p <- 1                              ; P= 1\r\n07423: c + 1 -> c[p]                       ; C=0FFFFFFFFFFF0F\r\n07424: if n\/c goto 0051                    ;\r\n07425: shift left a[w]                     ; A=00000000000040\r\n07426: p + 1 -> p                          ; P= 2\r\n07427: if p # 13 then goto 01423           ;\r\n07423: ...                                 ; C=0FFFFFFFFFF00F A=00000000000400 P= 3\r\n07423: ...                                 ; C=0FFFFFFFFF000F A=00000000004000 P= 4\r\n07423: ...                                 ; C=0FFFFFFFF0000F A=00000000040000 P= 5\r\n07423: ...                                 ; C=0FFFFFFF00000F A=00000000400000 P= 6\r\n07423: ...                                 ; C=0FFFFFF000000F A=00000004000000 P= 7\r\n07423: ...                                 ; C=0FFFFF0000000F A=00000040000000 P= 8\r\n07423: ...                                 ; C=0FFFF00000000F A=00000400000000 P= 9\r\n07423: ...                                 ; C=0FFF000000000F A=00004000000000 P=10\r\n07423: ...                                 ; C=0FF0000000000F A=00040000000000 P=11\r\n07423: ...                                 ; C=0F00000000000F A=00400000000000 P=12\r\n07423: ...                                 ; C=0000000000000F A=04000000000000 P=13\r\n07431: p - 1 -> p                          ; P=12\r\n07432: a exchange c[wp]                    ; A=0000000000000F C=04000000000000\r\n07433: p - 1 -> p                          ; P=11\r\n07434: c -> a[w]                           ; A=04000000000000\r\n07435: c - 1 -> c[wp]                      ; C=04FFFFFFFFFFFF (\" 4     \")\r\n07436: a exchange c[x]                     ; A=04000000000FFF C=04FFFFFFFFF000\r\n07437: if a[m] # 0 then goto 01465         ;\r\n07465: jsb 0067                            ;\r\n\r\n; looks like it adjusts exponent for precision (f) and\r\n; normalizes - don't want C[12] (first digit) =0\r\n07467: a exchange b[x]                     ; A=04000000000000 B=00000000000FFF\r\n07470: decimal                             ;\r\n07471: 0 -> a[x]                           ;\r\n07472: f -> a                              ;\r\n07473: a + c -> c[x]                       ;\r\n07474: p <- 12                             ; P=12\r\n07475: if c[p] # 0 then goto 01505         ;\r\n07505: a exchange b[x]                     ; A=04000000000FFF B=00000000000000\r\n07506: binary                              ;\r\n07507: return                              ;\r\n\r\n07466: if n\/c goto 0041                    ;\r\n07441: a exchange c[ms]                    ; A=04FFFFFFFFFFFF C=04000000000000\r\n07442: ...                                 ; C->B,            B=04000000000000\r\n07444: jsb 0203                            ;\r\n\r\n; A[0]=f; A->ram[30]\r\n07603: if 0 = s 4 then goto 01607          ;\r\n07607: f -> a                              ; A=04FFFFFFFFFFF0\r\n07610: binary                              ;\r\n07611: if 0 = s 7 then goto 01617          ;\r\n07617: p <- 1                              ; P= 1\r\n07620: load constant 1                     ; C=04000000000010 P= 0\r\n07621: c -> addr                           ;\r\n07622: a exchange c[w]                     ; A=04000000000010 C=04FFFFFFFFFFF0\r\n07623: c -> data register 14               ;\r\n07624: a exchange c[w]                     ; A=04FFFFFFFFFFF0 C=04000000000010\r\n07625: c -> a[s]                           ;\r\n07626: return                              ;\r\n\r\n07445: b -> c[w]                           ; C=04000000000000\r\n07446: jsb 0347                            ;\r\n\r\n; B->C->ram[47]\r\n07747: p <- 1                              ; P= 1\r\n07750: load constant 2                     ; C=04000000000020 P= 0\r\n07751: c -> addr                           ;\r\n07752: b -> c[w]                           ; C=04000000000000\r\n07753: c -> data register 15               ;\r\n07754: return                              ;\r\n\r\n07447: delayed rom 0                       ;\r\n07450: if n\/c goto 0063                    ;\r\n00063: jsb 0323                            ;\r\n\r\n; B->C, ram[47]->B\r\n00323: p <- 1                              ; P= 1\r\n00324: load constant 2                     ; C=04000000000020 P= 0\r\n00325: c -> addr                           ;\r\n00326: data register -> c 15               ; C=04000000000000\r\n00327: b exchange c[w]                     ;\r\n00330: return                              ;\r\n\r\n00064: if n\/c goto 0114                    ;\r\n00114: jsb 0315                            ;\r\n\r\n00315: if 1 = s 2 then goto 00321          ;\r\n00317: if 0 = s 1 then goto 00322          ;\r\n00322: return                              ;\r\n\r\n00115: ...                                 ;\r\n01167: ...                                 ; clear prefixes (s 4,6,7,8,10) and s0,13,14\r\n00120: b -> c[w]                           ;\r\n00121: if 1 = s 2 then goto 00223          ;\r\n00123: 0 -> s 1                            ;\r\n\r\n; A=04FFFFFFFFFFF0 B=04000000000000 C=04000000000000\r\n; M1=00000000000014 S=...3.5...9..C..F f=0\r\n\r\n00124: ...\r\n<\/pre>\n<p><\/code><\/p>\n<h2>Second Digit<\/h2>\n<p>It behaves a little differently if you press another digit key:<br \/>\n<code><\/p>\n<pre>\r\n00173: if 0 = s 15 then goto 00152         ; 5 pressed (S=...3.5...9..C..F)\r\n00175: display off                         ; \r\n00176: ...                                 ; B=04000000000000 C=04000000000000\r\n00222: a -> rom address                    ; A=04FFFFFFFFF330 P= 1\r\n\r\nkey_5:\r\n00463: ...                                 ; C=04000000000005\r\n\r\ndigit:\r\n00745: c + 1 -> c[p]                       ; C=04000000000015 C[1,0]=hex code\r\n00746: ...                                 ; A=04000000000015 M1=04000000000015\r\n06024: b -> c[w]                           ; C=04000000000000\r\n06025: p <- 12                             ; P=12\r\n06026: 0 -> s 11                           ;\r\n06027: a -> rom address                    ;\r\n\r\nhex_1x:\r\n06001: ...\r\n07014: ...                                 ; check 1x, x is 0-9\r\n07164: ...                                 ;\r\n07400: if 1 = s 12 then goto 01417         ;\r\n\r\n; second or later digit (s12 already set)\r\n07417: jsb 0142                            ;\r\n\r\n; ram[30]->C c[0]<>f\r\n07542: p <- 1                              ; P= 1\r\n07543: binary                              ;\r\n07544: load constant 1                     ; C=04000000000010 P= 0\r\n07545: c -> addr                           ;\r\n07546: data register -> c 14               ; C=04FFFFFFFFFFF0\r\n07547: a exchange c[p]                     ; A=04000000000010 C=04FFFFFFFFFFF5\r\n07550: f exch a                            ; (A[0]=0 f=0)\r\n07551: a exchange c[p]                     ; A=04000000000015 C=04FFFFFFFFFFF0\r\n07552: p <- 13                             ; P=13\r\n07553: if c[s] = 0 then goto 01601         ;\r\n07601: binary                              ;\r\n07602: return                              ;\r\n\r\n07420: if 1 = s 4 then goto 01510          ;\r\n\r\n; shift digit from A[0] to correct position\r\n07422: p <- 1                              ; P= 1\r\n07423: c + 1 -> c[p]                       ; C=04FFFFFFFFFF00\r\n07424: if n\/c goto 0051                    ;\r\n07425: shift left a[w]                     ; A=40000000000150\r\n07426: p + 1 -> p                          ; P= 2\r\n07427: if p # 13 then goto 01423           ;\r\n07423: ...                                 ; C=04FFFFFFFFF000 A=00000000001500 P= 3\r\n07423: ...                                 ; C=04FFFFFFFF0000 A=00000000015000 P= 4\r\n07423: ...                                 ; C=04FFFFFFF00000 A=00000000150000 P= 5\r\n07423: ...                                 ; C=04FFFFFF000000 A=00000001500000 P= 6\r\n07423: ...                                 ; C=04FFFFF0000000 A=00000015000000 P= 7\r\n07423: ...                                 ; C=04FFFF00000000 A=00000150000000 P= 8\r\n07423: ...                                 ; C=04FFF000000000 A=00001500000000 P= 9\r\n07423: ...                                 ; C=04FF0000000000 A=00015000000000 P=10\r\n07423: ...                                 ; C=04F00000000000 A=00150000000000 P=11\r\n07423: ...                                 ; C=04000000000000 A=01500000000000 P=12\r\n07423: ...                                 ; C=05000000000000\r\n07424: if n\/c goto 0051                    ;\r\n; exited loop before P=13 (12) because found non-F value at C[12]\r\n07451: c - 1 -> c[p]                       ; C=04000000000000, put value back\r\n07452: if p # 3 then goto 01457            ;\r\n07457: if 1 = s 7 then goto 01431          ;\r\n;\r\n; f++ \r\n07461: f exch a                            ;\r\n07462: a + 1 -> a[x]                       ; A=01500000000001\r\n07463: f exch a                            ; A=01500000000000 f=1\r\n07464: if n\/c goto 0031                    ;\r\n;\r\n07431: p - 1 -> p                          ; P=11\r\n07432: a exchange c[wp]                    ; A=01000000000000 C=04500000000000\r\n07433: p - 1 -> p                          ; P=10\r\n07434: c -> a[w]                           ; A=04500000000000\r\n07435: c - 1 -> c[wp]                      ; C=045FFFFFFFFFFF\r\n07436: a exchange c[x]                     ; A=04500000000FFF C=045FFFFFFFF000\r\n07437: if a[m] # 0 then goto 01465         ;\r\n07465: jsb 0067                            ;\r\n\r\n; looks like it adjusts exponent for precision (f) and\r\n; normalizes - don't want C[12] (first digit) =0\r\n07467: a exchange b[x]                     ; A=04500000000000 B=04000000000FFF\r\n07470: decimal                             ;\r\n07471: 0 -> a[x]                           ;\r\n07472: f -> a                              ; A=04500000000001\r\n07473: a + c -> c[x]                       ; C=045FFFFFFFF001\r\n07474: p <- 12                             ; P=12\r\n07475: if c[p] # 0 then goto 01505         ;\r\n07505: a exchange b[x]                     ; A=04500000000FFF B=04000000000001\r\n07506: binary                              ;\r\n07507: return                              ;\r\n\r\n07466: if n\/c goto 0041                    ;\r\n07441: a exchange c[ms]                    ; A=045FFFFFFFFFFF C=04500000000001\r\n07442: ...                                 ; C->B B=04500000000001\r\n07444: jsb 0203                            ;\r\n\r\n; A[0]=f; A->ram[30]\r\n07603: if 0 = s 4 then goto 01607          ;\r\n07607: f -> a                              ; A=045FFFFFFFFFF1\r\n07610: binary                              ;\r\n07611: if 0 = s 7 then goto 01617          ;\r\n07617: p <- 1                              ; P= 1\r\n07620: load constant 1                     ; C=04500000000011 P= 0\r\n07621: c -> addr                           ;\r\n07622: a exchange c[w]                     ; A=04500000000011 C=045FFFFFFFFFF1\r\n07623: c -> data register 14               ;\r\n07624: a exchange c[w]                     ; A=045FFFFFFFFFF1 C=04500000000011\r\n07625: c -> a[s]                           ;\r\n07626: return                              ;\r\n\r\n07445: ...                                 ; B->C C=04500000000001\r\n07747: ...                                 ; B->C->ram[47], P=0\r\n00323: ...                                 ; B->C, ram[47]->B, P=0\r\n00115: ...                                 ;\r\n01167: ...                                 ; clear prefixes (s 4,6,7,8,10) and s0,13,14\r\n00120: ...                                 ;\r\n\r\n; A=045FFFFFFFFFF1 B=04000000000001 C=04500000000001\r\n; M1=04000000000015 S=...3.5...9..C..F f=1\r\n\r\n00124: ...\r\n; M1=04500000000001\r\n; C=04500000000001 B=20900000000000 A=045FFFFFFFFF00 P=11\r\n\r\n00144: cpu woodstock                       ;\r\n00145: display off                         ;\r\n00146: display toggle                      ;\r\n00147: 0 -> s 15                           ; S=...3.5...9..C...\r\n00150: if 1 = s 15 then goto 00147         ;\r\n00152: ...\r\n<\/pre>\n<p><\/code><\/p>\n<h2>Press Dot<\/h2>\n<p>At some point, we press dot to mark the decimal point.<br \/>\n<code><\/p>\n<pre>\r\n00173: if 0 = s 15 then goto 00152         ; S=...3.5...9..C..F (dot pressed)\r\n00175: display off                         ;\r\n00176: ...                                 ; B=04500000000001 C=04500000000000 P=1\r\n00222: a -> rom address                    ; A=045FFFFFFFF2E0\r\n\r\nkey_dot:\r\n00456: ...                                 ; C=0450000000001A P=1\r\n01167: ...                                 ; clear prefixes (s 4,6,7,8,10) and s0,13,14\r\n00565: ...                                 ; A=0450000000001A\r\n00566: ...                                 ; C=04500000000001 M1=0450000000001A\r\n01167: ...                                 ; clear prefixes (s 4,6,7,8,10) and s0,13,14\r\n06021: ...\r\n06025: p <- 12                             ; P=12\r\n06026: 0 -> s 11                           ;\r\n06027: a -> rom address                    ; A=0450000000001A\r\n\r\nhex_1x:\r\n06001: ...                                 ; dot is hex code 1A \r\n07014: ...                                 ; check 1x, x is 0-9 - it's not\r\n07025: ...                                 ; A=450000000001A0\r\n07027: a -> rom address                    ;\r\n\r\nfunc_dot:\r\n07032: ...                                 ;\r\n07627: if 1 = s 12 then goto 01635         ; if input_mode (yes)\r\n07635: jsb 0142                            ;\r\n\r\n; ram[30]->C, mainly\r\n07542: p <- 1                              ; P= 1\r\n07543: binary                              ;\r\n07544: load constant 1                     ; C=04500000000011 P= 0\r\n07545: c -> addr                           ;\r\n07546: data register -> c 14               ; C=045FFFFFFFFFF1\r\n07547: a exchange c[p]                     ; A=450000000001A1 C=045FFFFFFFFFF0\r\n07550: f exch a                            ; (A[0]=1 f=1)\r\n07551: a exchange c[p]                     ; A=450000000001A0 C=045FFFFFFFFFF1\r\n07552: p <- 13                             ; P=13\r\n07553: if c[s] = 0 then goto 01601         ;\r\n07601: binary                              ;\r\n07602: return                              ;\r\n\r\n07636: 1 -> s 7                            ; S=...3.5.7.9..C..F\r\n07637: a exchange c[w]                     ; A=045FFFFFFFFFF1 C=450000000001A0\r\n07640: b -> c[w]                           ; C=04500000000001\r\n07641: if 0 = s 4 then goto 01444          ;\r\n07444: jsb 0203                            ;\r\n\r\n; A[0]=f; A->ram[30]\r\n07603: if 0 = s 4 then goto 01607          ;\r\n07607: f -> a                              ;\r\n07610: binary                              ;\r\n07611: if 0 = s 7 then goto 01617          ;\r\n07613: a + 1 -> a[s]                       ; A=145FFFFFFFFFF1\r\n07614: if 0 = s 4 then goto 01617          ;\r\n07617: p <- 1                              ; P= 1\r\n07620: load constant 1                     ; C=04500000000011 P= 0\r\n07621: c -> addr                           ;\r\n07622: a exchange c[w]                     ; A=04500000000011 C=145FFFFFFFFFF1\r\n07623: c -> data register 14               ;\r\n07624: a exchange c[w]                     ; A=145FFFFFFFFFF1 C=04500000000011\r\n07625: c -> a[s]                           ; A=045FFFFFFFFFF1\r\n07626: return                              ;\r\n\r\n07445: b -> c[w]                           ; C=04500000000001\r\n07446: ...                                 ; B->ram[47]\r\n07447: delayed rom 0                       ;\r\n07450: if n\/c goto 0063                    ;\r\n00063: ...                                 ; ram[47]->B\r\n00064: ...                                 ;\r\n01167: ...                                 ; clear prefixes (s 4,6,7,8,10) and s0,13,14\r\n00120: ...                                 ;\r\n\r\n; A=045FFFFFFFFFF1 B=04500000000001 C=04500000000001\r\n; S=...3.5...9..C..F f=1\r\n\r\n00124: ...\r\n\r\n; A=045FFFFFFFFF00 B=20900000000000 C=04500000000001\r\n; M1=04500000000001 P=11\r\n\r\n00144: cpu woodstock                       ;\r\n00145: display off                         ;\r\n00146: display toggle                      ;\r\n00147: 0 -> s 15                           ; S=...3.5...9..C...\r\n00150: if 1 = s 15 then goto 00147         ;\r\n00152: ...\r\n<\/pre>\n<p><\/code><\/p>\n<h2>Press 6<\/h2>\n<p><code><\/p>\n<pre>\r\n00173: if 0 = s 15 then goto 00152         ; S=...3.5...9..C..F\r\n00175: display off                         ;\r\n00176: ...                                 ; B=04500000000001 C=04500000000000 P= 1\r\n00222: a -> rom address                    ; A=045FFFFFFFF320 (0x32=062)\r\n\r\nkey_6:                                     ; (s13 gets set if digit>5, see prefixes)\r\n00462: ...                                 ; S=...3.5...9..CD.F C=04500000000006\r\n\r\ndigit:\r\n00745: c + 1 -> c[p]                       ; C=04500000000016 (hex code)\r\n00746: ...                                 ;\r\n01167: ...                                 ; clear prefixes (s 4,6,7,8,10) and s0,13,14\r\n01177: ...                                 ; S=...3.5...9..C..F\r\n00563: ...                                 ; A=04500000000016 M1=04500000000016\r\n01167: ...                                 ; clear prefixes (s 4,6,7,8,10) and s0,13,14\r\n00570: ...                                 ; B->C=04500000000001\r\n06025: p <- 12                             ; P=12\r\n06026: 0 -> s 11                           ;\r\n06027: a -> rom address                    ;\r\n\r\nhex_1x:\r\n06001: ...                                 ;\r\n07014: ...                                 ; check 1x, x is 0-9\r\n07164: ...                                 ;\r\n07400: if 1 = s 12 then goto 01417         ; if not first digit - true, go\r\n\r\n; second or later digit (s12 already set)\r\n07417: jsb 0142                            ; ram[30]->C, C[0]<>f s7=(dot?)1:0\r\n07542: p <- 1                              ; P= 1\r\n07543: binary                              ;\r\n07544: load constant 1                     ; C=04500000000011 P= 0\r\n07545: c -> addr                           ;\r\n07546: data register -> c 14               ; C=145FFFFFFFFFF1\r\n07547: a exchange c[p]                     ; A=04500000000011 C=145FFFFFFFFFF6\r\n07550: f exch a                            ;\r\n07551: a exchange c[p]                     ; A=04500000000016 C=145FFFFFFFFFF1\r\n07552: p <- 13                             ; P=13\r\n07553: if c[s] = 0 then goto 01601         ;\r\n07555: c - 1 -> c[s]                       ; C=045FFFFFFFFFF1\r\n07556: if c[s] # 0 then goto 01562         ;\r\n07560: 1 -> s 7                            ; S=...3.5.7.9..C..F\r\n07561: if n\/c goto 0201                    ;\r\n07601: binary                              ;\r\n07602: return                              ;\r\n; note ram[30][s]==1 so s7 got set\r\n\r\n07420: if 1 = s 4 then goto 01510          ;\r\n\r\n; shift digit from A[0] to correct position\r\n07422: p <- 1                              ; P= 1\r\n07423: c + 1 -> c[p]                       ; C=045FFFFFFFFF01\r\n07424: if n\/c goto 0051                    ;\r\n07425: shift left a[w]                     ; A=45000000000160\r\n07426: p + 1 -> p                          ; P= 2\r\n07427: if p # 13 then goto 01423           ;\r\n07423: ...                                 ; C=045FFFFFFFF001 A=50000000001600 P= 3\r\n07423: ...                                 ; C=045FFFFFFF0001 A=00000000016000 P= 4\r\n07423: ...                                 ; C=045FFFFFF00001 A=00000000160000 P= 5\r\n07423: ...                                 ; C=045FFFFF000001 A=00000001600000 P= 6\r\n07423: ...         ]                       ; C=045FFFF0000001 A=00000016000000 P= 7\r\n07423: ...                                 ; C=045FFF00000001 A=00000160000000 P= 8\r\n07423: ...                                 ; C=045FF000000001 A=00001600000000 P= 9\r\n07423: ...                                 ; C=045F0000000001 A=00016000000000 P=10\r\n07423: ...                                 ; C=04500000000001 A=00160000000000 P=11\r\n07423: c + 1 -> c[p]                       ; C=04600000000001\r\n07424: if n\/c goto 0051                    ;\r\n; exit loop\r\n07451: c - 1 -> c[p]                       ; C=04500000000001, put value back\r\n07452: if p # 3 then goto 01457            ;\r\n07457: if 1 = s 7 then goto 01431          ; if dot_pressed (yes, go)\r\n;\r\n; NOTE: skipping bit that incremented f with each digit\r\n;\r\n07431: p - 1 -> p                          ; P=10\r\n07432: a exchange c[wp]                    ; A=00100000000001 C=04560000000000\r\n07433: p - 1 -> p                          ; P= 9\r\n07434: c -> a[w]                           ; A=04560000000000\r\n07435: c - 1 -> c[wp]                      ; C=0456FFFFFFFFFF\r\n07436: a exchange c[x]                     ; A=04560000000FFF C=0456FFFFFFF000\r\n07437: if a[m] # 0 then goto 01465         ;\r\n07465: jsb 0067                            ;\r\n\r\n; looks like it adjusts exponent for precision (f) and\r\n; normalizes - don't want C[12] (first digit) =0\r\n07467: a exchange b[x]                     ; A=04560000000001 B=04500000000FFF\r\n; b[x] is the exponent we had last time, 001, for 045... = 4.5e1 = \"45.\"\r\n07470: decimal                             ;\r\n07471: 0 -> a[x]                           ; A=04560000000000\r\n07472: f -> a                              ; A=04560000000001 (f is still 1)\r\n07473: a + c -> c[x]                       ; C=0456FFFFFFF001 \"45.6 blanks\"\r\n07474: p <- 12                             ; P=12\r\n07475: if c[p] # 0 then goto 01505         ; mantissa in range 1-9, ok\r\n07505: a exchange b[x]                     ; A=04560000000FFF B=04500000000001\r\n07506: binary                              ;\r\n07507: return                              ;\r\n\r\n07466: if n\/c goto 0041                    ;\r\n07441: a exchange c[ms]                    ; A=0456FFFFFFFFFF C=04560000000001\r\n07442: b exchange c[w]                     ; B=04560000000001 C=04500000000001\r\n07443: b -> c[w]                           ; C=04560000000001\r\n; A is displayable. B & C have X value\r\n07444: jsb 0203                            ;\r\n\r\n; save display value and info in ram[30]\r\n07603: if 0 = s 4 then goto 01607          ;\r\n07607: f -> a                              ; A=0456FFFFFFFFF1\r\n07610: binary                              ;\r\n07611: if 0 = s 7 then goto 01617          ; if not dot_pressed (no - stay)\r\n07613: a + 1 -> a[s]                       ; A=1456FFFFFFFFF1 (flag, A[s]=1)\r\n07614: if 0 = s 4 then goto 01617          ;\r\n; A->ram[30] (A[s] is flag: 1 if dot pressed. A[0]=dot position. Rest: displayable\r\n07617: p <- 1                              ; P= 1\r\n07620: load constant 1                     ; C=04560000000011 P= 0\r\n07621: c -> addr                           ; addr=16\r\n07622: a exchange c[w]                     ; A=04560000000011 C=1456FFFFFFFFF1\r\n07623: c -> data register 14               ;\r\n07624: a exchange c[w]                     ; A=1456FFFFFFFFF1 C=04560000000011\r\n07625: c -> a[s]                           ; A=0456FFFFFFFFF1\r\n07626: return                              ;\r\n\r\n07445: ...                                 ; B->C C=04560000000001\r\n07747: ...                                 ; B->C, C->ram[47], P= 0\r\n00323: ...                                 ; B->C, ram[47]->B, P= 0\r\n00115: ...                                 ;\r\n01167: ...                                 ; clear prefixes (s 4,6,7,8,10) and s0,13,14\r\n00120: ...                                 ;\r\n\r\n; A=0456FFFFFFFFF1 B=04560000000001 C=04560000000001\r\n; M1=04500000000016 S=...3.5...9..C..F f=1\r\n\r\n00124: ...\r\n; M1=04560000000001\r\n; C=04560000000001 B=20900000000000 A=0456FFFFFFFF00 P=11\r\n\r\n00144: cpu woodstock                       ;\r\n00145: display off                         ;\r\n00146: display toggle                      ;\r\n00147: 0 -> s 15                           ; S=...3.5...9..C...\r\n00150: if 1 = s 15 then goto 00147         ;\r\n00152: ...\r\n<\/pre>\n<p><\/code><\/p>\n<h2>Press 7<\/h2>\n<p><code><\/p>\n<pre>\r\n00152: 0 -> s 1                            ; 7 pressed (S=...3.5...9..C..F)\r\n00153: 0 -> s 3                            ;\r\n00154: if 0 = s 3 then goto 00163          ;\r\n00156: if 0 = s 11 then goto 00165         ;\r\n00165: 0 -> s 5                            ;\r\n00166: if 1 = s 5 then goto 00173          ;\r\n00173: if 0 = s 15 then goto 00152         ;\r\n00175: display off                         ;\r\n00176: ...                                 ; B=04560000000001 C=04560000000000\r\n00222: a -> rom address                    ; (A=0456FFFFFFF200 P= 1)\r\n\r\nkey_7:\r\n00440: ...                                 ; S=...3.5...9..CD.F C=04560000000007\r\n\r\ndigit:\r\n00745: c + 1 -> c[p]                       ; C=04560000000017 C[1,0]=hex code\r\n00746: ...                                 ; S=...3.5...9..C..F\r\n00565: ...                                 ; A=04560000000017 M1=04560000000017\r\n06024: b -> c[w]                           ; C=04560000000001\r\n06025: p <- 12                             ; P=12\r\n06026: 0 -> s 11                           ;\r\n06027: a -> rom address                    ;\r\n\r\nhex_1x:\r\n06001: ...                                 ;\r\n07014: ...                                 ; check 1x, x is 0-9\r\n07164: ...                                 ;\r\n07400: if 1 = s 12 then goto 01417         ;\r\n\r\n07417: jsb 0142                            ;\r\n\r\n; get last display value and settings (decimal point & position) from ram[30]\r\n; put decimal point position in f (4: 0->f, 45: 1->f, 452: 2->f, etc)\r\n; set s7 if dot was pressed already\r\n; fix c[s] given dot_pressed was stored there in ram[30]\r\n07542: p <- 1                              ; P= 1\r\n07543: binary                              ;\r\n07544: load constant 1                     ; C=04560000000011 P= 0\r\n07545: c -> addr                           ;\r\n07546: data register -> c 14               ; C=1456FFFFFFFFF1\r\n07547: a exchange c[p]                     ; A=04560000000011 C=1456FFFFFFFFF7\r\n07550: f exch a                            ; (f is 1)\r\n07551: a exchange c[p]                     ; A=04560000000017 C=1456FFFFFFFFF1\r\n07552: p <- 13                             ; P=13\r\n07553: if c[s] = 0 then goto 01601         ;\r\n07555: c - 1 -> c[s]                       ; C=0456FFFFFFFFF1\r\n07556: if c[s] # 0 then goto 01562         ;\r\n07560: 1 -> s 7                            ; S=...3.5.7.9..C..F\r\n07561: if n\/c goto 0201                    ;\r\n07601: binary                              ;\r\n07602: return                              ;\r\n\r\n07420: if 1 = s 4 then goto 01510          ;\r\n\r\n; shift digit from A[0] to correct position\r\n07422: p <- 1                              ; P= 1\r\n07423: c + 1 -> c[p]                       ; C=0456FFFFFFFF01\r\n07424: if n\/c goto 0051                    ;\r\n07425: shift left a[w]                     ; A=45600000000170\r\n07426: p + 1 -> p                          ; P= 2\r\n07427: if p # 13 then goto 01423           ;\r\n07423: ...                                 ; C=0456FFFFFFF001 A=56000000001700 P= 3\r\n07423: ...                                 ; C=0456FFFFFF0001 A=60000000017000 P= 4\r\n07423: ...                                 ; C=0456FFFFF00001 A=00000000170000 P= 5\r\n07423: ...                                 ; C=0456FFFF000001 A=00000001700000 P= 6\r\n07423: ...                                 ; C=0456FFF0000001 A=00000017000000 P= 7\r\n07423: ...                                 ; C=0456FF00000001 A=00000170000000 P= 8\r\n07423: ...                                 ; C=0456F000000001 A=00001700000000 P= 9\r\n07423: ...                                 ; C=04560000000001 A=00017000000000 P=10\r\n07423: c + 1 -> c[p]                       ; C=04570000000001\r\n07424: if n\/c goto 0051                    ;\r\n; exit loop\r\n07451: c - 1 -> c[p]                       ; C=04560000000001, put value back\r\n07452: if p # 3 then goto 01457            ;\r\n07457: if 1 = s 7 then goto 01431          ; if dot_pressed (yes, go)\r\n;\r\n; NOTE: skipping bit that incremented f with each digit\r\n;\r\n07431: p - 1 -> p                          ; P= 9\r\n07432: a exchange c[wp]                    ; A=00010000000001 C=04567000000000\r\n07433: p - 1 -> p                          ; P= 8\r\n07434: c -> a[w]                           ; A=04567000000000\r\n07435: c - 1 -> c[wp]                      ; C=04567FFFFFFFFF\r\n07436: a exchange c[x]                     ; A=04567000000FFF C=04567FFFFFF000\r\n07437: if a[m] # 0 then goto 01465         ;\r\n07465: jsb 0067                            ;\r\n\r\n; looks like it adjusts exponent for precision (f) and\r\n; normalizes - don't want C[12] (first digit) =0\r\n07467: a exchange b[x]                     ; A=04567000000001 B=04560000000FFF\r\n07470: decimal                             ;\r\n07471: 0 -> a[x]                           ; A=04567000000000\r\n07472: f -> a                              ; A=04567000000001 (f still 1)\r\n07473: a + c -> c[x]                       ; C=04567FFFFFF001 \"45.67 blanks\"\r\n07474: p <- 12                             ; P=12\r\n07475: if c[p] # 0 then goto 01505         ; mantissa in range 1-9, ok\r\n07505: a exchange b[x]                     ; A=04567000000FFF B=04560000000001\r\n07506: binary                              ;\r\n07507: return                              ;\r\n\r\n07466: if n\/c goto 0041                    ;\r\n07441: a exchange c[ms]                    ; A=04567FFFFFFFFF C=04567000000001\r\n07442: b exchange c[w]                     ; B=04567000000001 C=04560000000001\r\n07443: b -> c[w]                           ; C=04567000000001\r\n; A is displayable. B & C have X value\r\n07444: jsb 0203                            ;\r\n\r\n; save display value and info in ram[30]\r\n07603: ...                                 ; ram[30]=14567FFFFFFFF1 dot_pressed e1\r\n       ...                                 ; A=04567FFFFFFFF1 C=04567000000011 P= 0\r\n07626: return                              ;\r\n\r\n07445: ...                                 ; B->C, C=04567000000001\r\n07747: ...                                 ; B->C, C->ram[47], P= 0\r\n00323: ...                                 ; B->C, ram[47]->B, P= 0\r\n00115: ...                                 ;\r\n01167: ...                                 ; clear prefixes (s 4,6,7,8,10) and s0,13,14\r\n\r\n00120: ...\r\n\r\n; A=04567FFFFFFFF1 B=04567000000001 C=04567000000001 \r\n; M1=04560000000017 S=...3.5...9..C..F f=1\r\n\r\n00124: ...\r\n; M1=04567000000001\r\n; C=04567000000001 B=20900000000000 A=04567FFFFFFF00 P=11\r\n\r\n00144: cpu woodstock                       ;\r\n00145: display off                         ;\r\n00146: display toggle                      ;\r\n00147: 0 -> s 15                           ; S=...3.5...9..C...\r\n00150: if 1 = s 15 then goto 00147         ;\r\n00152: ...\r\n<\/pre>\n<p><\/code><\/p>\n<p>That was a summary. The real thing (<a href=\"http:\/\/www.sydneysmith.com\/products\/hp29u\/downloads\/logs\/45dot67.txt\" rel=\"noopener\" target=\"_blank\">45dot67.txt<\/a>) is even longer.<\/p>\n<p>I&#8217;ve also skipped what happens if you start with dot, press CHS in the middle of the above, or press EEX.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you press digits on the HP-29C, you go into &#8220;Input Mode&#8221;. What is that, and how does it work?<\/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\/2149"}],"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=2149"}],"version-history":[{"count":3,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2149\/revisions"}],"predecessor-version":[{"id":2152,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2149\/revisions\/2152"}],"wp:attachment":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}