Post Reply 
Resurrecting FORTH-41
12-04-2020, 08:26 AM (This post was last modified: 12-15-2020 02:34 PM by Ángel Martin.)
Post: #1
Resurrecting FORTH-41
No, it's not Groundhog Day even if it may feel like it .... ;-)

Well folks, you may or may not remember my previous investigations on the FORTH-41 Module, loosely gathered in this thread: "FORTH-41: The most misunderstood HP-41 Module"

As we left things back then, there were several code segments unaccounted for (potential dead code), and multiple glitches in the operation of the FORTH environment - always difficult to tell them apart from actual issues due to the lack of proper documentation so we were flying blind (especially not knowing FORTH to begin with) . I wasn't happy about that provisional conclusion, so I was determined to dig deeper into the subject at a later day... which has finally arrived -

This time around I've engaged Greg McClure as well, who collaborated in "poking the bear" and offered helpful suggestions to proceed. The MCODE inspection has been done with a finer tooth comb, really painstakingly going thru lots of areas with functionality only assumed in previous attempts. A lot of work for sure, but it has paid off. So, are we done? Not completely, but I've moved things to a point where we're starting to see positive results.

Here's a quick summary of the findings and improvements. -

1. I dialed down my zeal for bug finding (while keeping the search). Whilst it's true there were a few typos in the original code, I got a little carried away. It's now obviously evident to me that this ROM wasn’t a casual work and that it was written by competent and knowledgeable programmers. So, I revised my previous findings and undid two of the "corrections" that turned out not to be necessary at all. After a couple of weeks revising the code, I'm glad to say it's all accounted for (99.5% of it at least), no significant dead code areas to speak about. Some of the trouble areas were tricky to figure out because some functions and routines use parameters to call other subroutines, quite some wizardry at play not obvious at all and without a manual it's difficult to get your bearings.

2. Small feat but nevertheless adding clarity, I renamed the two section headers in CAT’2 from “- - -“ to more meaningful description, as follows:
-FORTH41+
-COMPILER
-PRIMITIVES


3. I’ve improved the displaying of the “OK” prompt in two ways: (1) it's not shown during an error message (when things are definitely not ok), and (2) it adds a colon if the data stack is not empty “OK:” - which may appear superfluous or even useless to you but to me it’s a godsend; it always bothered me not knowing for sure if the stack was empty.

4. I’ve managed to squeeze in four more Forth-79 primitives into the ROM dictionary (no more space available), resulting in a new grand total of 135 words. The new ones are listed below, perhaps not earth-shuttering but it's a rewarding addition to the ROM.

2*
2/
?DUP
DEPTH


5. Reversed-engineered numerous functions trying to understand their implementation details. The X-MEM support for code loading into the RAM dictionary was particularly important to try the excellent examples provided by Egan Ford (see thread at the beginning of the article), and I’m glad to say it works as advertised - now a single LOADF away– well that is if it’d ever been advertised, which it wasn’t since no mention to that was made in the proto-manual, and none of these were ever documented before. For instance, did you know that with user flag 18 set the HP-IL output device becomes a terminal console? Watching this in action on V41 with ILPER is worth the relative high price of admission ;-)

6. Finally, the biggest and by far most important component of FORTH-41 is beginning to emerge in all splendor: The Forth Buffer structure - including the Status Registers, Data Parameter Block, Input Command Line section, PAD area, and dictionaries. A lot of trial and error went in here, and still not completely deciphered to be sure but substantial progress has been made. More to come in the following weeks, stay tuned.

All in all, there is still much more to dig into and possible areas for improvement, but I though that even if not final, the current status was worthy of an article to share the news with folks interested in the subject. I'm slowly preparing a short manual and detailed "blueprints" with all my notes on the m-code; as always they'll be posted at the usual places as soon as they're done.

Granted, FORTH-41 isn't the fastest or smartest forth in town but what a wonderful contribution it was to the 41 acumen, a very tall order resolved in a very ingenious way, pulling all the MCODE stops to make it work. My admiration for the job and my thanks to its developers - reportedly Serge Vaudenay first, with further collaboration by the PANAME authors Stéphane Bariziene and Jean-Jacques Dhénin ; kudos and respect!

Go Forth!


Attached File(s)
.zip  FORTH41+.zip (Size: 18.04 KB / Downloads: 115)
.pdf  forth41-English.pdf (Size: 1.19 MB / Downloads: 193)

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
Post Reply 




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