EXC/ x<>Rn for stack efficiency

06142017, 10:36 AM
(This post was last modified: 06142017 11:01 AM by Paul Dale.)
Post: #13




RE: EXC/ x<>Rn for stack efficiency
Dieter is correct, the best way to do this is to understand the algorithm and recode it. RPN programs should almost always be shorter than AOS ones.
Since you want some code, this sequence will swap X and register 1 using register 0 and preserving the rest of the stack: Code: 01 X<>Y To avoid using the register, Last X can be used instead but this requires the arithmetic operation in step 2 to be undone in step 8 without loss (multiplication and division would also work as a pair in the same manner). This code swaps X with register 0 and leaves the rest of the stack intact: Code: 01 X<>Y Both are for the HP25. Using 20% of the program memory to swap X with a register seems a little wasteful. Pauli 

« Next Oldest  Next Newest »

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