Post Reply 
HP50G help as POP command —> insufficient memory
11-28-2023, 02:45 PM (This post was last modified: 11-28-2023 02:46 PM by Gil.)
Post: #1
HP50G help as POP command —> insufficient memory
With HP50G EMU48
I used many times PUSH and POP commands.

Always with no problem.

Then I did something wrong, but I don't know what.

When I execute now a program with PUSH (or when simply pressing PUSH), then I press POP and get the message 'POP Error : insufficient memory' and fall into the directory CASDIR.

Then I tried and deleted a lot of directories.

From the command line I execute a PUSH command.

But, after execution of POP, I always the same MESSAGE and "arrival" at CASDIR directory.

How can I reinitialize the PUSH/POP memory?

Thanks in advance for your help.

Regards,
Gil
Find all posts by this user
Quote this message in a reply
11-28-2023, 03:02 PM (This post was last modified: 11-28-2023 03:02 PM by Gil.)
Post: #2
RE: HP50G help as POP command —> insufficient memory
I tried ON+"C"Key.

With no success.
Find all posts by this user
Quote this message in a reply
11-28-2023, 04:21 PM
Post: #3
RE: HP50G help as POP command —> insufficient memory
(11-28-2023 02:45 PM)Gil Wrote:  How can I reinitialize the PUSH/POP memory?

Before trying to purge the PUSH/POP memory, please try the following:

Code:
{ HOME CASDIR }
'ENVSTACK' BYTES

...and report back with the result.

On a normally-functioning system, the following will release any PUSH'ed flag/path settings:
Code:
{ HOME CASDIR }
'ENVSTACK' PURGE

The flags and current path are added to the beginning of the ENVSTACK variable (which is a list) every time you execute a PUSH. Subsequent POP executions retrieve and delete the first entry in the list for restoration.

If for some reason you have executed significantly more PUSHs than POPs, that would result in a large ENVSTACK variable that the system may not be able to edit successfully.
Find all posts by this user
Quote this message in a reply
11-28-2023, 06:10 PM
Post: #4
RE: HP50G help as POP command —> insufficient memory
Thanks for your quick reply, David.

I did as suggested:
{ HOME CASDIR }
'ENVSTACK' BYTES
The output indicated that there were some 27bytes used.

Then I did, again following your instruction:
{ HOME CASDIR }
'ENVSTACK' PURGE

... and now everything seems to work fine.

Many, many thanks again, David.

But a last question
After the above, I tried again:
{ HOME CASDIR }
'ENVSTACK' BYTES
And the output is the following message:
"BYTES Error:
Undefined name"

Is that correct?

Should I create a fictive variable ENVSTACK ?

Regards,
Gil
Find all posts by this user
Quote this message in a reply
11-28-2023, 07:12 PM
Post: #5
RE: HP50G help as POP command —> insufficient memory
(11-28-2023 06:10 PM)Gil Wrote:  But a last question
After the above, I tried again:
{ HOME CASDIR }
'ENVSTACK' BYTES
And the output is the following message:
"BYTES Error:
Undefined name"

Is that correct?

Should I create a fictive variable ENVSTACK ?

The ENVSTACK variable isn't created until a PUSH is executed. So following the above steps left you without one. As soon as you execute another PUSH, CASDIR will have one.

It's interesting that your previous ENVSTACK variable was only consuming 27 bytes, which should be a simple matter for the system to handle. So it's possible that the ENVSTACK variable (or something else in the CASDIR) was malformed or corrupted in some way. That can be an indicator of some other issues lurking in the memory configuration. This might be a good time to get a backup of the contents of your Emu48 calculator.
Find all posts by this user
Quote this message in a reply
11-28-2023, 07:24 PM (This post was last modified: 11-28-2023 07:31 PM by Gil.)
Post: #6
RE: HP50G help as POP command —> insufficient memory
Sorry : I meant 27 k bytes.

And please note, yes, that after some misadventures a couple of years ago, I save now regularly my directory called HOME1 (to be found in {HOME}), which contains all my other directories and programs.

By the way, is there a better way to save everything created in EMU48?

Regards,
Gil
Find all posts by this user
Quote this message in a reply
11-28-2023, 07:34 PM
Post: #7
RE: HP50G help as POP command —> insufficient memory
(11-28-2023 07:24 PM)Gil Wrote:  Sorry : I meant 27 k bytes.

Ahh... that makes more sense. That one little letter (k) makes a big difference here. Smile

That still begs the question: why so many stored PUSHs that haven't been balanced with POPs? Is something on your 50g repeatedly doing a PUSH that never gets POP'd?
Find all posts by this user
Quote this message in a reply
11-28-2023, 07:40 PM
Post: #8
RE: HP50G help as POP command —> insufficient memory
I think I might have called inadvertently a full directory as an argument for a program containing the PUSH and POP commands.

It seems now that all is working fine. Or should.
I'll still confirm that later.

Regards and thanks for your painstaking — absolutely great to have such nice and brilliant people on that forum.

Regards, Gil
Find all posts by this user
Quote this message in a reply
11-28-2023, 11:17 PM
Post: #9
RE: HP50G help as POP command —> insufficient memory
(11-28-2023 07:34 PM)DavidM Wrote:  That still begs the question: why so many stored PUSHs that haven't been balanced with POPs? Is something on your 50g repeatedly doing a PUSH that never gets POP'd?

In my case I had inserted a HALT command in the middle of a program while trying to debug it. As a result I ended up with that 27k file in one of my HP50g’s and had no idea why I was getting those “Insufficient Memory” messages. Too many PUSHes with no POPs… I should have known better.

