Post Reply 
[WP-34s] Swap question
05-16-2014, 01:36 PM (This post was last modified: 05-16-2014 01:50 PM by Tugdual.)
Post: #1
[WP-34s] Swap question
I'm having some difficulties to understand how the "pure" P.FCN swap function (looks like two opposite arrows one on top of the other with no register indication).

Is that used to swap two non stak registers like R11<->R12?
What would be the keyobaord entry? Apparently it would only accept XYZT but expects 4 letters?

Finally is it possible to have indirect swap?
Something like:
Code:
R10=8, R11=9 R8=3, R9=4
SWAP ->R10, ->R11
would end up with R8=4 and R9=3

Edit:
Ok found the command P.FCN<-> page 113 of doc 3.1.
So that's not what I'm looking for.
Is there a way to swap registers and indirect registers?

There is still R-SWAP but a bit cumbersome with the required real value parameter.
Find all posts by this user
Quote this message in a reply
05-16-2014, 02:06 PM (This post was last modified: 05-16-2014 02:07 PM by Didier Lachieze.)
Post: #2
RE: [WP-34s] Swap question
(05-16-2014 01:36 PM)Tugdual Wrote:  Finally is it possible to have indirect swap?
Something like:
Code:
R10=8, R11=9 R8=3, R9=4
SWAP ->R10, ->R11
would end up with R8=4 and R9=3

You can do that with 3 instructions:
Code:
h x<> -> 10
h x<> -> 11
h x<> -> 10

At the end the content of registers R8 and R9 has been swapped and the stack is unchanged.
Find all posts by this user
Quote this message in a reply
05-16-2014, 02:12 PM (This post was last modified: 05-16-2014 02:14 PM by Tugdual.)
Post: #3
RE: [WP-34s] Swap question
(05-16-2014 02:06 PM)Didier Lachieze Wrote:  
(05-16-2014 01:36 PM)Tugdual Wrote:  Finally is it possible to have indirect swap?
Something like:
Code:
R10=8, R11=9 R8=3, R9=4
SWAP ->R10, ->R11
would end up with R8=4 and R9=3

You can do that with 3 instructions:
Code:
h x<> -> 10
h x<> -> 11
h x<> -> 10

At the end the content of registers R8 and R9 has been swapped and the stack is unchanged.
Very smart!
Thanks Didier!

Is that the same as:
Code:
RCL ->10
x<> ->11
STO ->10
Find all posts by this user
Quote this message in a reply
05-16-2014, 02:38 PM
Post: #4
RE: [WP-34s] Swap question
(05-16-2014 02:12 PM)Tugdual Wrote:  Is that the same as:
Code:
RCL ->10
x<> ->11
STO ->10
It's the same for the registers content but not for the stack content. My sequence leave the stack unchanged. Your sequence change the content of the stack:
- let say you have a 4-depth stack: X, Y, Z, T
- after your sequence the stack content will be: R9, X, Y, Z
Find all posts by this user
Quote this message in a reply
05-16-2014, 02:40 PM
Post: #5
RE: [WP-34s] Swap question
(05-16-2014 02:38 PM)Didier Lachieze Wrote:  
(05-16-2014 02:12 PM)Tugdual Wrote:  Is that the same as:
Code:
RCL ->10
x<> ->11
STO ->10
It's the same for the registers content but not for the stack content. My sequence leave the stack unchanged. Your sequence change the content of the stack:
- let say you have a 4-depth stack: X, Y, Z, T
- after your sequence the stack content will be: R9, X, Y, Z

Good point.
Thanks for mentioning this.
Find all posts by this user
Quote this message in a reply
Post Reply 




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