HP Forums
(71B) FORTH questions - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: (71B) FORTH questions (/thread-20029.html)

Pages: 1 2 3 4 5


RE: (71B) FORTH questions - rprosperi - 08-01-2023 04:53 PM

(08-01-2023 03:46 PM)floppy Wrote:  the question remain: what setup is the best for Forth 71B?
- 2x 62KB RAM & ROM Forth or
- 1x 128KB & ROM Forth or
- 4x32KB and move the Forth/assembler into Multimod?

These configurations would all perform the same, there is no performance advantage for using different size memory modules.

Note that you will probably want to separate some of that as IRAM, so you have more storage space for source files, alternate FORTHRAM files, etc.

If you have a 64K RAM module in Port-1, you simply do:

FREE PORT(1)

which allocates the first 32K of that module to become :PORT(1) (also called :PORT(1.00) ) and then can do things like
COPY MYFILE TO MYFILE:PORT(1) (Note: you can also use "COPY MYFILE TO :PORT(1)" if you want to keep the same filename.

Also, note that as you add new words to your FORTHRAM file, they are simply added to the end, even if a word is already defined with that name. In this case, all new words which reference that word name will only "see" the newer copy and space is wasted.

To remove a word from the dictionary, use

"FORGET WORDNAME"

which will remove the latest copy of WORDNAME from FORTHRAM, as well as all words added after WORDNAME.


RE: (71B) FORTH questions - Sylvain Cote - 08-01-2023 04:55 PM

(08-01-2023 03:46 PM)floppy Wrote:  the question remain: what setup is the best for Forth 71B?
- 2x 62KB RAM & ROM Forth or
- 1x 128KB & ROM Forth or
- 4x32KB and move the Forth/assembler into Multimod?
Knowing that the FORTH working environment is kept in main RAM.
  • FORTHRAM for FORTH/Assembler ROM
  • FTH41RAM for HP-41 Translator ROM
Using one or multiple front port RAM module and/or a card reader RAM module changes nothing.
Ultimately, you have to merge those RAM modules with main RAM for the FORTH working environment.
Now, the main RAM space you need depend on the size of your FORTH application.
The initial FORTH work space is a little bit under 3K, you grow it and add RAM as you need.

edit: Robert was faster than me. Wink


RE: (71B) FORTH questions - rprosperi - 08-01-2023 06:29 PM

(08-01-2023 04:55 PM)Sylvain Cote Wrote:  
(08-01-2023 03:46 PM)floppy Wrote:  the question remain: what setup is the best for Forth 71B?
- 2x 62KB RAM & ROM Forth or
- 1x 128KB & ROM Forth or
- 4x32KB and move the Forth/assembler into Multimod?
Knowing that the FORTH working environment is kept in main RAM.
  • FORTHRAM for FORTH/Assembler ROM
  • FTH41RAM for HP-41 Translator ROM
Using one or multiple front port RAM module and/or a card reader RAM module changes nothing.
Ultimately, you have to merge those RAM modules with main RAM for the FORTH working environment.
Now, the main RAM space you need depend on the size of your FORTH application.
The initial FORTH work space is a little bit under 3K, you grow it and add RAM as you need.

edit: Robert was faster than me. Wink

One other point to make. The speed of the assembler (and the Forth Compiler) on an actual 71B is quite poor, but adding system RAM definitely improves this; I don't know if there is an upper point of diminishing return, back in the day I couldn't afford hundreds of KB of RAM.

Bottom line, configure Emu-71 with maximum system RAM and assemble/compile on Emu71. Once complete, you can simply copy the FORTHRAM file to your device.


RE: (71B) FORTH questions - Sylvain Cote - 08-01-2023 06:48 PM

(08-01-2023 06:29 PM)rprosperi Wrote:  Bottom line, configure Emu-71 with maximum system RAM and assemble/compile on Emu71. Once complete, you can simply copy the FORTHRAM file to your device.
... and do not forget to uncheck "Authentic Calculator Speed" check box in Emu71 File/Settings.


RE: (71B) FORTH questions - floppy - 09-08-2023 04:18 PM

Has anybody a DUMP word similar to the gforth word?

The RAMED will perhaps do the job but any solution immediate (instead for me to rework the RAMED into the gforth like DUMP). My forth skills are growing but I am still not "at speed".

Background: I want to look at the memory configuration when using the word STRING in HP71B (= see the counted string structure).

----------------------- gforth --------------------------------------

dump ( addr u – ) tools “dump”

Display u lines of memory starting at address addr. Each line displays the contents of 16 bytes. When Gforth is running under an operating system you may get Invalid memory address errors if you attempt to access arbitrary locations.

---------------------------------------------------------------------


RE: (71B) FORTH questions - Sylvain Cote - 09-08-2023 05:39 PM

(09-08-2023 04:18 PM)floppy Wrote:  Has anybody a DUMP word similar to the gforth word?

HP-71 Software Developers’ Handbook → Section 21 : Forth Utilities → 21.4 : Memory Examination
Code:
DUMP
Display n nibbles, starting at addr, as ASCII hex characters.

Manual and LIF volume is available here: HP-71B COMPENDIUM - Part 4
Section : HP-00071-90097 Software Developers' Handbook


RE: (71B) FORTH questions - floppy - 09-12-2023 01:33 PM

What is the difference between the words NUMBER and VAL ?

VAL is so far tested (str -> number), which is in fact a combination of the gforth words
1st try: S>NUMBER?
then 2nd try: >FLOAT
So far so good.

But what is this NUMBER (addr -> number). The acting of addr (counted string at that address) and str is a kind of weird for me. Any explanation is welcome.


RE: (71B) FORTH questions - KeithB - 09-12-2023 06:26 PM

According to the manual:
Examine the counted string at addr and convert it into a double number d.
[It puts it into the X register]
If the string contains a decimal point, Number tries to convert it into a floating point number and place it in the X-register, lifting the floating point stack...

If the string does not contain a decimal point, Number tries to convert it into an integer number and return it to the data stack...


RE: (71B) FORTH questions - Sylvain Cote - 09-12-2023 06:39 PM

(09-12-2023 01:33 PM)floppy Wrote:  But what is this NUMBER (addr -> number). The acting of addr (counted string at that address) and str is a kind of weird for me. Any explanation is welcome.
Both do the same thing but NUMBER take a counted string as parameter while VAL take a string.

VAL
Code:
"  1.2"  VAL  →  push  1.2      in the floating point stack  
" -3.4"  VAL  →  push -3.4      in the floating point stack
"  5"    VAL  →  push  5 and  0 in the integer stack
" -6"    VAL  →  push -6 and -1 in the integer stack

NUMBER
At this time, I am not able to make NUMBER works, I have tried multiple ways to pass the counted string but I consistently get an error.
I am very rusty in forth, so I may come back later with the how-to for this one.


RE: (71B) FORTH questions - floppy - 09-21-2023 10:21 AM

What are the differences or use case of QUERY and EXPECT96 ?


RE: (71B) FORTH questions - rprosperi - 09-21-2023 02:53 PM

EXPECT96 puts the reply into a user-specified address (and on the user stack) while QUERY puts the reply string into the TIB which is used by the FORTH system. Unless you are dabbling with how the FORTH system works inside, you should use EPXECT96.


RE: (71B) FORTH questions - floppy - 09-22-2023 09:33 AM

(09-21-2023 02:53 PM)rprosperi Wrote:  EXPECT96 puts the reply into a user-specified address (and on the user stack) while QUERY puts the reply string into the TIB which is used by the FORTH system. Unless you are dabbling with how the FORTH system works inside, you should use EPXECT96.
Thanks. My task is to rewrite the REFILL word (see gforth) into an HP71B Forth. Looks like REFILL is more QUERY than EXPECT96.


RE: (71B) FORTH questions - rprosperi - 09-22-2023 12:00 PM

(09-22-2023 09:33 AM)floppy Wrote:  
(09-21-2023 02:53 PM)rprosperi Wrote:  EXPECT96 puts the reply into a user-specified address (and on the user stack) while QUERY puts the reply string into the TIB which is used by the FORTH system. Unless you are dabbling with how the FORTH system works inside, you should use EPXECT96.
Thanks. My task is to rewrite the REFILL word (see gforth) into an HP71B Forth. Looks like REFILL is more QUERY than EXPECT96.

I'm not familiar at all with gforth or REFILL so can't help with that. If REFILL captures data into the TIB (which I believe is a standard Forth component, though not sure) then I'd say QUERY may be closer. Good luck.


RE: (71B) FORTH questions - floppy - 10-01-2023 11:21 AM

Where are the Forth Word definitions documented? I dont see it in the 00071-90070 IDS V3 (or I dont know how to read this).
Background: I would like to see the programmed code in order to understand the use case since not all words are so clear in the description in the manual HP 82441A and not everywhere a description use is done in the assembler manual.


RE: (71B) FORTH questions - rprosperi - 10-01-2023 11:49 AM

The Developer's Handbook, recommended several times above, includes a Decompiler, UN:, (see p. 21-2) which lists the Forth word contents of a given word in the dictionary, including the original ROM words. We've recommended this book several times, you really should read it.


RE: (71B) FORTH questions - floppy - 10-01-2023 12:25 PM

(10-01-2023 11:49 AM)rprosperi Wrote:  The Developer's Handbook, recommended several times above, includes a Decompiler, UN:, (see p. 21-2) which lists the Forth word contents of a given word in the dictionary, including the original ROM words. We've recommended this book several times, you really should read it.
All 6 pages were printed on my desk since longer.
Are the printing of all Forth words with UN: anywhere?

UPDATE: good use case found here https://wiki.forth-ev.de/doku.php/projects:4th_lesson_1 (till 11).


RE: (71B) FORTH questions - rprosperi - 10-01-2023 02:41 PM

Are the printing of all Forth words with UN: anywhere?

No, not that I'm aware of.

Looks like a good opportunity for you to share that list once you've created it for your use. Use UN: to decompile all unobvious words, capture each output in IL-Per's window (after using DISPLAY is :PRINTER from BASIC) then copy/paste into a text file (or Word doc or whatever convenient format). And of course, UN: will not decompile a word written in assembler, it will only show you the pointer to that word.

Good luck


RE: (71B) FORTH questions - floppy - 10-17-2023 09:21 AM

I see I am starting messing my FORTHRAM by filling the dictionnary with the same words I already had created (for testing etc.).
So, I will have to clean up..
=
a) list the last word in the dictionnary (or all words in a list)
b) deleting it
c) .. repeating a and b.
Can somebody advise how to do this (a) and (b)?

UPDATE:
FORGET WORD_X
should do this (from Forth manual)


RE: (71B) FORTH questions - floppy - 10-17-2023 11:28 AM

How work FIND? (in EMU71)
I have a word -ROT and wanted to check if it is loaded via a file
I can use it: 1 2 3 -ROT gives a result.
However " -ROT" FIND return zero which would be "not found" according the manual. What did I missed there?


RE: (71B) FORTH questions - floppy - 10-17-2023 11:38 AM

Is there a syntax to be applied to make a TXT file uploaded in Forth?
I have few errors (see below) and I am searching
a) for multiline words with a blank after a ;
c) a blank line at the end of the file
d) a blank line between words
e) maximum number of lines
.. or anything else ?

with ILPER started in linux (via wine) in EMU71
>FORTH
HP-71 FORTH 1A
" H71B1:HDRIVE1" LOADF
FTH ERR:; not recognized
" SNAKE:HDRIVE1" LOADF
FTH ERR:; not recognized


UPDATE (closure) all in EMU71
- lifutils in linux did not work properly (dont ask me why.. perhaps.. see bottom; since a long time I have compatibilities issues with ILPER PYILPER and data transfer. In a terminal, the command "cat H71B1.SRC | textlif H71B1 | lifput /media/user/ILPERSTO/HDRIVE16.DAT" included into HDRIVE16.DAT a H71B1 text file but this file could not be uploaded properly in FORTH with " H71B1:HDRIVE1" LOADF because only the 3 first words of the file were uploaded into the FORTHRAM)
- I used following sequence on my linux64bits with ILPER started with wine

unix2dos -v H71B1.SRC

wine "/home/user/.wine/drive_c/Program Files (x86)/HP-Emulators/alifhdr32/alifhdr.exe" H71B1.SRC H71B1.DAT /T

Open ILPer and connect to the EMU71 (all started with wine in linux64bits)

In the DosLink "In" edit field select H71B1.DAT

[B] is the basic prompt
[B]>COPY :DOSLINK TO H71B1
[B]>CAT ALL (file there)

[F] is the FORTH prompt
[F]>“ H71B1” LOADF

all words seems to be there.

Perhaps.. I should have loaded the H71B1 text file into BASIC first and not direct in FORTH mode from the HDRIVE1? will test another time (perhaps..)