Thank you very much!

Gerson.
Find all posts by this user
Quote this message in a reply
11-29-2023, 12:14 AM (This post was last modified: 11-29-2023 12:20 AM by Gil.)
Post: #10
RE: HP50G help as POP command —> insufficient memory
Suggestion of Gerson:
it's indeed part of my problem/solution with the PUSH at the beginning the debugging process and then leaving the program before the execution of the POP command.

Worse: in my working directory, I have discovered that I had inserted in one of the programs two induly PUSH commands (instead of a single PUSH command).
Find all posts by this user
Quote this message in a reply
11-29-2023, 12:30 AM
Post: #11
RE: HP50G help as POP command —> insufficient memory
(11-29-2023 12:14 AM)Gil Wrote:  Suggestion of Gerson:
it's indeed part of my problem/solution with the PUSH at the beginning the debugging process and then leaving the program before the execution of the POP command.

It's easy to do. I believe the reason I remembered this issue is that I had run into it myself some time back.

If I'm writing User RPL code and need to save the flag status, I now tend to put it into a local or simply leave it on the stack (where appropriate) instead of using the PUSH/POP commands. That way an early/unplanned exit won't leave the flag status in the CASDIR.
Find all posts by this user
Quote this message in a reply
11-29-2023, 12:44 AM
Post: #12
RE: HP50G help as POP command —> insufficient memory
I seem having gone the wrong way : contrarily to David, I used to save the flag into a local variable, until I discovered the beauty of the PUSH and POP commands in this forum, not aware of its pitfall.
Find all posts by this user
Quote this message in a reply
11-29-2023, 03:51 AM
Post: #13
RE: HP50G help as POP command —> insufficient memory
Not to mention that « RCLF SWAP SWAP STOF » is one byte shorter than « PUSH POP »
Find all posts by this user
Quote this message in a reply
11-29-2023, 10:47 AM (This post was last modified: 11-29-2023 11:29 AM by Gil.)
Post: #14
RE: HP50G help as POP command —> insufficient memory
Yes for the length in such an easy case.

But PUSH and POP will be shorter if at the end of your program you have more than two outputs,
requiring a «RCLF SWAP [...] # Roll STOF»,
with # standing for 4,5,6 asf.

Or if, in the middle of a program, you have several stacks level occupied (and say only one final stack level occupied).
Then «RCLF # ROLLD [...] SWAP STOF» will have more bytes than PUSH and POP,
again with # standing for 4, 5, 6 asf.

Besides, PUSH and POP commands save directory path, which can be useful when moving into a different directory inside a program. Then, that combination of commands is shorter.
Find all posts by this user
Quote this message in a reply
11-29-2023, 10:06 PM
Post: #15
RE: HP50G help as POP command —> insufficient memory
(11-29-2023 12:44 AM)Gil Wrote:  I seem having gone the wrong way : contrarily to David, I used to save the flag into a local variable, until I discovered the beauty of the PUSH and POP commands in this forum, not aware of its pitfall.

There's not really a wrong or right here, as it really depends on the overall program which method might be considered "better". As always, there's lots of approaches and any of them could be considered better or worse depending on the task at hand.
Find all posts by this user
Quote this message in a reply
11-29-2023, 10:54 PM (This post was last modified: 11-29-2023 10:59 PM by Gil.)
Post: #16
RE: HP50G help as POP command —> insufficient memory
"There's not really a wrong or right here, as it really depends on the overall program which method might be considered "better". As always, there's lots of approaches and any of them could be considered better or worse depending on the task at hand."

Indeed.
But I understand now that having a PUSH command at the beginning of a (not well checked) program and then having that program interrupted by some impossible calculation, so that the POP command is not executed, might cause a memory problem, above all by repeated program interruption and non-execution of that POP command.

By the way, how do you put here, in a white box, a quotation from the post of another person?
Find all posts by this user
Quote this message in a reply
11-30-2023, 12:35 AM
Post: #17
RE: HP50G help as POP command —> insufficient memory
(11-29-2023 10:54 PM)Gil Wrote:  By the way, how do you put here, in a white box, a quotation from the post of another person?

You mean like the above? Smile

I start by clicking the "QUOTE" button on the bottom right of the post that I'm responding to:
[Image: gil_pic_1.png]

This should bring up the post editing window that is currently filled with a quote of the entire post that you are quoting. The quoted text is bracketed with "quote" and "/quote" tags:
[Image: gil_pic_2.png]

Edit out the text that's not important, then type in your response below the closing bracket:
[Image: gil_pic_3.png]

The attribution text in the opening bracket tag is optional, but helpful. If you're simply quoting something else and don't have the original reference, just bracket it with plain quote tags like this:
Code:
[quote]
"Eh.... what?"
[/quote]
Quote:"Eh.... what?"

...or perhaps provide just the name:
Code:
[quote=Albert Einstein]
\(E=mc^2\)
[/quote]
Albert Einstein Wrote:\(E=mc^2\)
Find all posts by this user
Quote this message in a reply
11-30-2023, 01:02 AM (This post was last modified: 11-30-2023 01:03 AM by Gil.)
Post: #18
RE: HP50G help as POP command —> insufficient memory
(11-30-2023 12:35 AM)DavidM Wrote:  I start by clicking the "QUOTE" button on the bottom right of the post that I'm responding to

Just as a test answer —
with my thanks for your explanations, David.

I had not paid attention to this box-option "quote"; well thought.

I just notice that in your example of Albert Einstein (or my post quoting you), the verb wrote comes induly with a capital W.

Regards
Find all posts by this user
Quote this message in a reply
Post Reply 




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