The Museum of HP Calculators

HP Forum Archive 17

[ Return to Index | Top of Index ]

Keystroke Programming and Stacks
Message #1 Posted by DaveJ on 8 Sept 2007, 7:10 p.m.

I'm about to add keystroke programming to my new calculator design and am wondering whether or not to keep the traditional 4 level RPN stack I have now, or go with an "unlimited" size RPL style stack instead.

Note that the RPL style stack would not include algebraic expression and all that fancy stuff as on the 28/48 etc, it would simply be a large stack with the usual DROP/SWAP etc.

Advantages and disadvantages, comments and insights, and religious flame wars invited :->

Thanks Dave.

      
Re: Keystroke Programming and Stacks
Message #2 Posted by Arne Halvorsen (Norway) on 8 Sept 2007, 7:35 p.m.,
in response to message #1 by DaveJ

Just dont forget lastx you will do good :-) When I have had to use non rpn it is that I often has missed...

      
Re: Keystroke Programming and Stacks
Message #3 Posted by Geir Isene on 8 Sept 2007, 7:45 p.m.,
in response to message #1 by DaveJ

The KISS principle would do good.

            
Re: Keystroke Programming and Stacks
Message #4 Posted by Arne Halvorsen (Norway) on 8 Sept 2007, 7:56 p.m.,
in response to message #3 by Geir Isene

Keep it simple would be a no arbitary limit stack with nothing special happening to value in at top of stack and no strange duplicating from bottom (well we are unlimited).... Nae, I take the complicated classic rpn stack...

                  
Re: Keystroke Programming and Stacks
Message #5 Posted by DaveJ on 9 Sept 2007, 3:48 a.m.,
in response to message #4 by Arne Halvorsen (Norway)

Quote:
Keep it simple would be a no arbitary limit stack with nothing special happening to value in at top of stack and no strange duplicating from bottom (well we are unlimited).... Nae, I take the complicated classic rpn stack...

I think perhaps the complicated classic RPN stack it is then, as I've already written it, unless someone can convince me otherwise...

It will have Algebraic keystroke programming too, just to keep everyone happy :)

Thanks Dave.

      
Re: Keystroke Programming and Stacks
Message #6 Posted by Egan Ford on 8 Sept 2007, 8:23 p.m.,
in response to message #1 by DaveJ

Let the user decide.

E.g., some programs efficiently take advantage of the T register copies on roll down. You'd loose that with unlimited stack.

E.g., some of us want to do complex calculations from start to end without thinking about a 4 level stack limit.

I'd have a programmable function that sets the stack depth.

            
Re: Keystroke Programming and Stacks
Message #7 Posted by Walter B on 9 Sept 2007, 6:01 p.m.,
in response to message #6 by Egan Ford

I'd second Egan: Let it have a settable fixed stack depth, .GE. 4.

            
Re: Keystroke Programming and Stacks
Message #8 Posted by Jeff O. on 10 Sept 2007, 12:18 p.m.,
in response to message #6 by Egan Ford

Quote:
I'd have a programmable function that sets the stack depth.
How about two settings which would be programmable, one that sets stack depth, and one that enables or disables replication of the top level.

Edited: 10 Sept 2007, 12:18 p.m.

                  
Re: Keystroke Programming and Stacks
Message #9 Posted by DaveJ on 10 Sept 2007, 5:58 p.m.,
in response to message #8 by Jeff O.

Quote:

How about two settings which would be programmable, one that sets stack depth, and one that enables or disables replication of the top level.


The only problem with having adjustable stacks like that is then it's possible for some keystroke programs to only work properly in a certain stack mode. To overcome that I would have to ensure the "stack mode" is stored with each program and have the calc automatically switch to that mode when before the program runs, and also return mode when it's finished.

But I guess I already have this sort of problem by having both RPN and Algebraic keystroke programming support.

Thanks Dave.

      
Re: Keystroke Programming and Stacks
Message #10 Posted by Hugh Evans on 9 Sept 2007, 12:29 a.m.,
in response to message #1 by DaveJ

If you're just going with basic RPN keystroke programming I say stick with a 4-level stack. You honestly won't go wrong either way.

-Hugh

            
Re: Keystroke Programming and Stacks
Message #11 Posted by DaveJ on 9 Sept 2007, 3:50 a.m.,
in response to message #10 by Hugh Evans

Quote:
If you're just going with basic RPN keystroke programming I say stick with a 4-level stack. You honestly won't go wrong either way.

-Hugh


Thanks.

What happened to the case you were working on Hugh?

Dave.

                  
Re: Keystroke Programming and Stacks
Message #12 Posted by Hugh Evans on 9 Sept 2007, 4:12 p.m.,
in response to message #11 by DaveJ

I have enough free time to finish that up if you need it.

      
Re: Keystroke Programming and Stacks
Message #13 Posted by Garth Wilson on 9 Sept 2007, 10:02 p.m.,
in response to message #1 by DaveJ

The 4-level stack came from a time before calculators were programmable. The assumption was that if there were any more levels, you wouldn't remember what you had on the the stack. That becomes irrelevant however when you use the stack for parameter-passing and intermediate results for multiple nested levels of routines. Even if no routine needs more than four levels itself and, at programming time, you're only concerned with the ones that particular routine uses, at run time it should still be permissible to have many levels underneath from other pending routines. Their presence is harmless regardless of how many there are. I would like to have a lot more than four levels available.

            
Re: Keystroke Programming and Stacks
Message #14 Posted by Katie Wasserman on 10 Sept 2007, 11:17 a.m.,
in response to message #13 by Garth Wilson

Quote:
The 4-level stack came from a time before calculators were programmable.

While it's true that the first RPN-type calculator, the Friden EC-130, did have 4-levels and wasn't programmable. The first HP calculator had just 3 levels and was programmable, the HP9100A. In the interviewing years (1963-1968) there were just a few other RPN-type calculators made.

Quote:
The assumption was that if there were any more levels, you wouldn't remember what you had on the the stack.

Remembering the stack on any of these calculators was not an issue since they displayed the entire stack. The HP-35 was the first to require the user to "remember" what was on the stack. I think that the major issue in choosing stack depth on the 35 was the cost in silicon to store the data as well as making sure that reasonable complexity expressions could be evaluated without resorting to paper and pencil.

                  
Re: Keystroke Programming and Stacks
Message #15 Posted by Namir on 10 Sept 2007, 2:57 p.m.,
in response to message #14 by Katie Wasserman

Katie,

Cost was indeed a factor. I remember the HP-35 pointing out that the machine has one memory register and a stack of four dynamic registers to store temporary numbers. So in a way, it was like HP's manual was hinting that the machine had 5 registers .. in the era when single-memory registers in non-HP calculators was typical. That's why my first HP calculator was the HP-55 since it had 20 memory registers.

Namir

Edited: 10 Sept 2007, 2:59 p.m.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall