The following warnings occurred:
Warning [2] Undefined array key 140512 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140513 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140514 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140518 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140521 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140522 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140523 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140535 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140618 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140625 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140634 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140649 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140654 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140657 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140659 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140518 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140523 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140659 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 140522 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





HP 41 FORTH Manual



#13

I'm looking for the HP41 FORTH Module Manual. Google, TOS, etc... has been of little help. Can any body help me?

Thanks.


#14

I know of a HP71 FORTH ROM module and manual being included in the Museum DVD, but didn't hear of something alike for the HP41 so far. Please check.

Edited: 8 Sept 2008, 5:09 a.m.


#15

Yes there was one, and I thought I had some kind of manual here although I remember it was not very complete. I can't find it at the moment though.

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.

Edited: 8 Sept 2008, 5:45 a.m.


#16

Pick one and port ;)

The ancient fig-Forth listings are available


online

There was a time when you had to purchase a printed listing. Actually I have somewhere a 80% done fig-Forth port done to the Psion Organiser II (based on a Hitachi 6303 microcontroller, descendant of the Motorola 6800).

#17

Quote:
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.

I am curious too, that is why I want to give it a go. A manual would help.
#18

Garth, et al,

I spent a few minutes with Google and found no documentation and very little discussion of FORTH41. So, I thought I'd just try it. I didn't spend more that 15-20 minutes on this, but at least its a start.

The only emulators I was able to get FORTH41 to start up on were EMU41 and i41CXp (based on Nonpareil core). No luck with V41. I prefer EMU41 and i41CXp because they both have printer emulation.

If you want to play along, you can load up FORTH41 on i41CXp just by taking the default URL to load modules. For EMU41, I posted an example INI file and an EMU41 compatible FORTH41 ROM here: http://sense.net/~egan/forth41. Also posted at that URL is printer output of CAT 2 for the FORTH41 module and the overlay (very helpful).

The only test I did was to add two numbers together, here is how to do it:

  1. XEQ FORTH, you should get an OK prompt. CLx/A to clear screen.
  2. Do FORTH like any other FORTH interpreter, e.g. type without the quotes "1 2 + .", that will push 1 and 2 on the stack, add together, and the DOT will print the results. Alternatevly you can exit out of ALPHA and just type 1 R/S 2 R/S + R/S . and get the same results.
  3. Press R/S to execute.
  4. The screen should have "3 OK" on it.
  5. Type "BYE" R/S to exit interpreter.

#19

I finally had some time late tonight to explore the FORTH41 ROM a bit more. First of all I must state that I'm impressed with the effort. Kudos to Serge Vaudenay for this achievement.

What is FORTH41?

Information about this module is very sparse, the only proper documentation was written about 6 months ago and is difficult to obtain. This is what I was able to find:

  1. "FORTH FOR THE HP-41", Datafile V3N45 Page 29. This article was published in 1984. I've posted a scan of this page here: http://sense.net/~egan/forth41/forth41_v3n45_p29.pdf.
  2. Emmanuel Compes (the author of the aforementioned FORTH41 manual) has a bit more information here: http://www.emmanuel.hp41.eu/database/forth41.html.
  3. According to sources in the previous two points, FORTH41 is based on the Forth-79 standard. You can obtain a copy of the standard here: http://www.dartmouth.edu/~lmaurer/forth/Forth-79.pdf.

Observations

  1. While FORTH41 is based on Forth-79, it is not complete, however there are substitutes for what is missing. E.g. no 2/ or 2* for right and left shifts, no problem, just use 2 / and 2 *.
  2. Performance is poor. I created two similar programs (one Forth, one RPN); given X, get the next prime number. I chose this because it is purely integer work (Forth does not have native FP support), and I had an ML version to compare with as well. NOTE: Neither program is well optimized, the purpose was to have the same method running under two different environments.
  3. Programming Forth on the 41 is not as cumbersome as I thought it would have been.

