# Golden ratio, 336 decimals (the stock-size program) on the HP-16C CE with our
# extended-memory firmware. The memory file holds Program E only. As in the published
# instructions, Program E is run first, then cleared, and Program D is keyed in.
# This shows a longer key script, including keying in a program.
# Run:  cargo run -- --firmware YOUR-16C-FIRMWARE.bin --test examples/phi-336-ext.txt
load ../samples/phi-336-programE-ext-ready.16cmem
fmem = P-0 r-0168
keys 1 STO SST                 # 1 STO I
keys 323680 g 8                # 2890 x 112, g ABS: copies it to LAST X
keys GSB E                     # runs until it stops with 0
expect 0 d
keys 20 STO SST 2890 ENTER 3230 STO 0 GSB C    # final pass: 20 STO I, 2890 ENTER, 3230 STO 0, GSB C
expect 0 d
# f CLEAR PRGM in program mode, then key in Program D (26 lines)
keys g R/S f R↓
keys g GTO D  RCL 1  1  f D  +  STO 1
keys g GTO 2  2 0  STO SST  0
keys g GTO 1  RCL R/S  RCL 0  g ×  R↓  +  STO R/S  g BSP  g C  g R↓  +  g HEX  GTO 1
keys R/S  GTO 2
keys g R/S g GSB               # run mode, g RTN (pointer to line 000)
fmem = P-2 r-0172             # Program D keyed in, registers kept
keys 100000000 STO 0
keys GSB D                     # decimals 1-8 of phi = 1.61803398...
expect 61803398 d
keys R/S
expect 87498948 d
keys R/S
expect 48204586 d
keys R/S
expect 83436563 d
keys R/S
expect 81177203 d
keys R/S                       # 09179805: the leading zero is not shown
expect 9179805 d
