Post Reply 
[WP 34s] emulator ENTER key behaviour
05-27-2015, 06:45 PM (This post was last modified: 06-15-2015 10:38 AM by Marcio.)
Post: #1
[WP 34s] emulator ENTER key behaviour
Is it me or the ENTER key is behaving oddly?

Every time I hit it, it will duplicate whatever number I enter, taking the X and Y registers. The same will happen on the 35s emulator. All the other ENTER keys on other emulators I have (50g, Prime) will behave as expected.

Hope I am missing something.

Thanks

Marcio
Find all posts by this user
Quote this message in a reply
05-27-2015, 07:02 PM
Post: #2
RE: 34s emulator ENTER key problem?
(05-27-2015 06:45 PM)Marcio Wrote:  Is it me or the ENTER key is behaving oddly?

Every time I hit it, it will duplicate whatever number I enter, taking the X and Y registers. The same will happen on the 35s emulator. All the other ENTER keys on other emulators I have (50g, Prime) behave as expected.

Hope I am missing something.

Thanks

Marcio

It's called classical RPN, versus the RPL command line you're used to. Wink

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
05-27-2015, 07:04 PM
Post: #3
RE: 34s emulator ENTER key problem?
I think that is the expected behavior. In RPL machines (50, Prime) ENTER puts your input on X. On RPN machines (34s, 35) ENTER puts your input on both X & Y and also disables the auto stack lift.

Regards.
Find all posts by this user
Quote this message in a reply
05-27-2015, 07:38 PM
Post: #4
RE: 34s emulator ENTER key problem?
We learn something new every day! Thanks!
Find all posts by this user
Quote this message in a reply
05-27-2015, 08:41 PM
Post: #5
RE: 34s emulator ENTER key problem?
(05-27-2015 07:04 PM)emece67 Wrote:  auto stack lift

Used Google image search:
[Image: PL-14000_Stacked.png]

Was not disappointed.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
05-27-2015, 10:05 PM (This post was last modified: 05-27-2015 10:56 PM by Marcio.)
Post: #6
RE: 34s emulator ENTER key problem?
Quote:It's called classical RPN, versus the RPL command line you're used to. Wink

Would anybody be kind enough as to explain why that is? What's the advantage of such feature?

Very much appreciated.
Find all posts by this user
Quote this message in a reply
05-27-2015, 11:03 PM (This post was last modified: 05-27-2015 11:05 PM by emece67.)
Post: #7
RE: 34s emulator ENTER key problem?
This is only an educated guess.

To implement an RPL machine you need an stack and also a separate register where to store the digits as you type them prior to pushing ENTER.

To implement an RPN machine you only need an stack, as the digits you type are directly entered into the X register. When you push ENTER such digits are copied to Y and, as the automatic stack lift is disabled, new digits will go into X (overwriting the old ones, but not missing them, as they are also in Y). If instead of pushing ENTER you push any operation, the digits you have just typed (in X) are computed with those on Y.

Thus, in an RPN machine you do not need a separate register to hold the digits you type prior to pushing ENTER, the bottom of the stack serves that purpose.

I suppose that, when memory was scarce, such behaviour was advantageous.
Find all posts by this user
Quote this message in a reply
05-28-2015, 02:44 PM
Post: #8
RE: 34s emulator ENTER key problem?
(05-27-2015 08:41 PM)Thomas Klemm Wrote:  
(05-27-2015 07:04 PM)emece67 Wrote:  auto stack lift

Used Google image search:
[Image: PL-14000_Stacked.png]

Was not disappointed.

Cheers
Thomas

Who would want a three-level stack? Ewwww.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-28-2015, 06:13 PM
Post: #9
RE: 34s emulator ENTER key problem?
(05-28-2015 02:44 PM)Dave Britten Wrote:  Who would want a three-level stack? Ewwww.

Some might disagree.

[Image: 9100bdss.jpg]
Find all posts by this user
Quote this message in a reply
05-28-2015, 06:59 PM
Post: #10
RE: 34s emulator ENTER key problem?
(05-27-2015 10:05 PM)Marcio Wrote:  
Quote:It's called classical RPN, versus the RPL command line you're used to. Wink

Would anybody be kind enough as to explain why that is? What's the advantage of such feature?

Very much appreciated.

Such a discussion would (and has, more than once) fill thousands of messages. Search both the current and old Museum archives for topics such as "RPN vs RPL" or look for phrases like "classic RPN". There are many advantages (and limitations) to both styles, but comparing them is really much more of a religious dicussion than a technical one. And the good thing about that is, whichever one you believe is best for you, is best for you.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
05-28-2015, 07:34 PM
Post: #11
RE: 34s emulator ENTER key problem?
(05-28-2015 06:59 PM)rprosperi Wrote:  Such a discussion would (and has, more than once) fill thousands of messages. Search both the current and old Museum archives for topics such as "RPN vs RPL" or look for phrases like "classic RPN". There are many advantages (and limitations) to both styles, but comparing them is really much more of a religious dicussion than a technical one. And the good thing about that is, whichever one you believe is best for you, is best for you.