Benchmark Results

To benchmark I set X to 1000 and generated the next 5 primes. The ML program was hands down the fastest. The RPN version was about 10x faster than the Forth version. BTW, Forth on the 71B is measurably faster than BASIC (about 3x).

Summary

Despite lesser performance and an incomplete implementation, it was still the most fun I've had with my 41 in a while.

If you are interested in learning Forth, the book, "Starting FORTH", is freely available from here: http://home.iae.nl/users/mhx/sf.html.

NOTE: All of this testing was done with i41CXp--the iPhone 41C emulator.

NOTE: I have V41 working now. FORTH41 does not play well with the CX (uses pages 4 and 5). I've been lucky with EMU41 and i41CXp. For V41 just use the CV ROM image with FORTH41.

Forth Code

DECIMAL
VARIABLE R
VARIABLE M
VARIABLE S
: ISQRT
M ! 0 R ! 16384 DUP S !
BEGIN 0> WHILE
M @ S @ R @ OR < IF
R @ 2 / R !
ELSE
S @ R @ OR NEGATE M +!
R @ 2 / S @ OR R !
THEN
S @ 4 / DUP S !
REPEAT
R @
;
: NP
1 + DUP
2 MOD 0 = IF 1 + THEN
BEGIN
DUP ISQRT 1 + 3 DO
DUP I MOD 0 = IF
1 LEAVE THEN
2 +LOOP
DUP 1 = IF
DROP 2 + 0
ELSE DUP THEN
UNTIL
;
: BM
1000 NP NP NP NP NP
;
NOTE: If you think this looks a bit like RPL, it does. RPL was heavily influenced by Forth. Replace ! with STO and @ with RCL, quote your variables, and you are almost there.

RPN Code

 01 LBL "NP"
02 1
03 +
04 STO 00
05 2
06 MOD
07 X#0?
08 GTO 01
09 1
10 ST+ 00
11 LBL 01
12 RCL 00
13 SQRT
14 INT
15 1
16 +
17 STO 01
18 3
19 STO 02
20 LBL 02
21 RCL 00
22 RCL 02
23 MOD
24 X=0?
25 GTO 03
26 2
27 ST+ 02
28 RCL 01
29 RCL 02
30 X<=Y?
31 GTO 02
32 RCL 00
33 RTN
34 LBL 03
35 2
36 ST+ 00
37 GTO 01
38 LBL "BM"
39 1000
40 XEQ "NP"
41 XEQ "NP"
42 XEQ "NP"
43 XEQ "NP"
44 XEQ "NP"
45 END


Edited: 11 Sept 2008, 12:02 p.m.


#20

Quote:
1. "FORTH FOR THE HP-41", Datafile V3N45 Page 29. This article was published in 1984. I've posted a scan of this page here: http://sense.net/~egan/forth41/forth41_v3n45_p29.pdf.

2. Emmanuel Compes (the author of the aforementioned FORTH41 manual) has a bit more information here: http://www.emmanuel.hp41.eu/database/forth41.html.

3. According to sources in the previous two points, FORTH41 is based on the Forth-79 standard.


Thanks. I had written down a list of questions, and these answered many of them. It looks like a great work considering a 16-year-old did it, but I'm sure he could do far better now some 20 years later.

They list the primitives, but do you have a list of the secondaries? If it runs in main RAM (which is 8-bit), it wouldn't have any way for the user to write his own primitives (since machine language is 10-bit), but I hope it would at least have CREATE and DOES>

Although you say the 71 is typically three times as fast in Forth as in BASIC, I would comment that the 71's Forth is a very poor implementation, and I've been able to dramatically speed up many words by just redefining them in Forth, not even in assembly. The most extreme case I remember was CHR$ which I made 14 times as fast. I suspect they must have just referenced some of the BASIC routines that were already there, and the interface between the two languages was very inefficient. I wonder if the 41 Forth was done the same way. There's no excuse for the 41 running 10 times as slow in Forth as in RPN. It should be 10 times as fast. I suppose the lack of the 2/ and 2* shifts probably accounts for quite a bit of that, since a divide or multiply takes much, much longer than a shift. Apparently it does not even have a SHIFT primitive. When FIG was still publishing Forth Dimensions, there were frequent discussion on how few primitives you could get by with. I think someone got it down to 12, but the performance was ridiculously slow-- which is not what Forth is all about.

The 71 Forth uses a 41-style 4-level stack for floating-point. Some Forth FP implementations don't use a separate stack for it. When I first came to Forth, I viewed as a big limitation the fact that floating-point is discouraged. But as I've gained more experience, I've found I can do all the log and trig functions and so on very efficiently in scaled-integer.


#21

Quote:
They list the primitives, but do you have a list of the secondaries?

Nope. But it would not be too hard to try them one-by-one to find them all.
Quote:
If it runs in main RAM (which is 8-bit), it wouldn't have any way for the user to write his own primitives (since machine language is 10-bit), but I hope it would at least have CREATE and DOES>

CREATE A 9 ALLOT worked for me. I didn't test DOES> since I have no idea what it does. I've only been playing with Forth for about a year, mostly to get better performance than BASIC for challenges posted here, and because I have a hard time with BASIC.
Quote:
Although you say the 71 is typically three times as fast in Forth as in BASIC, I would comment that the 71's Forth is a very poor implementation, and I've been able to dramatically speed up many words by just redefining them in Forth, not even in assembly. The most extreme case I remember was CHR$ which I made 14 times as fast. I suspect they must have just referenced some of the BASIC routines that were already there, and the interface between the two languages was very inefficient. I wonder if the 41 Forth was done the same way. There's no excuse for the 41 running 10 times as slow in Forth as in RPN. It should be 10 times as fast.

I think you may be correct. I was listing random blocks and see a lot of RPN in there.
Quote:
I suppose the lack of the 2/ and 2* shifts probably accounts for quite a bit of that, since a divide or multiply takes much, much longer than a shift. Apparently it does not even have a SHIFT primitive. When FIG was still publishing Forth Dimensions, there were frequent discussion on how few primitives you could get by with. I think someone got it down to 12, but the performance was ridiculously slow-- which is not what Forth is all about.

My integer square root is very fast if you can shift. As it stands now it takes a few seconds.
Quote:
The 71 Forth uses a 41-style 4-level stack for floating-point. Some Forth FP implementations don't use a separate stack for it. When I first came to Forth, I viewed as a big limitation the fact that floating-point is discouraged. But as I've gained more experience, I've found I can do all the log and trig functions and so on very efficiently in scaled-integer.

Something that I have not got around to yet. I've leveraged the 71 Forth FP stack in almost every challenge that I used Forth.

Forth is great fun, especially since I've been using RPL since 1993. I may be the only person with 41+Forth emulation on their iPhone that actually programs it. The emulator QWERTY support makes quick entry of Forth code with just my thumb.

I hope I can track down the manual, I'd like to get the editor, printer, data transfer from RPN to Forth, and file I/O working. Fortunately state is maintained, if I exit Forth and start it up again all my words are there. FEX works as well, just put your stack and words in ALPHA and run FEX. I think I can harvest ALPHA to get the results, but suddenly I lost all my Forth work. Unsure what I did wrong, I need to start over to continue exploring.

I've dumped all my research here:
http://sense.net/~egan/forth41 if you want to play.

Edited: 11 Sept 2008, 4:04 p.m.


#22

Quote:
Nope. But it would not be too hard to try them one-by-one to find them all.
WORDS or VLIST should list them all at once so you don't have to try one by one.
Quote:
I didn't test DOES> since I have no idea what it does.
CREATE and DOES> allow you to make your own defining words, essentially extending the compiler. This is a very powerful feature of even very minimalist, tiny Forths. You can specify what action is taken when the child word is created, and then, following DOES> , specify what action is taken by the child word when it runs. ("Child" words are the words created by your new defining word.) This is the "Pearl of Forth" which lets you define for example new structure types. With STATE , you can have the word do one thing when encountered during compilation and something else when encountered other times. If you want to define the child's run-time action in assembly instead of high-level Forth, you would use ;CODE instead of DOES> . Going along with that, COMPILE and [COMPILE] and IMMEDIATE also let you for example add new program structures such as CASE or any other one you may want to invent to meet your need, and it will become part of the language.

I don't think I've ever come across FEX . What is it?


#23

Quote:
WORDS or VLIST should list them all at once so you don't have to try one by one.

Yes, they would if FORTH41 had those words. :-(
Quote:
I don't think I've ever come across FEX . What is it?

FEX is part of FORTH41, it allows you to send via ALPHA a string to Forth, e.g.:
ALPHA 1 2 . + ALPHA
XEQ FEX
Returns:
           3
to the screen, any key will exit, nothing left in ALPHA.

#24

so it's short for "Forth EXecute," similar to FORTHX on the 71 which allows you to execute Forth routines from the BASIC environment?

The 71 Forth manual has VLIST on page 32. It would have to be modified a bit to run on the 41, but it would be easy to write once you know how the dictionary headers are put together.


#25

Quote:
so it's short for "Forth EXecute," similar to FORTHX on the 71 which allows you to execute Forth routines from the BASIC environment?

Yes.
#26

emmanuel compes talks about the hp-41 forth module on his webpage. http://www.emmanuel.hp41.eu/database/forth41.html

It seems to be a module that has been created by Sergey Vaudeney. Its image (and overlay) is available on TOS.

Emmanuel sold a HP41-Forth a while ago on eBay and included a manual that he wrote. (see also here: http://www.emmanuel.hp41.eu/ebay/ebay_uk.html )

Regular readers here will know about my personal 'luck' with Emmanuel so I don't know if this route is a way to actually get a manual. But it does exist...

Cheers

Peter


#27

Quote:
Regular readers here will know about my personal 'luck' with Emmanuel so I don't know if this route is a way to actually get a manual. But it does exist...

Yeah, I know, so what happened? You can PM me. Thanks.

Possibly Related Threads…
Thread Author Replies Views Last Post
  HP-41(CL): The easiest way to transfer FOCAL programs from a Linux PC to the HP-41 Geir Isene 13 5,559 12-05-2013, 02:40 AM
Last Post: Hans Brueggemann
  HP71B to HP 41 Translator ROM Manual Michael Lopez 5 2,057 04-25-2013, 03:51 AM
Last Post: Mike (Stgt)
  Navpac manual anyone? (HP-41. Not HP's Navigation Pac) Geir Isene 0 796 10-13-2011, 04:34 AM
Last Post: Geir Isene
  HP-41: Manual for the ChemUser ROM? Geir Isene 2 925 03-01-2010, 12:27 PM
Last Post: Ángel Martin
  Looking for on-line HP-41 manual Thomas Okken 14 3,090 07-21-2008, 02:10 PM
Last Post: Ken Shaw
  HP-41 Skwid ROM manual addendum J-F Garnier 9 2,309 01-19-2008, 06:43 PM
Last Post: Raymond Del Tondo
  Manual for HP-41 FORECAST I Geir Isene 8 2,164 07-11-2007, 02:14 AM
Last Post: Matthias Wehrli
  HP-41 in Space - Shuttle Training Manual Bill (Smithville, NJ) 1 872 04-25-2007, 05:58 AM
Last Post: Karl-Ludwig Butte
  Anyone want hp 41 to 41 infra-red data transfer? don wallace 38 8,326 09-21-2005, 04:17 PM
Last Post: don wallace
  $220 for an HP manual ... Just the manual! Georges.L 7 2,288 08-24-2005, 12:54 AM
Last Post: K

Forum Jump: