# HP Forums

Full Version: Sleek approach to Register Exchange on HP-29C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Hello there.

I'm looking to port over my SR-56, TI-58C programs to my 29C. One of the memory functions which is missing on the 29C is the register exchange.

Has anyone come up with a sequence which is efficient and doesn't disrupt the stack too much? If a method loses the T register and leaves the exchanged register's old value in the X register, I don't mind. But, if I can retain the stack with the T register undisturbed and the exchanged register's old value in the X register, that's even better.

Edited: 15 Mar 2012, 11:08 p.m.

I assume you have already developed the following (or similar) un-sleek and inefficient approaches:

```Without Preserving t, does preserve Last x:
RCL n
x<>y
STO n
Rv (Roll down)
Preserves t, loses Last x:
Rv
Rv
Rv
ABS (or INT, or FRAC)
CLx
RCL n
x<>y
STO n
CLx
LAST x
Rv
Preserves t and Last x: (requires use of register 0 or other for temporary storage of t)
Rv
Rv
Rv
STO 0
CLx
RCL n
x<>y
STO n
CLx
RCL 0
Rv
```

...

Thanks indeed!

I didn't think of your 4-step approach but, on my own, I did ironically come up with the 5-step approach found in the HP-35A's Math Applications book (although I lose the T-register):

RCL N
X<>Y
STO N
CLx
+

BUT, you got me there! Your first algorithm proves to be the winner even if I need to lose T. Even though, in both yours & my approaches, further down the line, provided I don't lose the Z register, the Z register (which is the last T register value) gets pushed back up to T anyway. So, with that in mind, the next pop will save T and copy to Z. Thus, the net effect will be as if I didn't lose T in the first place.

If I can streamline my SR-56/TI-58C progs enough for the 29C, I'd be willing to use your version that preserves both the T and LASTx registers.

Edited: 16 Mar 2012, 12:27 p.m. after one or more responses were posted

Glad they were of some help.

I started thinking about this a bit last night after I read your post. I used to have 29C, which I used for about 3 years from 1979 to 1982. Then I lost track of it before I came to realize that I'd like to collect. In any case, going from memory of how the 29C worked, my first ideas for saving stack-t involved using Roll-up. Surely the 29C had Roll-up, right? Wrong, so three Roll-downs are needed instead. Darn.

I have an old book from (of all places) TK Enterprises, entitled "Everything You've Always Wanted to Know About RPN (But Were Afraid to Pursue)" and from there I got the idea for the R^. But, I dumped the R^ idea because I was looking to shorten keystrokes. After that, I just jumbled around to come up with the least amount of keystrokes for the exchange and the pop to use a zero value, although I'd lose Last X. But, even as I was thinking about saving the T register, I realised my approach would lose the T registed. But, ironically, the 'CLx +' pop preserves T as the RCL n op pushes Z to T anyway (presuming Z still has the last value of T). So, all I really lost was Last X in my version. But, you did help in all ways, including reducing my method to four strokes in the first method.

Edited: 16 Mar 2012, 12:45 p.m.

Can you publish your old programs? If they are on the original programming sheets, a scan to PDF would be perfect.

My first programmable was the SR-56, so you know why I'm interested...

Googling on <Everything you've ' know about RPN> {sic} yields a link to a PDF of that old book (Copyright 1976), which is aimed (according to its cover) at the Corvus 500, the APS 55, the Omron 12-SR, and others. "HP" does not appear anywhere in the book, which runs to 113 pages plus index.

I entered that into Google AND, in addition, I saw the following listing "The Joys of RPN." no, not an April Fools' Joke (check your calendar). I watched some of the video. Pretty nifty stuff.