In playing around with the good old 12C I realized that it has indirect register access. You can use the CFj and RCL CFj functions to store and recall indirectly through the n register. Furthermore it does a pre-increment (for CFj) and post-decrement (for RCL CFj) before the store and recall, respectively.
So just to see if this was at all useful I wrote a simple (bubble) sort program in only 21 bytes! It's easy to use, just fill up registers 0 - n with your data and call the program with n in the x register.
Here it is:
01 STO i i = maximum register
02 1
03 STO n A: n = 1
04 RCL CFj B: y = A(n)
05 RCL CFj x = A(n-1)
06 x<=y if (x <= y)
07 x<->y swap x,y
08 CFj A(n-1) = x
09 Rv
10 CFj A(n) = y
11 RCL i
12 RCL n
13 1
14 + n = n+1
15 x<=y if (n <= i)
16 GTO 03 goto B
17 2
18 - i = i-1
19 x=0 if (i = 0)
20 GTO 00 return
21 GTO 01 else
goto A
Edited: 27 Oct 2003, 10:47 a.m. after one or more responses were posted