HP Forums
[WP-34s] Swap question - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: [WP-34s] Swap question (/thread-1327.html)



[WP-34s] Swap question - Tugdual - 05-16-2014 01:36 PM

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.


RE: [WP-34s] Swap question - Didier Lachieze - 05-16-2014 02:06 PM

(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.


RE: [WP-34s] Swap question - Tugdual - 05-16-2014 02:12 PM

(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



RE: [WP-34s] Swap question - Didier Lachieze - 05-16-2014 02:38 PM

(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


RE: [WP-34s] Swap question - Tugdual - 05-16-2014 02:40 PM

(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.