HP-41 FORTH; The most misunderstood Module?
|
04-09-2014, 06:11 AM
(This post was last modified: 04-09-2014 11:23 AM by Ángel Martin.)
Post: #1
|
|||
|
|||
HP-41 FORTH; The most misunderstood Module?
Recently I've been looking into the inner guts of the FORTH Module, written by Serge Vaudenay from the PPC Toulouse chapter (Remember Jean-Daniel Dodin and his book "Inside the HP-41"?).
The Module is an 8K configuration, using pages 4 and 5 on the 41C/CV and pages 4 and 7 on the CX (which uses page 5 for the Time Module). From what I can tell looking into the code, a real serious effort went into putting it together; it's thoroughly laid out and contrary to what was reported, seems to offer a decent sent of primitives and sizable vocabulary set. Does anyone know of any application, examples, programs or otherwise narrative covering this module? Was it a stillbirth (I doubt so) or else how come has got into full oblivion? It really feels strange that so much coding effort didn't have any parallel documentation or early adopters contributions at all. Maybe this legend is fed by the scarcity of documentation: I've never seen any QRG or manual for it, only a one-page short article on DataFile V3N4/5 P29 from Autumn 1984. I vaguely remember a manual being included on an eBAY auction, but never bid for it. http://sense.net/~egan/forth41/forth41_v3n45_p29.pdf FWIW, I'll have the blueprint completed in a couple of days - naturally will post the pdf here as soon as it's done, in case you're interested. Cheers,'AM "To live or die by your own sword one must first learn to wield it aptly." |
|||
04-09-2014, 06:18 AM
Post: #2
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
As much as I like Forth, I have to wonder how well the 41 would do at it with its 56-bit registers, bit-serial bus, user RAM that is not wide enough to write your own primitives (8-bit when the 41 uses 10-bit for its machine language), a keyboard that's not particularly good for typing in much text source code, a very slow text editor, etc.. I'm curious though.
http://WilsonMinesCo.com (Lots of HP-41 links at the bottom of the links page, at http://wilsonminesco.com/links.html#hp41 ) |
|||
04-09-2014, 01:00 PM
Post: #3
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
Granted all that, but isn't it particularly strange that *nothing* about this module has ever surfaced to the community? I mean not a single review, comment, example listing... mysteriously untraceable as it is...
I found references to a manual prepared by Emmanuel Compes - I reckon he sold it on eBay in the past. Will anybody know more or have a copy to share? Cheers, ÁM "To live or die by your own sword one must first learn to wield it aptly." |
|||
04-09-2014, 01:22 PM
Post: #4
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
(04-09-2014 06:18 AM)Garth Wilson Wrote: As much as I like Forth, I have to wonder how well the 41 would do at it with its 56-bit registers, bit-serial bus, user RAM that is not wide enough to write your own primitives (8-bit when the 41 uses 10-bit for its machine language), a keyboard that's not particularly good for typing in much text source code, a very slow text editor, etc.. I'm curious though. http://www.hpmuseum.org/cgi-sys/cgiwrap/...ead=140512 Deja vu all over again! It ain't OVER 'till it's 2 PICK |
|||
04-09-2014, 02:30 PM
(This post was last modified: 04-09-2014 02:31 PM by Egan Ford.)
Post: #5
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
(04-09-2014 06:11 AM)Ángel Martin Wrote: Does anyone know of any application, examples, programs or otherwise narrative covering this module? Collected info: http://www.hpmuseum.org/cgi-sys/cgiwrap/...ead=140512 CX Version: http://www.hpmuseum.org/cgi-sys/cgiwrap/...ead=141924 Longest Program: http://www.hpmuseum.org/cgi-sys/cgiwrap/...ead=142105 |
|||
04-09-2014, 07:46 PM
Post: #6
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module? | |||
04-09-2014, 07:59 PM
Post: #7
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
(04-09-2014 07:46 PM)Egan Ford Wrote: A gift from our old friend PeterP to the group: Our friendly neighborhood PeterP(arker)! Greetings, Massimo -+×÷ ↔ left is right and right is wrong |
|||
04-09-2014, 08:10 PM
(This post was last modified: 04-09-2014 08:23 PM by Ángel Martin.)
Post: #8
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
Thank you Egan (and Peter)- will definitely read all about those!
As I said before I'm about 60% done with the MCODE review and should have the "blueprint" done in a few days. I wanted to check the inner guts to see what was done and whether it matches the published details. So far I've seen inconsistent stuff in there, as if there were two different sources. I know there was an initial version using pages 4/5, which was later changed for the CX. The CX version is meant to use page 7 - confirmed by hard-coded calls to page #7 in several places in the code in page#4. But funny enough the code in page#7 does not assume any fixed location (it uses relative port-dependent jumps all along), and furthermore there are a couple of functions in there with calls to HP-IL mass storage routines... quite a contradiction in terms. I'll post the pdf's and will share the EXCEL sheets with anyone interested, the hyperlinks make a big difference. Cheers, 'AM "To live or die by your own sword one must first learn to wield it aptly." |
|||
04-10-2014, 08:56 AM
Post: #9
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
Folks, things don't look just right on the ROM images: the calls to page#7 point at bogus locations, like in the middle of a function name header, or the second byte of a ?NCXQ instruction.
I downloaded the copy from TOS and veryfied the same problem exists, so it's not just my copy. Either that one got corrupt, ot the changes from page #5 to page#7 were not done correctly. I have no copy of the older version (using pages #4 and #5), can you send me a pointer for it? I think this is going to be the only way to tell for sure.. Thanks, ÁM "To live or die by your own sword one must first learn to wield it aptly." |
|||
04-10-2014, 12:08 PM
Post: #10
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module? | |||
04-10-2014, 01:30 PM
Post: #11
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
(04-10-2014 08:56 AM)Ángel Martin Wrote: Folks, things don't look just right on the ROM images: the calls to page#7 point at bogus locations, like in the middle of a function name header, or the second byte of a ?NCXQ instruction. Haven't checked but their names are promising... Greetings, Massimo -+×÷ ↔ left is right and right is wrong |
|||
04-10-2014, 02:51 PM
(This post was last modified: 04-10-2014 02:56 PM by Ángel Martin.)
Post: #12
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
(04-10-2014 01:30 PM)Massimo Gnerucci Wrote: Haven't checked but their names are promising... Nope, those are for the CX version - thanks anyway. I've tried the Clonix package, but no trace of the original one (using pages 4/5). I'll check with Diego but so far we're stuck! Cheers, ÁM "To live or die by your own sword one must first learn to wield it aptly." |
|||
04-11-2014, 09:37 PM
Post: #13
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
Hi all,
Not aware of this thread until Ángel PMs me. As stated in my original post (2008): http://www.hpmuseum.org/cgi-sys/cgiwrap/...ead=141924 I did nothing to the Forth code, therefore the .ROM images are identical either running on a CV or a CX. The fact that this ROM is so poorly documented has probably prevented the problem from showing up earlier. However, now that that our Resident M-code Guru has got his hands on it, chances are that we end up with a more functional and documented tool for our beloved 41s... :-) Enjoy the weekend. Diego. "Do not suppose, check it twice." |
|||
04-12-2014, 08:31 AM
(This post was last modified: 04-13-2014 06:24 AM by Ángel Martin.)
Post: #14
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
Thanks to Egan and Diego for sending the original ROM images - Now it's confirmed that the so called "CX Version" is *identical* to the original one, which let's remember that was meant to be used in pages #4 and #5.
Nomenclature: We'll refer to the "Original Version" when the lower block is located in page#4 and the upper block is located in page#5. Conversely, we'll call "CX version" to the arrangement with the upper block located in page#7 The first fact to note is that within both blocks there are hard-coded calls to page#4 addresses (so far nothing new), but nowhere in either block are hard-coded calls to page #5. This also confirms that the choice for page#7 to allocate the upper block in the "CX version" was the most unfortunate of all - since there are calls to HP-IL routines, therefore conflicting to it. In fact, any other page will work just fine because within the upper block all calls follow the port-dependent form, not hard-coded - as already mentioned. Which functions make use of HP-IL routines, you may wonder? First off there is READEM and WRTEM, a carbon-copy of the PANAME functions of the same names (it's the French connection no doubt :-) But beware, because there are also calls hard-coded to page #7 within the lower block (in page #4) which are normally not executed - there seems to be a back-door triggered by CPU flag 1, I haven't figured out when that is active. So as long as you don't use READEM / WRTEM you may be ok using the "CX version" - albeit not guaranteed due to that circumstance. BTW and FWIW, there was a bug in these that would send the execution to an infinite loop if no X-Memory was present - I fixed it, just a bad jump distance. The upper block is needed for the OS polling point [CALC_ON], used to create a gigantic 198-register buffer, with id#=13. This is where all FORTH code would go, I guess. Before you ask, using a bank-switched implementation to get rid of the page#4 dependency would be theoretically possible, but virtually impossible in practice due to the extensive use of the return stack (four levels used most of the time). Hard-coded calls to page#4 take just one RTN level and preserve the C register, whereas in a BS design the intra-bank calls take two levels and destroy the contents of C - so it'll take a complete re-write of the modules, not feasible at all. The MCODE is very interesting, and shows a comfortable knowledge of the 41 OS. In fact some approaches are very creative and novel to this module, definitely the author knew his way around. There are a couple of bugs I haven't figured out how to correct, like an undocumented CPU instruction (318 in address 49ED), and a call in addresses 4CCE/4CCF to address 3CBC in port#3 - which is obviously wrong given that this was designed for a 41C/CV. I have attached the blueprints as promised. They're not 100% finished, so consider it a work in progress. Particularly discouraging is the fact that the upper block seems to have a lot of dead code, or unaccounted for (see gray fields on the addresses). This is baffling, I may be overlooking something but I have checked for alternative ways to re-direct the execution to those areas, (GOTOADR, manually PUSHADR, etc) finding no suitable matches. Let me know if you figure it out! Also scattered around I marked the suspect lines with a "bug??" label in red. Hope you enjoy this archaeological adventure - if no further discoveries occur I'd propose to rename this module the 'Science-Fiction" ROM ;-) "To live or die by your own sword one must first learn to wield it aptly." |
|||
04-12-2014, 02:48 PM
Post: #15
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module? | |||
04-13-2014, 12:43 AM
Post: #16
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
(04-12-2014 08:31 AM)Ángel Martin Wrote: There are a couple of bugs I haven't figured out how to correct, like an undocumented CPU instruction (318 in address 49ED), and a call in addresses 4CCE/4CCF to address 3CBC in port#3 - which is obviously wrong given that this was designed for a 41C/CV.I haven't checked the Forth blueprint, but at least the CCD module has data isles between code lines. -- Ray |
|||
04-13-2014, 06:24 AM
(This post was last modified: 04-17-2014 06:44 AM by Ángel Martin.)
Post: #17
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
Mystery solved: it was before my nose and couldn't see it. Stay tuned for an updated blueprint soon...
Next iteration attached - a much better picture, even if there's still plenty of rough edges. I'm getting to the conclusion that this module is indeed the mot misunderstood of all... attempting a FORTH interpreter was a very tall order, this is not haphazardly written code but a very remarkable work. PS. removed older version of blueprints - see message later in the thread for latest "To live or die by your own sword one must first learn to wield it aptly." |
|||
04-13-2014, 02:46 PM
(This post was last modified: 04-13-2014 02:48 PM by J-F Garnier.)
Post: #18
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
(04-12-2014 08:31 AM)Ángel Martin Wrote: ... like an undocumented CPU instruction (318 in address 49ED) At least it's a real bug (I believe this is a typo error) because this part of code is executed and I had to (long time ago) explicitly manage this opcode in my Emu41 to run Forth on it (by default undefined opcodes stop my simulation) . Code: nutcpu.c : J-F |
|||
04-14-2014, 09:28 AM
(This post was last modified: 04-14-2014 07:43 PM by Ángel Martin.)
Post: #19
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
I'm reasonably sure that the correct instruction should be "3A8" - WRIT 14(d).
That'd make sense, since it's done after modifying the status bits... The plot thickens! "To live or die by your own sword one must first learn to wield it aptly." |
|||
04-15-2014, 12:31 PM
(This post was last modified: 04-16-2014 07:24 AM by Ángel Martin.)
Post: #20
|
|||
|
|||
RE: HP-41 FORTH; The most misunderstood Module?
I checked my (sort of educated, sort of wild) guesses for the UNDEF issues at address 49ED and the bogus call to page#3 in addresses 4CCE/4CCF. It works now without glitches, even gets rid of the nasty prompt wrap-around that was present before; so it appears it did some good to the situation.
BTW I'm using it on my CL, with the upper block on page#9 (you can use YMOVE to place it wherever you want, except on page #7 as mentioned above). Cheers, ÁM PS. also fixed two more *obvious* glitches (wrong address by one byte) and another typo (90% confidence on that one). Will post the new version if there's interest. "To live or die by your own sword one must first learn to wield it aptly." |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: