The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

[WP34S] Stack size impact on speed? SSIZE4.
Message #1 Posted by Chris Tvergard on 11 May 2012, 11:48 p.m.

Do the built-in functions ever benefit from a stack size of 8?

I need some more data registers in addition to the R00-R99, like the A thru D and don't mind calling the SSIZE4.

Thanks in advance.

      
Re: [WP34S] Stack size impact on speed? SSIZE4.
Message #2 Posted by Les Wright on 12 May 2012, 12:12 a.m.,
in response to message #1 by Chris Tvergard

SSIZE4 is the default. You don't have to call anything unless SSIZE8 was set by you or a program.

Keep in mind that besides the 112 dedicated registers (00-99, XYZT, A-D, I-L), you can access even more registers by indirection (and the first 16 of them directly) by allocating them via the LocR command. You are restricted to 256 registers in total (global numbered, stack, lettered, locally declared), but this is often less if RAM is used by program lines, stats registers if a stats summation has begun and the dedicated registers have not been deallocated by CLSigma, you have DBLON set, etc.

This is discussed in Appendix B and at page 20 of the most recent manual. There is even a formula to compute memory usage according to one's needs.

I would suggest that if you need to maximize your register usage, you store and run your program from the flash library, where there is gobs of program memory (over 6000 words at present), delete it and all programs from RAM so that you can access all of the registers in RAM that you can. In my opinion, it wise to learn how to assemble flash libraries from code listing for testing in the emulator before you move things onto the calculator. I would find it really frustrating to recall code to RAM for editing, save it back to flash, delete the RAM copy, retest, etc. I would sooner edit my text listing, rebuild wp34s-lib.dat, test in the emulator, and when ready concatenate the wp34s-lib.dat file to calc.bin before flashing over to the calculator. This is actually what I do with every firmware upgrade. I don't have any important programs in RAM.

Not sure what you means by "do the built-in functions benefit".

Les

            
Re: [WP34S] Stack size impact on speed? SSIZE4.
Message #3 Posted by Paul Dale on 12 May 2012, 12:20 a.m.,
in response to message #2 by Les Wright

Quote:
You are restricted to 256 registers in total (global numbered, stack, lettered, locally declared),...

You can bypass this limit too -- nested functions can each have their own local variables and, although not all will be visible at the same time, you will have more than 256 in total.

- Pauli

            
Re: [WP34S] Stack size impact on speed? SSIZE4.
Message #4 Posted by Chris Tvergard on 12 May 2012, 1:52 p.m.,
in response to message #2 by Les Wright

Les,

Thanks for your highly detailed response. I overlooked your msg. at first as there were several responses. Please look at my response adjacent to your message. I apologize for not addressing it to your name as well. Your entry is of significant help to me.

People like you helping out beginners and contributing to this great 34S project are fantastic!

Thanks.

Chris

      
Re: [WP34S] Stack size impact on speed? SSIZE4.
Message #5 Posted by Paul Dale on 12 May 2012, 12:21 a.m.,
in response to message #1 by Chris Tvergard

Benefit from? No. All built in functions can exist in a four level stack. You, the user, benefit from the extra stack levels.

If you need more registers, local registers are most likely the way forward.

- Pauli

            
Re: [WP34S] Stack size impact on speed? SSIZE4.
Message #6 Posted by Walter B on 12 May 2012, 3:42 a.m.,
in response to message #5 by Paul Dale

Depends. If you are doing complex stuff (mathematically ;-) ) then 8 stack levels are very beneficial. I guess that financial guessing won't need 8 levels but you will know better.

      
Re: [WP34S] Stack size impact on speed? SSIZE4.
Message #7 Posted by Paul Dale on 12 May 2012, 1:47 a.m.,
in response to message #1 by Chris Tvergard

The speed difference between SSIZE 4 and SSIZE 8 will be unnoticeable. The CPU in the 34S is sufficient fast that copying small amount of memory around takes essentially zero time. In fact, copying large amounts of memory takes close enough to zero time too.

In other words, I very much doubt you'll notice a performance difference between a four level and an eight level stack.

- Pauli

            
Re: [WP34S] Stack size impact on speed? SSIZE4.
Message #8 Posted by Chris Tvergard on 12 May 2012, 1:42 p.m.,
in response to message #7 by Paul Dale

Thanks Les, Paul, and Walter,

I greatly appreciate your responses. I apologize for asking these beginner's questions but I'm so excited about the 34S I just can't let it go.

After reading your responses I have studied the LocR concept and tried to PSTO my LBL A1 to Flash LIB.

Question 1: The Lib shows A1 and I ran it from there. But there is no way I can figure out how to later delete A1 from the Lib? (I searced for words in the PDF manual but I can't find any delete function for Lib prgms. Where is it, please?) Absolutely, the LocR is definitely the way to double my data regs!

Question 2: Due to my inexperience I occasionally quasi lock up the calculator and it shows "D" in the top left corner and I am unable to run any program like LBL A (button A) - it says Lbl A does not exist, but it is in there. I have to reset the 34S and lose my Lib A1 in the process. This has happened 4 or 5 times.

I desparately need more data storage for my Monte Carlo runs, the accuracy greatly increases with more regs. Unlike in physics and in mathematical modeling of human behavior where I needed 10,000 runs in MC, stock and option strike prices are happy with a few hundred runs for my use. So getting the extra 127 or so LocR regs by indirect calling is a significant increase in predictability. That's why the 34S is also the world's best business calculator by far! Good job you guys!

Again, thanks for your detailed response, now I need to follow through. Question 2, however, is a source of concern as I lose large programs entirely.

Chris

Edited: 12 May 2012, 1:56 p.m.

                  
Re: [WP34S] Stack size impact on speed? SSIZE4.
Message #9 Posted by Marcus von Cube, Germany on 12 May 2012, 3:41 p.m.,
in response to message #8 by Chris Tvergard

A few remarks:

D indicates double precision mode. Use the CPX h P.FCN catalogue to find DBLOFF to return to normal mode.

If you want to run a program in RAM with hot keys enabled and you cannot seemingly start it than the reason normally is that the program counter simply does not point to a program line in your program. Press h P/R to check this. In order to force the program counter within a specific program, use h CAT and position to the program in question (with ENTER). If it's in RAM, a simple g RTN will do instead.

With CAT you can easily delete programs from the library by pressing f CLP while CAT is active and you are positioned on the program to be deleted.

I hope this helps.

Edited: 12 May 2012, 3:42 p.m.

                        
Re: [WP34S] Stack size impact on speed? SSIZE4.
Message #10 Posted by Chris Tvergard on 12 May 2012, 5:34 p.m.,
in response to message #9 by Marcus von Cube, Germany

Marcus,

Thanks for your excellent response. I follow most of you 34S developers on the HHC YouTube videos by hpcalc.org, as well as in this forum reading the interesting development cycle discussions you conduct. I am honored to hear from you all one by one.

I most certainly will try your suggestions. I am getting frustrated by losing my 150 lines of code due to my own ignorance. I thought it may have something to do with flags so I tried cfall etc., and some other things. But not the things you now suggest.

Thanks, and your HHC videos are most informative.

Chris

                        
Re: [WP34S] Stack size impact on speed? SSIZE4.
Message #11 Posted by Chris Tvergard on 12 May 2012, 10:46 p.m.,
in response to message #9 by Marcus von Cube, Germany

Marcus,

Somehow a small test program Lbl A1 ended up in the bup memory. When I hCAT to it and do fClp Sure? do fENTER Y it says it is write protected.

Chris

                              
Re: [WP34S] Stack size impact on speed? SSIZE4.
Message #12 Posted by Marcus von Cube, Germany on 13 May 2012, 1:13 a.m.,
in response to message #11 by Chris Tvergard

The backup is just a 1:1 copy of RAM which is created by executing SAVE or hitting ON+STO (the latter needs to be pressed twice). To change something in the backup you need to make the changes to RAM and then create a new backup.

                                    
Re: [WP34S] Stack size impact on speed? SSIZE4.
Message #13 Posted by Walter B on 13 May 2012, 1:17 a.m.,
in response to message #12 by Marcus von Cube, Germany

Marcus,

you wrote above:

Quote:
With CAT you can easily delete programs from the library by pressing f CLP while CAT is active and you are positioned on the program to be deleted.
That was easy to be misunderstood, as you see now.
                                          
Re: [WP34S] Stack size impact on speed? SSIZE4.
Message #14 Posted by Chris Tvergard on 13 May 2012, 11:42 a.m.,
in response to message #13 by Walter B

Marcus & Walter,

I thus now figured it out. To clear the bup CAT entry one has to clear RAM, then do a SAVE or ON+STO+STO.

That worked.

Thanks.

Chris


[ Return to Index | Top of Index ]

Go back to the main exhibit hall