Well, yes, I have browsed the forums and read lots of threads about the differences between RPN and RPL. My question however was more like centered around why the ENTER key will duplicate entries therefore taking 2 registers instead of 1 only.

Thanks.

Marcio
Find all posts by this user
Quote this message in a reply
05-28-2015, 08:07 PM
Post: #12
RE: 34s emulator ENTER key problem?
(05-28-2015 07:34 PM)Marcio Wrote:  
(05-28-2015 06:59 PM)rprosperi Wrote:  Such a discussion would (and has, more than once) fill thousands of messages. Search both the current and old Museum archives for topics such as "RPN vs RPL" or look for phrases like "classic RPN". There are many advantages (and limitations) to both styles, but comparing them is really much more of a religious dicussion than a technical one. And the good thing about that is, whichever one you believe is best for you, is best for you.

Well, yes, I have browsed the forums and read lots of threads about the differences between RPN and RPL. My question however was more like centered around why the ENTER key will duplicate entries therefore taking 2 registers instead of 1 only.

Thanks.

Marcio

Simplest way to think of it:

In traditional RPN, whatever you're typing is going directly into the x register as you type it. There's no "command line" that has to be processed. So pressing + terminates entry, and operates on that value and y. Pressing Enter means "copy x to y". Most operations enable auto stack lift, so when you start typing something else, there's an implicit Enter first, and your new entry immediately overwrites x. A few functions like Enter and CLX disable stack lift, so your next entry overwrites x without pushing it to y.

In RPL (28, 48, etc.), there's a command line that's separate from the stack. Whatever you're typing isn't part of the stack yet. Pressing Enter means "parse and process the command line". If there happen to be numbers or other objects in there, they'll be pushed to level 1, and everything else lifted one level. You can enter a whole series of numbers and commands separated by spaces, and pressing Enter will process them all in one go. Try this: enter "3 5 " (with a space at the end, but without quotes), then turn on alpha mode and type "+" so you have "3 5 +". Press Enter, and you'll get 8.

It's a very subtle distinction, but it can have significant implications. Compare two program snippets with crude stack diagrams for taking a value from x/level 1, and calculating x / 2, but leaving the original x/level 1 value in y/level 2.

RPN: (Stack lift disabled after ENTER)
ENTER x:12 y:12
ENTER x:12 y:12 z:12
2 x:2 y:12 z:12
/ x:6 y:12

RPL: (No concept of disabling stack lift, everything pushes the stack)
ENTER (acting as DUP with no command line active) 1:12 y:12
2 1:2 2:12 3:12
/ 1:6 2:12

With RPN, it's very easy to forget that second Enter and accidentally clobber the original value you were trying to keep. I just made this mistake a few minutes ago fiddling around with the Collatz conjecture on my 41. Though a trick you can do with the 41 and 42S is to use "RCL X" instead of Enter, effectively recalling/copying the value in x, but RCL enables stack lift as opposed to Enter disabling it. So the above program could be written "RCL X, 2, /" on a 41.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-28-2015, 09:11 PM
Post: #13
RE: 34s emulator ENTER key problem?
(05-28-2015 07:34 PM)Marcio Wrote:  My question however was more like centered around why the ENTER key will duplicate entries therefore taking 2 registers instead of 1 only.

You may first make yourself familiar with how the 3-level stack of the HP-9100 works.
There's no [ENTER] key but there are five control keys one of them is the [↑] key:
  • Duplicates the contents of X in the Y register.
  • Shifts the contents of Y to the Z register.
  • The contents of the Z register are lost.
Here's an example of how to calculate \(\frac{20}{3+2}\):

Code:
Operation      x          y           z

CLEAR 20 ↑     20         20          0
3 ↑            3          3           20
2              2          3           20
+              2          5           20
↓              5          20          20
÷              5          4           20

You may notice that the register y contains the result of the calculations.
This is very similar to how mechanical calculators worked: You could enter a number (x) and add it to an accumulator (y).
But with more sophisticated operations you need a temporary register (z).
Otherwise you can't calculate even a simple computation as the one above.

But the HP-35 can display only one register. To show the result in the accumulator the register y has to be shifted to the register x.
Thus both + and ↓ are executed together.

On the other hand the display (x) has to be shifted to the accumulator (y) before executing the next operation. Thus ↑ is executed before entering a number.
But of course this isn't needed when ↑ has just been executed. That's why stack-lift is then disabled.

The [ENTER↑] key of the HP-35 still contais this arrow which got lost with the Voyager series.
To me it's fascinating to see how these things evolved over the years.

HTH
Thomas
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)