Page 1 of 4

A couple additional functions that would be cool to have

Posted: Mon Dec 18, 2017 10:04 pm
by Dave Britten
Just throwing out some ideas for some functions that would make really slick additions to Free42:

RTN+1 - Return to one instruction after where RTN would normally go, i.e. return and skip the next instruction. This allows creating custom conditional functions. I think the WP-34S has this.

PUSHST and POPST - Push Stack and Pop Stack. This would require reserving space in memory for extra copies of the stack according to how many levels this would support, but would eliminate the need to do things like implement stack saving and restoring in programs. Begin a program with PUSHST, do your work, POPST, STO ST L if appropriate, and RCL your result(s) to the stack.

Re: A couple additional functions that would be cool to have

Posted: Tue Dec 19, 2017 8:38 am
by pauli
Yes, the 34S has RTN+1.

Wouldn't saving and restoring the stack to/from a register (as an array) be as useful?


Pauli

Re: A couple additional functions that would be cool to have

Posted: Tue Dec 19, 2017 1:24 pm
by Dave Britten
pauli wrote:
Tue Dec 19, 2017 8:38 am
Wouldn't saving and restoring the stack to/from a register (as an array) be as useful?
Yes, but it would be cumbersome if you wanted to support any sort of recursion.

Re: A couple additional functions that would be cool to have

Posted: Tue Dec 19, 2017 2:04 pm
by grsbanks
Sorry to disappoint everyone but DM42-related patches to Free42 are being kept to a strict minimum, basically limited to what's needed to drive the hardware.

Now, if someone wants to contribute a PUSHST/POPST pair in RPN and post it in the Software Library it can form the start of a bunch of utilities that everyone can benefit from!

Re: A couple additional functions that would be cool to have

Posted: Tue Dec 19, 2017 2:25 pm
by Dave Britten
grsbanks wrote:
Tue Dec 19, 2017 2:04 pm
Now, if someone wants to contribute a PUSHST/POPST pair in RPN and post it in the Software Library it can form the start of a bunch of utilities that everyone can benefit from!
I'll bet it could be done in RPN fairly cleanly, though I haven't personally worked with matrices enough on the 42 (yet) to bang it out myself.

Re: A couple additional functions that would be cool to have

Posted: Tue Dec 19, 2017 4:18 pm
by akaTB
Dave Britten wrote:
Tue Dec 19, 2017 2:25 pm
grsbanks wrote:
Tue Dec 19, 2017 2:04 pm
Now, if someone wants to contribute a PUSHST/POPST pair in RPN and post it in the Software Library it can form the start of a bunch of utilities that everyone can benefit from!
I'll bet it could be done in RPN fairly cleanly, though I haven't personally worked with matrices enough on the 42 (yet) to bang it out myself.
Seems like you already resolved this... :lol:
http://www.hpmuseum.org/cgi-sys/cgiwrap ... ead=159644

Re: A couple additional functions that would be cool to have

Posted: Tue Dec 19, 2017 8:06 pm
by Dave Britten
akaTB wrote:
Tue Dec 19, 2017 4:18 pm
Dave Britten wrote:
Tue Dec 19, 2017 2:25 pm
grsbanks wrote:
Tue Dec 19, 2017 2:04 pm
Now, if someone wants to contribute a PUSHST/POPST pair in RPN and post it in the Software Library it can form the start of a bunch of utilities that everyone can benefit from!
I'll bet it could be done in RPN fairly cleanly, though I haven't personally worked with matrices enough on the 42 (yet) to bang it out myself.
Seems like you already resolved this... :lol:
http://www.hpmuseum.org/cgi-sys/cgiwrap ... ead=159644
He he, yup. I haven't loaded that on my DM42 yet, though. I wanted to see if there might be a more lightweight way of doing this with matrices, but that causes problems if you've got strings or other matrices on the stack. So I'll probably just stick with the old method.

Re: A couple additional functions that would be cool to have

Posted: Tue Dec 19, 2017 10:54 pm
by Bill (Smithville NJ)
The ability to page up/down through the list
of Files in the "Load Program" menu would be a welcome addition.
It's pretty tedious to go up/down in the file list.

Maybe page up/down is already there - but I couldn't discover
the correct buttons to push to achieve it.

Could possibly use Shift Up or Shift Down, but even better would be the
extreme left and extreme right top line of buttons.

This would save a lot of up/down button pushing when selecting a file
to load.

Bill
Smithville, NJ

Re: A couple additional functions that would be cool to have

Posted: Thu Dec 21, 2017 1:53 pm
by whuyse
grsbanks wrote:
Tue Dec 19, 2017 2:04 pm
Now, if someone wants to contribute a PUSHST/POPST pair in RPN and post it in the Software Library it can form the start of a bunch of utilities that everyone can benefit from!
Done.
PUSH/POP stack

Cheers, Werner

Re: A couple additional functions that would be cool to have

Posted: Thu Dec 21, 2017 2:23 pm
by Dave Britten
whuyse wrote:
Thu Dec 21, 2017 1:53 pm
grsbanks wrote:
Tue Dec 19, 2017 2:04 pm
Now, if someone wants to contribute a PUSHST/POPST pair in RPN and post it in the Software Library it can form the start of a bunch of utilities that everyone can benefit from!
Done.
PUSH/POP stack

Cheers, Werner
Very nice! I'll have to try those out later. It looks much shorter than I was expecting it to be.