Post Reply 
Announcing the "Dare 2 Compare", new version of the Total_Rekall
09-06-2016, 06:46 AM
Post: #7
RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall
(09-06-2016 05:23 AM)Ángel Martin Wrote:  A quick look at the 34 QRG helped me understand your comment - so it's a general-purpose stack arrangement alteration, which corresponds to some standard functions in particular cases but goes beyond that of course. I reckon it should be relatively simple to implement this using ALPHA to hold the "master" string of the stack arrangement, such as "YYZZ"... an interesting exercise but how about practical applications for it?

Yes, it's a general command to generate any possible stack arrangement, it's very useful if the implementation make it shorter and quicker than the equivalent sequence of traditional stack commands to achieve the same goal. It is useful especially in long loops where any execution time saved has a significant impact on the overall program duration.

Here is an example where I've used it twice, it's a subroutine using only the stack to calculate the sum of the proper divisors of the number in X, it returns this sum in X and the initial number in Y:
Code:
                      X     Y     Z     T 
01* LBL D             n   
02  1                 1     n
03  <>XYXX            1     n     1     1
04* INC T             -     n     s     d
05  <>YYZT            n     n     s     d
06  RCL/ T            n/d   n     s     d       
07  x<? T
08  SKIP 006
09  FP?               n/d   n     s     d   
10  BACK 006
11  X#? T             n/d   n     s     d   
12  RCL+ T     
13  STO+ Z
14  BACK 010
15* x<> Z             s     n     n/d   d
16  END
The first occurrence at step 03 is replacing the two instructions STO Z STO T, and the second occurrence at step 05 is also replacing two instructions: CLx RCL Y.

If you use the Alpha register to hold the master string this will not save any time nor decrease the overall instruction count. With 4 registers to track you can code them with two bits and code the string with a byte, so my idea was, if possible, to have a new <> instruction which would accept the 4 letters X, Y, Z, T as parameters to generate the byte coding the stack final state. But this is may be pushing the envelope too far ...
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Didier Lachieze - 09-06-2016 06:46 AM



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