Deleting the .END. (maybe)
Deleting the .END. (maybe)
Sorry, this might be more of an HP42 question - but I'm doing in on my fantabulous DM42, so here goes.
If I write a program at the end of the program memory (GTO ..) and label it, it shows up in the XEQ list which is fine and exactly what I would expect. If I then delete the program (CLP), it deletes all the stuff from the LBL to the .END., but now the .END. shows up in the XEQ list.
Is there some way to remove that .END. (I realize that it is the "final" end marker, but it doesn't always exist (for instance, it doesn't show up if you never do a GTO .. command)).
I've scoured the manuals, but I can't seem to find out if it is possible. I have removed it by clearing all program memory, but that's not quite what I want...
Thanks!!
If I write a program at the end of the program memory (GTO ..) and label it, it shows up in the XEQ list which is fine and exactly what I would expect. If I then delete the program (CLP), it deletes all the stuff from the LBL to the .END., but now the .END. shows up in the XEQ list.
Is there some way to remove that .END. (I realize that it is the "final" end marker, but it doesn't always exist (for instance, it doesn't show up if you never do a GTO .. command)).
I've scoured the manuals, but I can't seem to find out if it is possible. I have removed it by clearing all program memory, but that's not quite what I want...
Thanks!!
Re: Deleting the .END. (maybe)
You have to delete the "END" (note the absence of periods either side of it) instruction from the previous program in memory.
There are only 10 kinds of people in the world: those who understand binary and those who do not.
-
- Posts: 1107
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: Deleting the .END. (maybe)
In addition to what grsbanks said, I would like to point out that the .END. does, in fact, always exist. It's the only instruction in program memory that is created at Memory Clear, and it's the only instruction that cannot be deleted. Even if you never do a GTO .. command, it's there.
It may not always show up in the PGM catalog, but that's just like with the regular END instructions: they are only shown in the PGM catalog if the program they terminate contains no global labels.
Re: Deleting the .END. (maybe)
Explaining a tiny bit further - The reason it must be there in the catalog is to give you a means to get to that program context (always the last program w/o a global label or an END), which you otherwise could not access.Thomas Okken wrote: ↑Fri May 22, 2020 11:14 amIt may not always show up in the PGM catalog, but that's just like with the regular END instructions: they are only shown in the PGM catalog if the program they terminate contains no global labels.
--bob p
DM42: β00071 & 00282, DM41X: β00071 & 00656, DM10L: 071/100
DM42: β00071 & 00282, DM41X: β00071 & 00656, DM10L: 071/100
-
- Posts: 18
- Joined: Tue Jun 09, 2020 11:21 am
Re: Deleting the .END. (maybe)
I still don't understand.
Same situation here .END. in catalog, can't delete it.
So indeed i called the program editor, which indeed contained an empty program, I added LBL "AAA",
Then CLEAR -> CLP -> AAA and checked again.
The little creep is still there. Why ?
Same situation here .END. in catalog, can't delete it.
So indeed i called the program editor, which indeed contained an empty program, I added LBL "AAA",
Then CLEAR -> CLP -> AAA and checked again.
The little creep is still there. Why ?
Re: Deleting the .END. (maybe)
Which 'little creep'?
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
Re: Deleting the .END. (maybe)
For what it's worth, here's my explanation of the situation. At least this is how I understand it.
It is probably best not to think of all programs as separate. They are not. There is only one memory. When you start writing programs you start to fill up the memory from the top and work your way down to the bottom. So all instructions form a single, very long list from which the DM42 executes only the portion of code you are interested in. To give the necessary structure to the list you add labels (LBL commands) in-between to mark the beginning of programs and ends (END) to mark their ends. So what you have is like this:
For the program menu the DM42 introduces an imaginary cut before each "END" and puts each part as an entry into the program menu.
We see that three program list entries, "AAA", "BBB" and "CCC" are created. Now let us consider what happens if you delete program "BBB". So everything from the label "BBB" to the final END is removed from memory and the list becomes shorter.
So far so good. Now let us delete "CCC". However, the final .END. cannot be deleted. Otherwise the calculator would not know where the actively used programming space ends and where the random bit-garbage of the remaining memory starts. With that in mind we have:
So we end up with a single ".END." forming a program by itself. I don't know why the engineers of HP chose to just not ignore this lone label (which also irritates me quite a bit always) but that is how this seems to be treated. Finally, if we do what was already mentioned before, delete the END of the preceding program, we have:
Only a single program section exists and this one gets the label AAA.
I hope this helps. And please everybody correct me if this is actually not how it works.
It is probably best not to think of all programs as separate. They are not. There is only one memory. When you start writing programs you start to fill up the memory from the top and work your way down to the bottom. So all instructions form a single, very long list from which the DM42 executes only the portion of code you are interested in. To give the necessary structure to the list you add labels (LBL commands) in-between to mark the beginning of programs and ends (END) to mark their ends. So what you have is like this:
Code: Select all
LBL "AAA"
...
END
LBL "BBB"
...
END
LBL "CCC"
...
.END.
For the program menu the DM42 introduces an imaginary cut before each "END" and puts each part as an entry into the program menu.
Code: Select all
LBL "AAA" -> AAA
...
END
-----------------
LBL "BBB" -> BBB
...
END
-----------------
LBL "CCC" -> CCC
...
.END.
We see that three program list entries, "AAA", "BBB" and "CCC" are created. Now let us consider what happens if you delete program "BBB". So everything from the label "BBB" to the final END is removed from memory and the list becomes shorter.
Code: Select all
LBL "AAA" -> AAA
...
END
-----------------
LBL "CCC" -> CCC
...
.END.
So far so good. Now let us delete "CCC". However, the final .END. cannot be deleted. Otherwise the calculator would not know where the actively used programming space ends and where the random bit-garbage of the remaining memory starts. With that in mind we have:
Code: Select all
LBL "AAA" -> AAA
...
END
-----------------
.END. -> .END.
So we end up with a single ".END." forming a program by itself. I don't know why the engineers of HP chose to just not ignore this lone label (which also irritates me quite a bit always) but that is how this seems to be treated. Finally, if we do what was already mentioned before, delete the END of the preceding program, we have:
Code: Select all
LBL "AAA" -> AAA
...
.END.
I hope this helps. And please everybody correct me if this is actually not how it works.
Re: Deleting the .END. (maybe)
The last program in memory (no matter whether with instructions or empty) requires the .END. or an END because otherwise you would not be able to reach it (execute, delete, edit) if it does not have a name label.
Also there would be an inconsistency in operation:
needs RTN, END or .END. to return to program AAA and execute "PI +" without it would stuck after "2 *"
Code: Select all
LBL "AAA"
x^2
END
2
*
PI
+
END or .END. -> without this you can't access the 2nd (nameless) program after gto AAA or xeq AAA
Code: Select all
LBL "AAA"
XEQ "BBB"
PI
+
END
LBL "BBB"
2
*
My programmable calculators - former: CBM PR100, HP41CV, HP28S, HP11C - current: HP48G(256kB), HP35S, Prime, DM41X, DM42
Re: Deleting the .END. (maybe)
Please refer to p118 of the (English language) manual of the HP-42S. The .END. is the permanent END.
If you don't already have this manual, I urge you to download it. It is available from, among other places, Eric Rechlin's "HP Literature" compendium at https://literature.hpcalc.org.Program ENDs
Programs are separated from one another with END instructions. The last program in memory uses the permanent END, which appears in the display as .END..
After the first program in memory, you should insert an END between subsequent programs so they will be considered as separate programs, and not just labeled routines within the same program. There are two ways to enter an END at the end of a program:
Because END instructions separate programs, deleting an END instruction causes the two programs to be joined as one program. You cannot delete the permanent .END..
- Press [Shift] GTO .. - This procedure automatically inserts an END after the last program in memory and positions the program pointer to the new program space at the bottom of program memory. This space contains the null program:
Code: Select all
00 { 0-Byte Prgm } 01 .END.
- Or, manually execute the END function (press [XEQ] [ENTER] END [ENTER] or use the function catalog.
There are only 10 kinds of people in the world: those who understand binary and those who do not.