Announcing the "Dare 2 Compare", new version of the Total_Rekall
09-06-2016, 06:46 AM
Post: #7
 Didier Lachieze Senior Member Posts: 1,632 Joined: Dec 2013
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 ...
 « Next Oldest | Next Newest »

 Messages In This Thread Announcing the "Dare 2 Compare", new version of the Total_Rekall - Ángel Martin - 09-05-2016, 07:19 PM RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Didier Lachieze - 09-05-2016, 07:34 PM RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Ángel Martin - 09-06-2016, 05:23 AM RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Didier Lachieze - 09-06-2016 06:46 AM RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Ángel Martin - 09-06-2016, 10:08 AM RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Massimo Gnerucci - 09-05-2016, 08:10 PM RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - rprosperi - 09-05-2016, 09:05 PM RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Gene - 09-06-2016, 12:38 AM RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Ángel Martin - 09-06-2016, 04:45 PM RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - hth - 09-06-2016, 06:30 PM RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Gene - 09-06-2016, 06:54 PM RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Ángel Martin - 09-07-2016, 05:24 AM RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Jurgen Keller - 09-06-2016, 06:48 PM RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Ángel Martin - 09-11-2016, 11:25 AM

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