GETSUB?

GETSUB?

Postby bobwolfson » Wed Dec 26, 2012 6:55 pm

I just added a 41CX to my collection and am learning what it can do. It's a fun thing, and I'm having a good time.

One thing I've tried to do is to come up with a scheme whereby some sort of small, always-resident program could swap other larger programs in from extended memory, execute them, and delete them. Of course, I've read the manual about GETP and GETSUB and experimented with both. Am I wrong or does GETSUB inevitably add a spurious END above/before the target function every time, which you can't get rid of except by finding it in catalog 1? Doesn't this make the function just about useless in as much as every call leads to a wasted register?

What am I missing? I imagine there's a way to get rid of the extra END via synthetic programming, but one should not have to resort to an outside-the-box solution for this behavior of a standard function.
bobwolfson
..
..
 
Posts: 5
Joined: Wed Dec 26, 2012 6:39 pm

Re: GETSUB?

Postby Garth » Sat Dec 29, 2012 4:39 am

Yep, I just tried it. I'd say it's a bug, and makes the function nearly useless. Perhaps one of the aftermarket modules has a subtitute that works right. If you were to go to the extent of synthetic programming though, I think you can execute programs in extended memory without bringing them into main memory at all. I have not gone that far in synthetics though, so I don't know how to do it. I enjoy my ZENROM for a big handful of direct-key synthetics. Another possibility is that there are utilities in the aftermarket modules that do what you want, maybe in machine language so they're far faster, without taking much main memory at all. If you need lots of data registers, the Advantage ROM can handle matrices in extended memory without bringing them into main memory. I don't know what kind of applications you do. My longest programs (20 pages) have been for data acquisition and control of lab instruments in the late 1980's. The other programs have ranged from a dozen bytes to a few hundred, and there are 23 programs in there right now with 33 global labels. A few of those programs have been there continuously for over 20 years, without reloading.
Garth
Moderator
Moderator
 
Posts: 290
Joined: Tue Jan 20, 2009 1:31 am

Re: GETSUB?

Postby bobwolfson » Sat Dec 29, 2012 11:45 pm

I don't know if "bug" is the right word. It seems to be an intended feature, though I'm not at all sure what HP was thinking at the time. It seems to have had something to do with backward compatibility with the 65, where programs didn't have END statements.

I found an article in the Sept-Dec 1982 issue of "HP Key Notes" (http://www.hpmuseum.net/pdf/KeyNotes_19 ... es_OCR.pdf) called "About Program Files", and it specifically mentions how GETSUB inserts ENDs: "The GETSUB function always loads a program file into main memory after the last program file; it never overwrites the last program even if the last program contains only the permanent .END. statement. If the user isn't aware of this behavior, the repeated use of GETSUB could clutter main memory with many solitary END statements." The word "could" in the quote is odd, though. As far as I can see, repeated GETSUBs absolutely will leave ENDs all over the place. I can't understand why GETSUB wasn't written to check for an existing END statement before appending one.

What good could ever have come from two ENDs in a row? I await illumination from some HP guru.

FWIW, I'm not actually trying to write any apps for the 41. I'm just playing around, trying to evaluate its architecture and abilities. I've been a software developer for 30+ years, but none of them were spent programming calculators. When I retired a few years ago, I started collecting calculators and slide rules as a hobby (see https://sites.google.com/site/bobscalcu ... liderules/). I've got a 65 (actually 2 of them) a 25, a TI 59, and some Compucorps, but the 41 is the first I've seen that sort of resembles a computer.
bobwolfson
..
..
 
Posts: 5
Joined: Wed Dec 26, 2012 6:39 pm


Return to General Discussion

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 1 guest