A couple of RPL questions
#1

Hi folks,

2 quick questions


1. If I want to do a comparison (such as a DO UNTIL function) using one of the stack registers to campare, how do I adress the stack register in the program?

2. Can I force a display update during program execution without pausing?


thanks much, Hal

#2

Quote:
1. If I want to do a comparison (such as a DO UNTIL function) using one of the stack registers to campare, how do I adress the stack register in the program?

Generally speaking you can either leave the number on the stack or depending on what the stack traffic and DEPTH is like during the loop, it may be easier to save to a local or global variable.

If the number is on the stack, the addressing mode varies according to depth. If you know it is always at stack position P you can grab a copy by using P ROLL and put it back by P ROLLD. There are easier, faster ways if you know the stack depth of the counter, and especially when the depth is 3 or less. The WHILE/REPEAT loops may also help. If you have a partial program, perhaps there is more to say. Are you optimizing for speed or size?

Edited: 28 June 2008, 8:34 p.m.

#3

Hi Allen, thanks for your response.

I will only be using what's in stack level 1 in my do until loop, adding 1 to it and comparing it to 50, so the construct would look like this:
DO 1 +

UNTIL stack level 1 > 50

END

the problem is, I don't know what nomenclature to use for stack level 1 so the calculator will recognize it...do I refer to it in the program as level 1, L1, LVL1, or what? I tried just leaving it blank, like this:

DO 1 +

UNTIL > 50

END

thinking it would default to stack level 1 and compare it to 50 in the absence any other specific variable, but that didn't seem to work.

I realize I could put level 1 into a variable and use that in the do until loop, but I was just hoping there was a way to directly use the contents of level 1 (or any other stack level, for that matter) in my do until loop.

Hope this clarifies my plight for you.
Thanks, and best regards, hal


P.S. Anybody out there know how to force a screen update during program execution without halting or pausing the program?

thanks again, hal

#4

Hi,

it seems there is some misunderstanding on how an RPL data stack works.

The RPL data stack (and nearly all other stacks in an RPL machine)

work in a different way than the fixed data stack of an RPN calculator.

Please take a look at an appriorate RPL tutorial,

which can be found on (and through) www.hpcalc.org

For the 2nd question:

I know how to refresh the display during prg run in SysRPL,

but I don't know if there's such a statement in UserRPL.

I assume you actually want to show the contents of the data stack,

so you could write a very small program to do that.

Alternatively you could call some suitable SysRPL entries to do that work;-)


HTH

Raymond

#5

Quote:
DO 1 +
UNTIL > 50
END

A couple of issues. Comparison operators pop two values off the stack and comparison operators should be postfix. Type in your 48/49/50:
1 2 >
Your calc will return '0' to the stack, and the 1 and 2 will be removed from the stack. Reverse the 1 and 2 and '1' will be returned. The return value of '0' or '1' is used by UNTIL (also popped).

Your counting program should look like:

DO
1 +
DUP
UNTIL 50 > END
or
DO
1 +
DUP 50 > UNTIL END
I prefer the later, i.e. keeping it all postfix just like FORTH:
BEGIN
1 +
DUP 50 > UNTIL

Edited: 29 June 2008, 1:34 p.m.

#6

Quote:
P.S. Anybody out there know how to force a screen update during program execution without halting or pausing the program?
thanks again, hal

I recommend reading Chapter20 RPLMAN (from hpcalc.org).
I do not often dabble in programs that take longer than the screen where I need to update.

FWIW, I agree with egan regarding the syntax for your loop:

DO
1 +
DUP 50 > UNTIL END

but if this is all you are doing, it is better just to use

1 WAIT

If there are actual inputs and outputs to your loop (other than the counter), There is almost certainly a better way.

#7

I'd suggest you to read the manuals before asking here for help. If someone can not figure out how DO UNTIL works and calls it function any help is pouring water in sand

#8

Hello Reth

Quote:
I'd suggest you to read the manuals before asking here for help.

Agreed. I have read the manuals (48g and 50g guides). I was seeking help on two specific tecniques which were not forthcoming from the documentation. Egan Ford, and Allen were both kind enough to offer very good insight, all delivered within a few lines. How would this possibly supplant reading the manual?

Quote:
If someone can not figure out how DO UNTIL works and calls it function any help is pouring water in sand

I'm assuming that you are basing this assessment on the fact that I called DO UNTIL a function, whereas "loop construct" would have been more appropriate. I'm going to give you the benifit of the doubt on this point, that you're not trying to insult my intelligence. The aforementioned help which I recieved was put to good use, and has resolved the issue I was having. This was most certainly NOT analagous to pouring water onto sand.

I think that in the future I will continue to ask for a bit of help from time to time, in spite of the possibility of being rebuked by you.

Best regards, Hal
#9

I am a regular visitor to the forum but an infrequent contributor. I nonetheless find your questions and comments to be appropriate and I have always found them to be worthy of asking those on this forum who may know a bit more about RPL programming than the average user. I am a RPL beginner myself and learn a great deal from the Q&A strings.

Good response.

Jeff Kearns

#10

I'm sorry, Hal, I didn't want to be abusive, I only remembered how I myself worked it out some 20 years ago (it was the HP28s) having only german language manual and not understanding a word, only figured it out by the examples given and coming from the HP41 experience; Back then I was so much in love with those calculators so I started understanding foreign languages ;)


Best regards,


Reth

#11

Thank you Reth...

No offence taken. Until I started collecting 4 years ago, I had no RPL experience at all...only keystroke programming (starting with my HP 29C in the late 70's). I'll be the first to admit that there are times I become impatient and fire off a question on this forum that I probably could have answered myself with a bit more perseverance.

Speaking of the 41C, I have a couple of 41cx's...wonderful machines. One of them is presently on display at the advanced math and science school that my 12 yr old son attends. (HP is one of the sponsors of that school). Who knows, maybe (hopfully!) that display will spark one of the kids to at least look at an HP machine at some point in the future (because I assure you, they all have TI's right now...except my son, who loves his 33s!).

Best regards, Hal



Possibly Related Threads…
Thread Author Replies Views Last Post
  Writing RPL programs on OS X Sean Freeman 18 5,037 11-30-2013, 03:59 PM
Last Post: Sean Freeman
  48G vs 49G+ User RPL Speed Comparison John Colvin 7 2,536 11-16-2013, 10:07 PM
Last Post: Han
  RPL 32 David Hayden 4 2,029 11-11-2013, 11:34 AM
Last Post: David Hayden
  HHC / HP Museum Programming Contest for RPN and RPL machines Gene Wright 18 5,450 09-22-2013, 09:39 AM
Last Post: Miguel Toro
  [41CL] A couple more rhetorical questions Monte Dalrymple 1 1,215 07-12-2013, 09:28 AM
Last Post: Ángel Martin
  Disaster: help for a couple of HP97 needed! Jose Gonzalez Divasson 10 2,900 01-21-2013, 04:45 PM
Last Post: aurelio
  RPL long vs. short names peacecalc 5 1,983 10-30-2012, 01:25 PM
Last Post: peacecalc
  Mini-challenge: HHC2012 RPL programming contest with larger input David Hayden 14 3,536 10-05-2012, 10:36 PM
Last Post: David Hayden
  HHC 2012 RPL Programming Contest Gene Wright 33 7,515 09-27-2012, 01:57 AM
Last Post: Werner
  HHC 2012 programming contests coming soon (RPN and RPL) Gene Wright 9 2,622 09-21-2012, 03:38 PM
Last Post: Paul Dale

Forum Jump: