Post Reply 
Forth-41
09-09-2022, 11:14 AM
Post: #41
RE: Forth-41
FORGET works, thank you :-)

No VLIST unfortunately :-(

(09-09-2022 06:25 AM)Garth Wilson Wrote:  
(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.

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
09-09-2022, 11:29 AM (This post was last modified: 09-09-2022 11:42 AM by Joe Horn.)
Post: #42
RE: Forth-41
VLIST can be added to the dictionary by typing in the short program for it on page 32 of the HP 82441A FORTH/Assembler ROM Owner's Manual.

EDIT -- Oops, I don't know what modifications need to be made to that program to port it from HP-71 FORTH to Forth-41.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
10-13-2022, 10:06 AM
Post: #43
RE: Forth-41
I've discovered that WORDS / VLIST is very implementation specific so I've written one from scratch for FORTH-41 which I've included below.

As none of FORTH-41 primitives are implemented in FORTH (probably for performance) this will only show user created variables and words (along with one builtin called FORTH). The builtin primitives are listed in CAT 2 anyway.

WRDS will list all user definitions and uses WRD to print each word name. TYPE can't be used due to the last character including a flag.

Code:
HEX
: WRD DUP M1+ SWAP
C@ 1F AND 0 DO
  DUP MM> I + >MM C@
  7F AND EMIT
LOOP DROP ;

: WRDS HEX DB @ 
BEGIN
  DUP M2- SWAP
  WRD @ DUP WHILE 
  SPACE
REPEAT DROP ;

Note, the manual says the address of the last name is at 0x0da but it's actually at 0x0db as per the diagrams. This is used as the starting point for retrieving definition names and then working back through all of them from there.

(09-09-2022 11:29 AM)Joe Horn Wrote:  VLIST can be added to the dictionary by typing in the short program for it on page 32 of the HP 82441A FORTH/Assembler ROM Owner's Manual.

EDIT -- Oops, I don't know what modifications need to be made to that program to port it from HP-71 FORTH to Forth-41.

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
10-18-2022, 02:38 PM
Post: #44
RE: Forth-41
I've spent a fair bit of time using FORTH-41 and even managed to get NQueens running on it and have made a video detailing and demonstrating the FORTH-41 specific features.

NQueens completed correctly for an 8x8 board on the DM41X with USB power in just under 3 minutes. I gave up waiting for the 41CV.




Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
10-19-2022, 08:43 AM (This post was last modified: 10-19-2022 12:45 PM by Ángel Martin.)
Post: #45
RE: Forth-41
Very nice job! Thanks for putting this one up.
It's reassuring to see that the time I spent on the FORTH-41+ cleanup and documentation have helped a bit with this recent activity on the subject.

"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
10-19-2022, 05:27 PM (This post was last modified: 10-19-2022 05:27 PM by Ángel Martin.)
Post: #46
RE: Forth-41
(10-13-2022 10:06 AM)dmh Wrote:  
Code:
HEX
: WRD DUP M1+ SWAP
C@ 1F AND 0 DO
  DUP MM> I + >MM C@
  7F AND EMIT
LOOP DROP ;

: WRDS HEX DB @ 
BEGIN
  DUP M2- SWAP
  WRD @ DUP WHILE 
  SPACE
REPEAT DROP ;

I can't find the 7F word in FORTH-41, is it a typo?

"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
10-19-2022, 06:01 PM
Post: #47
RE: Forth-41
(10-19-2022 05:27 PM)Ángel Martin Wrote:  
(10-13-2022 10:06 AM)dmh Wrote:  
Code:
HEX
: WRD DUP M1+ SWAP
C@ 1F AND 0 DO
  DUP MM> I + >MM C@
  7F AND EMIT
LOOP DROP ;

: WRDS HEX DB @ 
BEGIN
  DUP M2- SWAP
  WRD @ DUP WHILE 
  SPACE
REPEAT DROP ;

I can't find the 7F word in FORTH-41, is it a typo?

It's a hex constant 0x7F used to AND with a string variable to clear the high bit so it will display properly.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
10-20-2022, 01:18 AM
Post: #48
RE: Forth-41
Exactly as Bob has already advised :-)

I mentioned in my comment in the original post too in case someone suggested I use TYPE:

WRDS will list all user definitions and uses WRD to print each word name. TYPE can't be used
due to the last character including a flag.

You can see in the memory dumps in your documentation that the last character has the high bit set.


(10-19-2022 06:01 PM)rprosperi Wrote:  
(10-19-2022 05:27 PM)Ángel Martin Wrote:  I can't find the 7F word in FORTH-41, is it a typo?

It's a hex constant 0x7F used to AND with a string variable to clear the high bit so it will display properly.

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
10-20-2022, 05:44 AM (This post was last modified: 10-20-2022 09:16 AM by Ángel Martin.)
Post: #49
RE: Forth-41
sorry I must have had a brainfart !
Thanks for clarifying anyway, I shouldn't post with the flu, it's quite clear...

ÁM

"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
10-21-2022, 05:50 PM
Post: #50
RE: Forth-41
Well well. Forth-41 review on Hackaday. Like what they say about the 41 Smile

https://hackaday.com/2022/10/21/hp-41c-t...h-edition/

Remember kids, "In a democracy, you get the government you deserve."
Find all posts by this user
Quote this message in a reply
10-21-2022, 08:43 PM
Post: #51
RE: Forth-41
Quote:The original code dates back to 1984, but some recent detective work by [Angel Margin] has the code running again.

:-)

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
10-23-2022, 02:30 AM (This post was last modified: 10-23-2022 02:31 AM by Ángel Martin.)
Post: #52
RE: Forth-41
(10-21-2022 08:43 PM)Massimo Gnerucci Wrote:  
Quote:The original code dates back to 1984, but some recent detective work by [Angel Margin] has the code running again.
:-)

