HP-29C and s9

There are a series of “s flags” 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 the s9 flag but never even mentioned it. Here’s the detail.

We were in rcl_2.txt and skipped over what happens after we press the “2”. Here’s a summary of some of it:

key_2:
00444: ...
00751: a + c -> c[wp]                      ; C=00000000000092
00752: ...
06027: a -> rom address                    ; A=...92, 0x9=1001=011
06011: ...                                 ; hex codes 90..9F (RCL 0-.5)
06270: 0 -> c[p]                           ; C=00000000000002 (0-.5 to 0-F)
06271: c -> addr                           ;
06272: data register -> c 0                ; C=00000000000000 (RCL 2)
06273: ...
06250: if 0 = s 9 then goto 00253          ;
06252: c -> stack                          ;
06253: ...
00070: 1 -> s 9                            ;
00071: ...

00124: 0 -> s 11                           ;


You 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 “c -> stack” bit gets skipped.

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’t happen are if we’d just pressed CLx or ENTER.

The s9 flag is looking very much like the “auto_enter” flag.

In CLx, you’ll see:

key_clx:
00505: if 0 = s 4 then goto 00535          ;
00535: ...                                 ; C=05600000000004 (hex code 04)
00565: c -> a[w]                           ; A=05600000000004
00566: ...                                 ; C=05600000000000 M1=05600000000004
06027: a -> rom address                    ;

hex_0x:
06000: if n/c goto 0034                    ;
06034: decimal                             ;
06035: shift left a[x]                     ; A=05600000000040
06036: delayed rom 13                      ;
06037: a -> rom address                    ;

func_clx:
06404: if n/c goto 0357                    ;
06757: if 0 = s 12 then goto 00762         ;
06762: delayed rom 4                       ;
06763: jsb 0235                            ; ram[46] -> c
02235: ...                                 ; P=0 C=03493428400200
02241: return                              ;
06764: 0 -> c[w]                           ; C=00000000000000
06765: c -> data register 15               ; 0 -> ram[47], X
06766: if n/c goto 0311                    ;
06711: 0 -> s 9                            ; S=...3.5.........F
06712: ...
00062: 0 -> s 12                           ;
00063: jsb 0323                            ; c -> b; LastX -> c
00323: ...                                 ; B=00000000000000 C=05600000000000
00330: return                              ;
00064: if n/c goto 0114                    ;
00114: jsb 0315                            ;
00315: if 1 = s 2 then goto 00321          ;
00317: if 0 = s 1 then goto 00322          ;
00322: return                              ;
00115: binary                              ;
00116: delayed rom 2                       ;
00117: jsb 0167                            ; clear prefixes & s 0,13,14
01167: ...
01177: return                              ;
00120: b -> c[w]                           ; C=00000000000000
00121: if 1 = s 2 then goto 00223          ;
00123: 0 -> s 1                            ;

00124: ...


key_clx sets the hex code (04) and then jumps to a routine for codes 00-0F.

That jumps to a routine for hex code 04, func_clx.

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’t need it, and finishes with 0 in C.

The microcode for ENTER is (see 4_ent.txt):

func_enter: ; (hex code 01)
06401: if n/c goto 0307                    ;
06707: b -> c[w]                           ;
06710: c -> stack                          ; D=04000000000000 E=01000000000000
06711: 0 -> s 9                            ; S=...3.5......C..F
06712: ...

00124: ...


You can see the main actions are: push the stack (E->F, D->E, C->D) and clear s9.

It goes on to do other things, but these are what we’re interested in here.

s9 is the auto_enter flag.

For a higher level view, here’s 4 ENTER 5 ADD and the register values at the wait loop:

(power on)    C=00000000000000 S =...3.5...9......
(press 4)     C=04000000000000 S =...3.5...9..C...
(press ENTER) C=04000000000000 S =...3.5..........
(press 5)     C=05000000000000 S =...3.5...9..C...
(press +)     C=09000000000000 S =...3.5...9......

It's only fair to share...Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUponDigg thisPin on PinterestEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *