Post Reply 
Announcing the "Dare 2 Compare", new version of the Total_Rekall
09-05-2016, 07:19 PM (This post was last modified: 09-07-2016 05:28 AM by Ángel Martin.)
Post: #1
Announcing the "Dare 2 Compare", new version of the Total_Rekall
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!

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
09-05-2016, 07:34 PM
Post: #2
RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall
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 ?
Find all posts by this user
Quote this message in a reply
09-05-2016, 08:10 PM
Post: #3
RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall
Well, every time you set a new record!
Congratulations and thank you very much Ángel.

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
09-05-2016, 09:05 PM
Post: #4
RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall
(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 ).

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
09-06-2016, 12:38 AM
Post: #5
RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall
Me? I was smiling and had no idea why!
Find all posts by this user
Quote this message in a reply
09-06-2016, 05:23 AM
Post: #6
RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall
(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 ;-)

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
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
09-06-2016, 10:08 AM
Post: #8
RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall
(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 .

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
09-06-2016, 04:45 PM (This post was last modified: 09-15-2016 01:14 PM by Ángel Martin.)
Post: #9
RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall
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!

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
09-06-2016, 06:30 PM
Post: #10
RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall
(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,...
Find all posts by this user
Quote this message in a reply
09-06-2016, 06:48 PM
Post: #11
RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall
Ángel, you're the HP-41 Daredevil ;-)
Thanks a lot for giving us some great new functions to play with.
Find all posts by this user
Quote this message in a reply
09-06-2016, 06:54 PM
Post: #12
RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall
Perhaps a base 6 integer. 0-5 representing 0, X, Y, Z, T and L ? 55555 would copy L to all five locations.
Find all posts by this user
Quote this message in a reply
09-07-2016, 05:24 AM (This post was last modified: 09-07-2016 09:47 AM by Ángel Martin.)
Post: #13
RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall
(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.

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
09-11-2016, 11:25 AM (This post was last modified: 09-15-2016 01:13 PM by Ángel Martin.)
Post: #14
RE: Announcing the "Dare 2 Compare", new version of the Total_Rekall
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)

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
Post Reply 




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