Post Reply 
WP 34S - How do I use aGTO with stack registers?
01-04-2018, 09:07 PM (This post was last modified: 01-04-2018 09:26 PM by Dieter.)
Post: #4
RE: WP 34S - How do I use aGTO with stack registers?
(01-04-2018 04:19 PM)Martin Hepperle Wrote:  I have to look for some example applications of aGOTO.

Maybe this helps a bit in understanding αGTO:

Are you familiar with the HP41? Here you have a GTO IND command that allows branching both to a numeric label as well as to an alpha label. This is possible because the data registers and the stack can hold both numeric and alpha contents. If the content of R00 is 23 a GTO IND 00 will jump to label 23. If R00 holds "ABC" the program branches to label "ABC".

The 34s is different in this regard. The data registers and the stack cannot store an alpha string. So if you want to branch indirectly to label "ABC" you cannot store "ABC" in R00 and do a GTO–>00. On the 34s, GTO–> allows branching to numeric labels, but not to alpha labels.

But there is a workaround. You can tell the 34s to interpret a number in a data/stack register as an alpha string. This conversion between a string and its numeric equivalent can be done with the αSTO command. Type "ABC" in alpha mode and do an αSTO X (simply press f STO) and you'll see the corresponding code in X. This code is 4276803.

If you now program an αGTO X this is essentially the same as a GTO IND X on the HP41 with "ABC" in the X-register. The essential difference is that the HP41 has the alpha string in X while on the 34s it's the alpha code of that string. By using αGTO X instead of GTO–>X you tell the 34s not to jump to label 4276803 (which does not exist anyway) but to branch to the alpha equivalent "ABC".

As Pauli noted, the code is base 256. So for label "ABC" which has the character codes 65, 66 and 67 this means the alpha code is 65·256² + 66·256 + 67 = 4276803.

So the whole thing is not very complicated. αGTO simply is a GTO IND or GTO–> for alpha labels. It tells the calculator not to jump to the label with that number but to the label with that alpha code. In other words: if 65 is stored in R00, a GTO–>00 will jump to label 65 while αGTO 00 will jump to label "A".

Now it should be clear why αGTO with a code of 101234 will not work: the latter is 001 139 114 in base 256. OK, "114" is an "r", but the other two...? At least you can be quite sure not to have a label with that name on your 34s. ;-)

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


Messages In This Thread
RE: WP 34S - How do I use aGTO with stack registers? - Dieter - 01-04-2018 09:07 PM



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