Possibility for comment lines?

General discussion about calculators, SwissMicros or otherwise
jthole
Posts: 114
Joined: Mon Nov 27, 2017 8:46 pm
Location: Netherlands

Possibility for comment lines?

Post by jthole »

Of course RPN was designed to be efficient, so inline comments were not really an option on the classic HP calculators.

But since the DM41X and DM42 don't have these limitations anymore; has anyone come up with a clever idea to insert comments in their programs?

The only thing I can think of, is to do a "FS?" on a specific flag, and to use that for jumping over the next (comment) line. But then each comment automatically consumes two lines, and interesting things happen when that flag does change state at some point :lol:

Thanks for your ideas!
User avatar
Guenter
Posts: 163
Joined: Wed May 24, 2017 6:26 pm
Location: Germany

Re: Possibility for comment lines?

Post by Guenter »

I think that intelligible inline comments would consume so much space that 2 additional bytes for "FS? XX" are negligible . Flag 14 looks like a good candidate, as it will be cleared every time you switch on the calculator. To my knowledge it's not automatically set by any operation. And once you used it perhaps to overwrite a protected magnetic card, somewhat difficult on a DM41X 8-) , it's cleared again.
Günter
DM42 SN:00004 and SN:00184 -- DM41X SN:00013 and SN:00955
rprosperi
Posts: 1118
Joined: Mon Apr 24, 2017 7:48 pm
Location: New York

Re: Possibility for comment lines?

Post by rprosperi »

Another approach used 'back in the day' was to insert a statement containing an Alpha string comprised of the comment, followed by CLA. If the comment is longer than the 22-char limit, you can use multiple statements. Of course this won't do at all if it's within code that is using Alpha contents.

In the later RPL machines, this simply became adding "this is my comment" DROP, which was stack neutral.
--bob p

DM42: β00071 & 00282, DM41X: β00071 & 00656, DM10L: 071/100
Thomas Okken
Posts: 922
Joined: Tue May 02, 2017 5:48 pm
Location: United States
Contact:

Re: Possibility for comment lines?

Post by Thomas Okken »

Guenter wrote:
Fri Dec 04, 2020 5:57 pm
I think that intelligible inline comments would consume so much space that 2 additional bytes for "FS? XX" are negligible . Flag 14 looks like a good candidate, as it will be cleared every time you switch on the calculator. To my knowledge it's not automatically set by any operation. And once you used it perhaps to overwrite a protected magnetic card, somewhat difficult on a DM41X 8-) , it's cleared again.
That won't work on the DM42, because it (and Free42 and the real HP-42S) doesn't clear flags 11-20 on power-up. You could test one of the unused "reserved" flags, but that may not be future-proof, as Free42 already uses five of those flags, and maybe more in the future... Testing flag 52, the PRGM mode flag, should be reliable, though.
User avatar
Guenter
Posts: 163
Joined: Wed May 24, 2017 6:26 pm
Location: Germany

Re: Possibility for comment lines?

Post by Guenter »

Ooops I've only looked at the DM41X
Günter
DM42 SN:00004 and SN:00184 -- DM41X SN:00013 and SN:00955
jthole
Posts: 114
Joined: Mon Nov 27, 2017 8:46 pm
Location: Netherlands

Re: Possibility for comment lines?

Post by jthole »

Thanks all! I am currently waiting for my DM42, and of course I am looking for a method that works on both the DM41X and DM42. It looks like flag 14 would be a safe choice as well.

(The DM42 was shipped yesterday by Michael ... should be here early next week!)
grsbanks
Posts: 1104
Joined: Tue Apr 25, 2017 11:23 am
Location: Preston, Lancs, UK
Contact:

Re: Possibility for comment lines?

Post by grsbanks »

jthole wrote:
Sat Dec 05, 2020 9:09 am
(The DM42 was shipped yesterday by Michael ... should be here early next week!)
Shipments to .nl are taking about 10 days at the moment. It's longer than usual.
There are only 10 kinds of people in the world: those who understand binary and those who do not.
jthole
Posts: 114
Joined: Mon Nov 27, 2017 8:46 pm
Location: Netherlands

Re: Possibility for comment lines?

Post by jthole »

grsbanks wrote:
Sat Dec 05, 2020 10:17 am

Shipments to .nl are taking about 10 days at the moment. It's longer than usual.
Last week's shipment (my repaired DM41X) only took three days or so. 10 days sounds very unusual, given that Michael sends everything as a letter, and not as a parcel (at least, I hope he did now as well).

Edit: sent Nov 26, arrived here Nov 28. Let's hope the DM42 doesn't take that much longer :)
Thomas Okken
Posts: 922
Joined: Tue May 02, 2017 5:48 pm
Location: United States
Contact:

Re: Possibility for comment lines?

Post by Thomas Okken »

jthole wrote:
Sat Dec 05, 2020 9:09 am
Thanks all! I am currently waiting for my DM42, and of course I am looking for a method that works on both the DM41X and DM42. It looks like flag 14 would be a safe choice as well.
I'd go with 52, not 14. Programs written for the HP-42S could conceivably use flag 14 since it has no special meaning there; flag 52, on the other hand, is guaranteed to be clear while a program is running, and that is true for the 41 series and the 42S/Free42/DM42.
jthole
Posts: 114
Joined: Mon Nov 27, 2017 8:46 pm
Location: Netherlands

Re: Possibility for comment lines?

Post by jthole »

Thomas Okken wrote:
Sat Dec 05, 2020 10:42 am
I'd go with 52, not 14. Programs written for the HP-42S could conceivably use flag 14 since it has no special meaning there; flag 52, on the other hand, is guaranteed to be clear while a program is running, and that is true for the 41 series and the 42S/Free42/DM42.
Excellent, thanks! 52 it is.

And the reason for all this? Last year I created some (for me) useful programs, that I wanted to improve now that I had a bit of time again. And that's when the lack of documentation hit me hard :lol:
Post Reply