HP Forums
Announcing the "Dare 2 Compare", new version of the Total_Rekall - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Announcing the "Dare 2 Compare", new version of the Total_Rekall (/thread-6798.html)



Announcing the "Dare 2 Compare", new version of the Total_Rekall - Ángel Martin - 09-05-2016 07:19 PM

Looks like I've done it again, and this time probably taking the venerable 41 platform to places it hasn't been before: meet the "Dare 2 Compare" module, a new version of the Total_Rekall with the following new bells & whistles:

1. enhanced all launchers and function prompts to interact with one another and be "aware" of previous choices.
2. added a secondary FAT with 52 new sub-functions, amongst them all test functions on the stack registers {M-Q} (as {T to L} were already there implemented as main functions).
3. for main functions: automatic entering of non-merged arguments as second program lines. For instance: Z<=T? . This feature was a must, after I learned how to do it in the CLXPREGS module.
4. for sub-functions, a triple-non-merged argument scheme using three program steps. For instance: M>= IND Z?
5. added functions SELCT and ?CASE – a pseudo SLECT-CASE implementation that allows comparison of any “variable” (i.e. register, including the stack and indirect) defined by SELCT and stored in the buffer - with a hard value (integer) entered at the ?CASE prompt.
6. added NEXT and PREV, to increment/decrement any register by one - including the stack and indirection
7. Direct comparison to zero for any register (direct, indirect, stack), with the "Zero-group" functions. For instance: ?0 # 23
8. Implements the "emergency buffer" with five data registers in case you ran out of regular ones.
9. Enhanced SAVE/GET status registers to/from X-Memory, with variable-size option in the prompts.
10. a stack shuffle function SHFL, see the thread below !

Very tricky stuff, and not simple to make it all tick at unison but the results are nothing short of amazing if I may say it. Writing the manual is next, will try to get application examples in it as well after I digest the new functionality myself.

Soon at a TOS near you!


RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Didier Lachieze - 09-05-2016 07:34 PM

Amazing ! The venerable 41 is moving closer to the young WP 34s...
But there is still a function I would like to have on the 41: the stack shuffle <>
Any hope to see it implemented one day ?


RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Massimo Gnerucci - 09-05-2016 08:10 PM

Well, every time you set a new record!
Congratulations and thank you very much Ángel.


RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - rprosperi - 09-05-2016 09:05 PM

(09-05-2016 07:19 PM)Ángel Martin Wrote:  Looks like I've done it again, and this time probably taking the venerable 41 platform to places it hasn't been before...

I can feel Gene smiling from here...

Nicely done Angel, a new candidate for my 'normal' 41CL configuration (that is if one could in any way call this stuff normal Wink ).


RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Gene - 09-06-2016 12:38 AM

Me? I was smiling and had no idea why!


RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Ángel Martin - 09-06-2016 05:23 AM

(09-05-2016 07:34 PM)Didier Lachieze Wrote:  Amazing ! The venerable 41 is moving closer to the young WP 34s...
But there is still a function I would like to have on the 41: the stack shuffle <>
Any hope to see it implemented one day ?

Not sure if it's "moving closer" to the 34S, I wasn't aware of the CASE command being there (don't know that machine that well, I should really). However there are several functions not available on the 34, not that this is a race or anything...

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?

BTW one of my favorites within the Total_Rekall is the double and multiple indirection functions, i.e. RCL IND IND 23, or STO IND IND ST Z - a nice solution in search of a problem too ;-)


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

(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 ...


RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Ángel Martin - 09-06-2016 10:08 AM

(09-06-2016 06:46 AM)Didier Lachieze Wrote:  
(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.

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 ...

In manual mode the prompts will work just fine, but then in a running program you need that information to be stored somewhere - either in ALPHA or in a non-merged parameter in the next program step. This is going to contribute to the byte count... You're right four stack registers can fit in two bytes, which also frees Alpha and thus can be included in the prompt choices - in fact, I'm leaning towards a five-prompt scheme to also include LastX, and allow M-P in the inputs...

SHFL: _ _ _ _ _

neat stuff, let's see how far we can take it .


RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Ángel Martin - 09-06-2016 04:45 PM

I think I've come up with an even better function: the "SHUFFLE w/ zero" - meaning you can either input the stack register letters in the prompts (all the way from T to P, i.e. including the ALPHA registers too) - *or* - you can also enter a zero if you want the corresponding register to be cleared.

Examples: the pattern is XYZTL, five prompts: SHFL _ _ _ _ _

SHFL XYZTL does nothing
SHFL X00T0 will clear Y, Z, and L
SHFL ZT0LL will clear Z, move Z to X, T to Y and L to T
SHFL TXYZL does R^
SHFL YZTXL does RDN
SHFL XXXXL fills the stack with X
SHFL LLLLL fills the stack with LastX
etc...

I'm using ALPHA to hold the master string, I don't think it's that bad and besides there's no more room available for other approaches.

a neat function, thanks for suggesting it!


RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - hth - 09-06-2016 06:30 PM

(09-06-2016 04:45 PM)Ángel Martin Wrote:  I think I've come up with an even better function: the "SHUFFLE w/ zero" - meaning you can either input the stack register letters in the prompts (all the way from T to P, i.e. including the ALPHA registers too) - *or* - you can also enter a zero if you want the corresponding register to be cleared.

Examples: the pattern is XYZTL, five prompts: SHUFFLE _ _ _ _ _

SHUFFLE XYZTL does nothing
SHUFFLE X00T0 will clear Y, Z, and L
SHUFFLE ZT0LL will clear Z, move Z to X, T to Y and L to T
SHUFFLE TXYZL does R^
SHUFFLE YZTXL does RDN
SHUFFLE XXXXL fills the stack with X
SHUFFLE LLLLL fills the stack with LastX
etc...

I'm using ALPHA to hold the master string, I don't think it's that bad and besides there's no more room available for other approaches.

a neat function, thanks for suggesting it!

Cool! You could perhaps consider allowing any digit 0-9 to be used. Perhaps even interpret it as: 0-1 is its value, 2 and up is E(n-1), should would allow entering 0,1, 10, 100, 1000,...


RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Jurgen Keller - 09-06-2016 06:48 PM

Ángel, you're the HP-41 Daredevil ;-)
Thanks a lot for giving us some great new functions to play with.


RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Gene - 09-06-2016 06:54 PM

Perhaps a base 6 integer. 0-5 representing 0, X, Y, Z, T and L ? 55555 would copy L to all five locations.


RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Ángel Martin - 09-07-2016 05:24 AM

(09-06-2016 06:54 PM)Gene Wrote:  Perhaps a base 6 integer. 0-5 representing 0, X, Y, Z, T and L ? 55555 would copy L to all five locations.

Well not a bad idea but I prefer the Alphanumeric approach (you're too influenced by the HP-67 ;-) So this is how it works:

- In Manual mode, SHFL prompts for five arguments, which are restricted to the stack registers (including M,N,O,P,Q) and the digit zero. Adding other digits is not possible, no room available and the code would become too complicated.

- In a running program a string of five letters is expected from the register M in ALPHA. You can still use N,O,P and Q - albeit the last one is of very limited used due to the scratch role it plays in multiple functions and the OS.

- Entering the SHFL function in a program: being a sub-function it takes two program lines, XF# followed by the index (53 in this case). Then the Alpha string must be added manually *before* the XF# step.

- The alteration is for the main stack registers X,Y,Z,T,L.

I'm doing some final testing, will post it here when complete.


RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall - Ángel Martin - 09-11-2016 11:25 AM

here it is folks, have a happy LazySunday ;-)

Manual posted at: http://systemyde.com/pdf/Dare2Compare_QRG.pdf
(updated version exists with some small changes and two more sub-functions)