Post Reply 
Forth-41
12-14-2020, 06:44 PM
Post: #21
RE: Forth-41
Kudos Ángel!
If this is only a work in progress I wonder what the full opus will turn out.

Thanks a lot.

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
12-15-2020, 01:32 PM
Post: #22
RE: Forth-41
(12-14-2020 06:44 PM)Massimo Gnerucci Wrote:  Kudos Ángel!
If this is only a work in progress I wonder what the full opus will turn out.

Thanks a lot.


Oh, assume the best is yet to come ;-)

Update copy today, December 15th. has been re-posted.

Cheers,

"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
12-17-2020, 06:17 PM
Post: #23
RE: Forth-41
(12-05-2020 12:25 AM)Craig Bladow Wrote:  This Forth implementation runs on many STM32 micro-controller variants, as used in DM-41x. http://mecrisp.sourceforge.net/

That one is not possible to incorporate with the DM41X due to license issues (GPL). There are probably more permissive implementations around.
Find all posts by this user
Quote this message in a reply
12-17-2020, 06:38 PM
Post: #24
RE: Forth-41
(12-17-2020 06:17 PM)hth Wrote:  
(12-05-2020 12:25 AM)Craig Bladow Wrote:  This Forth implementation runs on many STM32 micro-controller variants, as used in DM-41x. http://mecrisp.sourceforge.net/

That one is not possible to incorporate with the DM41X due to license issues (GPL). There are probably more permissive implementations around.

With software anything is possible Smile , Free42 is licensed under the GPL and runs on DM42 alongside Swiss Micros proprietary firmware.

Try CC41!
Find all posts by this user
Quote this message in a reply
12-17-2020, 11:05 PM
Post: #25
RE: Forth-41
(12-17-2020 06:38 PM)Craig Bladow Wrote:  
(12-17-2020 06:17 PM)hth Wrote:  That one is not possible to incorporate with the DM41X due to license issues (GPL). There are probably more permissive implementations around.

With software anything is possible Smile , Free42 is licensed under the GPL and runs on DM42 alongside Swiss Micros proprietary firmware.

Apparently. I am thinking of a tight integration with the HP-41 emulation layer, to provide a natural extension to it. Perhaps the emulation should also run under control of the Forth engine.

I suppose one could rewrite the HP-41 emulation in Forth and have that run in parallel to the proprietary firmware. It would probably be easier if it was open source already, but no, so it is a good excuse to reinvent the wheel completely. Perhaps when I retire.
Find all posts by this user
Quote this message in a reply
12-18-2020, 01:27 AM
Post: #26
RE: Forth-41
(12-17-2020 11:05 PM)hth Wrote:  Perhaps the emulation should also run under control of the Forth engine.

That's exactly what I was thinking.

Try CC41!
Find all posts by this user
Quote this message in a reply
12-27-2020, 06:19 PM
Post: #27
RE: Forth-41
Using my DM41X, I loaded the Forth-41 mod and I was working through the examples that Angel had posted in the first release of his Forth-41 manual. The "BEEP" program works fine. I tried the base conversion program and realized there is no "HEX" function available in the DM41X or the Forth-41 module, so it failed to run. I imagine I can define a new word in Forth-41 for HEX and DEC to allow Forth-41 to call a new function for the conversions.
The following example of "basic arithmetic" using Forth-41 appeared to work. So far, I'm just poking around Forth-41 on my DM41X using Forth words. Angel referenced the CLONIX module. I'm unfamiliar the CLONIX module as well as many of the other HP41CX modules. Perhaps there is a plug-in for HEX to DEC and DEC to HEX in another module. I'm still getting my feet wet with my DM41X and using modules.
My real goal is to keep the Forth-41 conversation going and program some Forth exercises into my DM41X using Angel's Forth module to see how far we can stretch the functionality of the module.
~ Jim J. ~
Find all posts by this user
Quote this message in a reply
12-27-2020, 07:20 PM
Post: #28
RE: Forth-41
Where can I find the Forth Manual?
Find all posts by this user
Quote this message in a reply
12-27-2020, 07:46 PM
Post: #29
RE: Forth-41
41-Forth at Monte's site
Find all posts by this user
Quote this message in a reply
12-27-2020, 08:25 PM (This post was last modified: 12-27-2020 08:28 PM by smp.)
Post: #30
RE: Forth-41
(12-27-2020 06:19 PM)jjohnson873 Wrote:  Using my DM41X, I loaded the Forth-41 mod and I was working through the examples that Angel had posted in the first release of his Forth-41 manual. The "BEEP" program works fine. I tried the base conversion program and realized there is no "HEX" function available in the DM41X or the Forth-41 module, so it failed to run.
<...snip...>

On page 6 of the aforementioned Forth Manual, the primitive HEX shows up in the table of Forth primitives contained in the Forth-41 module. The primitive DECIMAL is there, as well. I'm not certain what has gone wrong for you, but it's worked for me on my (beta) DM41X.

smp
Find all posts by this user
Quote this message in a reply
12-28-2020, 02:09 AM
Post: #31
RE: Forth-41
(12-27-2020 08:25 PM)smp Wrote:  On page 6 of the aforementioned Forth Manual, the primitive HEX shows up in the table of Forth primitives contained in the Forth-41 module. The primitive DECIMAL is there, as well. I'm not certain what has gone wrong for you, but it's worked for me on my (beta) DM41X.
smp
On my DM41X, I can get the proper Forth output of 1234 using DECIMAL entering 4D2 DECIMAL R/S But for some reason, when I enter 1234 HEX . R/S I don't get 4D2. I tried entering 1234 HEX R/S. But then when I enter . R/S I don't get anything from the stack.
~ Jim J. ~
Find all posts by this user
Quote this message in a reply
12-28-2020, 06:48 AM (This post was last modified: 12-28-2020 06:50 AM by Ángel Martin.)
Post: #32
RE: Forth-41
(12-28-2020 02:09 AM)jjohnson873 Wrote:  
(12-27-2020 08:25 PM)smp Wrote:  On page 6 of the aforementioned Forth Manual, the primitive HEX shows up in the table of Forth primitives contained in the Forth-41 module. The primitive DECIMAL is there, as well. I'm not certain what has gone wrong for you, but it's worked for me on my (beta) DM41X.
smp
On my DM41X, I can get the proper Forth output of 1234 using DECIMAL entering 4D2 DECIMAL R/S But for some reason, when I enter 1234 HEX . R/S I don't get 4D2. I tried entering 1234 HEX R/S. But then when I enter . R/S I don't get anything from the stack.
~ Jim J. ~

That's strange, I can't reproduce that error either but here's a few troubleshooting checks you can try:

- In FORTH mode, type BASE @ R/S to see what's the current base value. Note that the content should always be 10, which is both Ten in decimal and Sixteen in HEX

- To see what base is selected type "A" followed by space. If there's an error (long tone) you're in Decimal; if it takes it you're in HEX.

- Start anew from scratch, either using Memory Lost, then resize to 10 registers - or - use FRAMCHK to reset the contents of buffer #13. Note that this is to be done from the normal calculator mode, outside of FORTH.

- Better yet, clear said buffer #13 completely using 13, CLB - available in the AMC/OSX and other modules (not the library-4 aware version)

"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
09-07-2022, 11:13 AM (This post was last modified: 09-07-2022 12:49 PM by dmh.)
Post: #33
RE: Forth-41
I've just given this a try and it basically works, however, the first example doesn't as per below :-(

1234 HEX . R/S
1234 OK

I used the ZIP file from the article and followed the exact same configuration in the manual (CV, same modules in same ports).

Edit: I also checked the default base with 'BASE @ . R/S' which confirmed DECIMAL is the default.

I can get it to work if I start with the HEX 4D2 and convert to DECIMAL and back to HEX again.

Edit: Looking at previous reports of the same issue, it appears FORTH defaults to HEX mode. It also never appears to report being in HEX mode. I note above it says it should always report 10 but the documentation says:

BASE BASE 0.0D5 10 / 0F Selected Base

Which I read as returning 10 for decimal and 0F for hex, is that not the case?

Other simple tests work as expected.

Has this been broken since the documentation was done or am I doing something wrong?

Also, can someone explain the page restrictions for this? Where can FORTH go or does it have to go in the listed pages?

I initially tried with a NoV-64d with HEPAX but no luck so I had to use Clonix mode. Can FORTH be used with HEPAX?

TIA, dmh

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
09-07-2022, 03:31 PM
Post: #34
RE: Forth-41
The BASE will always be 10 in the current mode. Note that the "." word that prints the top of the stack prints it in using the current BASE.

You should try
BASE @ DECIMAL .
to print out the current base in base 10, where you should see 16. Which has the side effect of changing the base to DECIMAL. To preserve it, something like
BASE @ DUP DECIMAL . BASE !
would restore the BASE after printing.

Note that I've never used Forth-41; this is just based on my generic experience with FORTH.

Central PA, USA
16C, 48G, 39gs(newRPL), 40gs(newRPL), 50g(newRPL), Prime G2
Visit this user's website Find all posts by this user
Quote this message in a reply
09-07-2022, 09:03 PM
Post: #35
RE: Forth-41
Never, ever assume anything with Forth, it leads to hell by the shortest path.

Many Forth users create their own handy words to deal with this such as:

: D. BASE @ SWAP DECIMAL . BASE ! ; to print in Decimal, despite the current mode
: H. BASE @ SWAP HEX . BASE ! ; to print in Hex, etc.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
09-07-2022, 09:51 PM
Post: #36
RE: Forth-41
(09-07-2022 09:03 PM)rprosperi Wrote:  Many Forth users create their own handy words to deal with this such as:

: D. BASE @ SWAP DECIMAL . BASE ! ; to print in Decimal, despite the current mode
: H. BASE @ SWAP HEX . BASE ! ; to print in Hex, etc.

I was doing [ HEX ] and [ DECIMAL ] and [ BINARY ] so often in source code that I wrote equivalent immediate words [H] and [D] and [B]. For my uses though, I normally keep it in hex, not decimal.

http://WilsonMinesCo.com  (Lots of HP-41 links at the bottom of the links page, at http://wilsonminesco.com/links.html#hp41 )
Visit this user's website Find all posts by this user
Quote this message in a reply
09-08-2022, 01:36 AM (This post was last modified: 09-08-2022 01:38 AM by dmh.)
Post: #37
RE: Forth-41
Thank you for your replies :-)

So Forth 41 defaults to HEX and I believe the manual is wrong which led to my confusion. I expected to see 0F or 15 for HEX mode as per the manual.

Ángel, the following entry in this table in the documentation needs to be updated (BASE variable doesn't return 0F for HEX but instead 10 in hex which is 16 decimal :-).

[Image: Forth41%20BASE.JPG?dl=0]

Edit: image isn't working for some reason, I did what I usually do and can view it directly at https://www.dropbox.com/s/rsrxm7g9rwj0ss...E.JPG?dl=0

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
09-08-2022, 11:30 AM
Post: #38
RE: Forth-41
After spending some time with Forth-41 I have more questions that I've been unable to find or workout the answers to.

How do you list user (or all) defined words? There's no WORDS command that I've seen in other implementations.

How do you clear/reset the buffers to free up memory and delete all user defined words and variables?

I've managed to load small simple files with LOADF but note that the flying goose stays on the screen when the load is finished and so there is no indicator that it has finished loading unless you press a key every now and then.

I have tried loading larger files but get periodic tones. I assume this is due to commands or syntax that Forth-41 doesn't support. How do I see what line is causing the problem (hopefully without manually keying in a line at a time)?

I'm a Forth beginner so these may be simple questions :-)

TIA, dmh

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
09-09-2022, 04:43 AM
Post: #39
RE: Forth-41
(09-08-2022 11:30 AM)dmh Wrote:  After spending some time with Forth-41 I have more questions that I've been unable to find or workout the answers to.

How do you list user (or all) defined words? There's no WORDS command that I've seen in other implementations.

How do you clear/reset the buffers to free up memory and delete all user defined words and variables?

I've managed to load small simple files with LOADF but note that the flying goose stays on the screen when the load is finished and so there is no indicator that it has finished loading unless you press a key every now and then.

I have tried loading larger files but get periodic tones. I assume this is due to commands or syntax that Forth-41 doesn't support. How do I see what line is causing the problem (hopefully without manually keying in a line at a time)?

I'm a Forth beginner so these may be simple questions :-)

TIA, dmh

Most of these questions are system dependent, so the actual underlying code varies from system to system (e.g. the Forth standard does not specify how the dictionary must be implemented, only how it must behave from an external perspective).

A list of all used-defined words is typically called either VLIST or VCAT (Vocabulary List or Vocab. Catalog). Sometimes this comes built-in, other times not, but if not, it's usually one of the first things a community member writes and shares.

The 71B Forth manual is not at all tutorial in nature, but carefully reading it will reveal a lot about how to work with Forth systems - but only in a general way, since the 4-bit nybble orientation of 71B Forth is quite unusual (perhaps unique) and most of that sample code is platform-specific.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
09-09-2022, 06:25 AM
Post: #40
RE: Forth-41
(09-08-2022 11:30 AM)dmh Wrote:  How do you list user (or all) defined words? There's no WORDS command that I've seen in other implementations.

It uses VLIST, the older standard.

Quote:How do you clear/reset the buffers to free up memory and delete all user defined words and variables?

Use FORGET. I don't have Forth for the 41, but I see in the online documentation that it does have FORGET. The usual way to use it is:
Code:
   FORGET <name>
and it will search back to the last occurrence of the named word and forget that one and everything that followed, reclaiming that memory. It will not reach back past FENCE though.

http://WilsonMinesCo.com  (Lots of HP-41 links at the bottom of the links page, at http://wilsonminesco.com/links.html#hp41 )
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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