No worries, I've been called worse things ;-)
There's always some marging for error in everything...

"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
02-11-2023, 12:52 PM
Post: #53
RE: Forth-41
Hi Everyone,

I'm new to this forum and have joined because I've recently taken up an interest in FORTH and dusting off some of my old HPs. I have a bit of experience with the 48GX, but none with the 41C/V/X which is probably why I'm having issues.

I've successfully loaded FORTH on both my DM41X and on the i41CX+ emulator on iOS (following what little information for loading I could find here, in the manual, and in the video) and I'm able to do basic operations with it (arithmetic and set/fetch variables). However, if I define a word (STAR, for instance), then try to execute that word (or do anything with it) I get a "beep" and then am no longer able to do anything in FORTH without turning the device off/on.

i.e. if I try to add number to the stack or execute BYE or anything after attempting to execute a word I've defined (have tried all kinds of simple definitions, none work) it will just say OK after hitting R/S and do nothing (not exit on BYE, not add numbers to stack or show "OK:") until I turn it off/on. For example:

: STAR 42 EMIT ; ( R/S )
OK
STAR ( R/S gives beep )
STAR ( stays displayed... delete with backspace then hit R/S )
OK
BYE
OK
5
OK
.
OK ( etc.. then hit off/on )
OK
5
OK: ( works again... )

Not sure what I'm doing wrong here. On the i41CX+ I have the FORTH module plugged into Port 1, The EXT-FUNS module in Port 2, the EXT-MEM in Port 3 and an EXT-MEM in Port 4. On the DM41X there doesn't seem to be any explanation of how its text representation of these modules in the AM area and elsewhere corresponds to which "port" it's plugged into, all I know is that they're loaded ("plugged") into Flash and "active". However, I have the exact same issues on both the DM41X and i41CX+. Maybe I'm just missing something obvious that I'm not doing since I'm not used to programmingAny help would be appreciated. It would be really nice to get this working, especially on the DM41X. Thanks!
Find all posts by this user
Quote this message in a reply
02-12-2023, 03:40 AM (This post was last modified: 02-12-2023 03:56 AM by dmh.)
Post: #54
RE: Forth-41
Hi and welcome :-)

Did you use the FORTH-41 ROM from the article here?

If you are not getting OK: (with the colon) when putting numbers on the stack then you are probably running the older/original version.

Also, did you do SIZE 010 before running FORTH for the first time so it has enough buffer space?

I have FORTH-41 running on a 41CV and DM41X (as per the video). DM41X is running the latest firmware.

Let me know how you go, happy to compare my configs with screenshots etc if required.

Also, note that FORTH-41 defaults to HEX mode so you need to use DECIMAL so that 42 EMIT shows an asterisk.

Edit: I note you did eventually get the OK: prompt so must be using the latest ROM version

(02-11-2023 12:52 PM)coniglius Wrote:  Hi Everyone,

I'm new to this forum and have joined because I've recently taken up an interest in FORTH and dusting off some of my old HPs. I have a bit of experience with the 48GX, but none with the 41C/V/X which is probably why I'm having issues.

I've successfully loaded FORTH on both my DM41X and on the i41CX+ emulator on iOS (following what little information for loading I could find here, in the manual, and in the video) and I'm able to do basic operations with it (arithmetic and set/fetch variables). However, if I define a word (STAR, for instance), then try to execute that word (or do anything with it) I get a "beep" and then am no longer able to do anything in FORTH without turning the device off/on.

i.e. if I try to add number to the stack or execute BYE or anything after attempting to execute a word I've defined (have tried all kinds of simple definitions, none work) it will just say OK after hitting R/S and do nothing (not exit on BYE, not add numbers to stack or show "OK:") until I turn it off/on. For example:

: STAR 42 EMIT ; ( R/S )
OK
STAR ( R/S gives beep )
STAR ( stays displayed... delete with backspace then hit R/S )
OK
BYE
OK
5
OK
.
OK ( etc.. then hit off/on )
OK
5
OK: ( works again... )

Not sure what I'm doing wrong here. On the i41CX+ I have the FORTH module plugged into Port 1, The EXT-FUNS module in Port 2, the EXT-MEM in Port 3 and an EXT-MEM in Port 4. On the DM41X there doesn't seem to be any explanation of how its text representation of these modules in the AM area and elsewhere corresponds to which "port" it's plugged into, all I know is that they're loaded ("plugged") into Flash and "active". However, I have the exact same issues on both the DM41X and i41CX+. Maybe I'm just missing something obvious that I'm not doing since I'm not used to programmingAny help would be appreciated. It would be really nice to get this working, especially on the DM41X. Thanks!

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
02-12-2023, 09:16 AM
Post: #55
RE: Forth-41
Thanks for the quick response dmh. Yes, that's the link I got the FORTH 41+ module from. I tried to extrapolate the steps you mentioned in your video for loading it onto a 41CV to loading it on a DM41X. Maybe I did that incorrectly. Here's how I understood it and what I did (I'm also using latest v2.1 firmare on my DM41X):

1. Need FORTH41+ module in Port 1, extended functions in Port 2, extended memory in Port 3 and 4. I did this by copying the FORTH.MOD (from link above), the EXT-FUNS.MOD, and the EXT-MEM.MOD (both from hp41DOTorg/mod/) into the /MODS directory on the DM41X. Then adding them to flash and "plugging" them in under the Manage Modules in Flash on the DM41X. Doing this twice for the EXT-MEM.MOD (is it necessary to do that twice?). This gave me 4 active modules representing the 4 mentioned above (2x EXT-MEM. They're represented in the Active Modules list as (ellipses for brevity):

Extended Functions... MOD 1P
Extended Memory... MOD 0P
Extended Memory... MOD 0P
FORTH 41+ MOD 2P

Next I ran:

2. XEQ SIZE 010

3. XEQ FORTH
Code:
OK
DECIMAL
OK
5
OK: ( so yes I do get the colon until it errors/beeps as I'd previously mentioned )
.
5 OK
: STAR 42 EMIT ;
OK
STAR ( beeps )
STAR ( STAR remains in the editor and need to use repeated <- to delete, then R/S )
OK
5
OK ( note that I now no longer get a colon after OK when adding to the stack proceeding the "beep" error from executing STAR )
BYE
OK ( note here that BYE does not work, I get OK )

At this point, I have to hit ON/ON to power off and back on again and the behavior of FORTH will go back to normal where I can enter numbers on the stack and get "OK:", type "BYE" to exit etc. but I still will not be able to execute any words I've defined.


(02-12-2023 03:40 AM)dmh Wrote:  Hi and welcome :-)

Did you use the FORTH-41 ROM from the article here?

If you are not getting OK: (with the colon) when putting numbers on the stack then you are probably running the older/original version.

Also, did you do SIZE 010 before running FORTH for the first time so it has enough buffer space?

I have FORTH-41 running on a 41CV and DM41X (as per the video). DM41X is running the latest firmware.

Let me know how you go, happy to compare my configs with screenshots etc if required.
Find all posts by this user
Quote this message in a reply
02-12-2023, 09:00 PM
Post: #56
RE: Forth-41
Just a note regarding my previous post where I mention the steps that I went through. In step 1, I have tried it with and without any EXT-MEM module loaded and with and without the EXT-FUNS module (and combination of with/without of the two) on the DM41X (which already has expanded memory) and none seems to make a difference.
Find all posts by this user
Quote this message in a reply
02-24-2023, 01:07 AM
Post: #57
RE: Forth-41
Any luck getting this going?

Did you check you did the SIZE 010 before running FORTH for the first time?

(02-12-2023 09:00 PM)coniglius Wrote:  Just a note regarding my previous post where I mention the steps that I went through. In step 1, I have tried it with and without any EXT-MEM module loaded and with and without the EXT-FUNS module (and combination of with/without of the two) on the DM41X (which already has expanded memory) and none seems to make a difference.

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
02-24-2023, 12:06 PM
Post: #58
RE: Forth-41
dmh,

Thanks for checking back. Unfortunately, no. I haven't gotten it working. Yes I'm always sure to do SIZE 010 before running FORTH: On the DM41X I can see SIZE: 10 displayed on the top right of the display screen afterwards). I don't know what else to do. It's a bit disappointing. Would it maybe be possible to get a state file or backup file from someone running FORTH successfully on their DM41x? Would that work?

(02-24-2023 01:07 AM)dmh Wrote:  Any luck getting this going?

Did you check you did the SIZE 010 before running FORTH for the first time?
Find all posts by this user
Quote this message in a reply
02-24-2023, 12:15 PM
Post: #59
RE: Forth-41
Worth a try.

Send me a PM with your email address and I can email you a state file.

(02-24-2023 12:06 PM)coniglius Wrote:  dmh,

Thanks for checking back. Unfortunately, no. I haven't gotten it working. Yes I'm always sure to do SIZE 010 before running FORTH: On the DM41X I can see SIZE: 10 displayed on the top right of the display screen afterwards). I don't know what else to do. It's a bit disappointing. Would it maybe be possible to get a state file or backup file from someone running FORTH successfully on their DM41x? Would that work?

(02-24-2023 01:07 AM)dmh Wrote:  Any luck getting this going?

Did you check you did the SIZE 010 before running FORTH for the first time?

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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