Post Reply 
loading FORTH via HP-IL to 71B
09-26-2022, 03:23 PM
Post: #1
loading FORTH via HP-IL to 71B
I have some Forth code in a text file and am trying to work out how to load it into the 71B Forth module.

Do I add the Forth code as a text file to a LIF and then load that into the 71B and then load into Forth and if so, how exactly?

I know I need to use loadf from Forth and I can see mention of a FORTH LIF file type but I can't see any utilities to create this (lifutils) and am unsure if this is a binary file or just the Forth code in ASCII.

Is it also possible to save Forth code from the 71B externally?

Any advice or tips appreciated.

Thanks, dmh

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
09-26-2022, 07:11 PM
Post: #2
RE: loading FORTH via HP-IL to 71B
Sounds like you need to read the manual.
https://literature.hpcalc.org/community/...-om-en.pdf

pyILPER can be helpful for getting text files to a LIF disc image.
* Install lifutils
* Select a Drive tab
* Uncheck the Device enabled box

You can now use pyILPER as a frontend for lifutils. Right-click on a file to perform file functions like Purge or View. Click on Import to copy a text file w/ conversion to a LIF disc image.

Dave
Find all posts by this user
Quote this message in a reply
09-26-2022, 10:18 PM
Post: #3
RE: loading FORTH via HP-IL to 71B
Thanks but I have been wading through all the manuals and the dots haven’t connected for me yet :-)

I have a text file including my Forth code in a LIF attached as mass storage and can copy to the device but am still unclear as to whether it needs to be a Forth file type and how exactly to get it into Forth.

Thanks

(09-26-2022 07:11 PM)Dave Frederickson Wrote:  Sounds like you need to read the manual.
https://literature.hpcalc.org/community/...-om-en.pdf

pyILPER can be helpful for getting text files to a LIF disc image.
* Install lifutils
* Select a Drive tab
* Uncheck the Device enabled box

You can now use pyILPER as a frontend for lifutils. Right-click on a file to perform file functions like Purge or View. Click on Import to copy a text file w/ conversion to a LIF disc image.

Dave

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
09-26-2022, 11:24 PM (This post was last modified: 09-27-2022 12:10 AM by Sylvain Cote.)
Post: #4
RE: loading FORTH via HP-IL to 71B
I am using the following: 71B, FORTH/Assembler module, IL module, IL cables, PILbox, pyILPER and LIF utilities.

From the command line:
  1. create an ASCII text file and save it as scr00001.txt (I use vi on Linux/macOS/BSD)
    Code:
    : hw  ." Hello, World!" ;
    .
  2. Convert the ASCII text file into a LIF text file
    Code:
    textlif SCR00001 <scr00001.txt >scr00001.lif
    .
  3. Create a LIF volume file (disk = HP9114B double sided disk, 128 file entries)
    Code:
    lifinit -m disk fth71scr.dat 128
    .
  4. Add screen LIF file (scr00001.lif) to the LIF volume (fth71scr.dat)
    Code:
    lifput fth71scr.dat scr00001.lif
    .
  5. Show LIF volume content
    Code:
    lifdir fth71scr.dat
    Code:
    Volume : , formatted : 26/09/22 19:00:00
    Tracks: 77 Surfaces: 2 Blocks/Track: 16 Total size: 2464 Blocks, 630784 Bytes
    SCR00001    TEXT          256/256      26/09/22 18:53:57
    1 files (128 max), last block used: 18 of 2464
    .
  6. Start pyILPER and set a virtual drive with the LIF volume: fth71scr.dat
    .
  7. In the HP-71B, start FORTH
    Code:
    FORTH
    .
  8. Load the screen file from mass storage into the FORTH environment
    Code:
    " SCR00001:MASSMEM" LOADF
    .
  9. Execute the new hw FORTH word
    Code:
    hw
    Code:
    Hello, World! OK {0}
Find all posts by this user
Quote this message in a reply
09-27-2022, 03:45 AM
Post: #5
RE: loading FORTH via HP-IL to 71B
A less precise, but maybe more easily conceptually grasped reply than Sylvain's usual masterpiece is this:

71B Forth does not use the 'read a screen' metaphor common in most Forth implementations. Instead one 'reads' a 71B text file, containing your Forth word definitions using the LOADF command. As the words are processed, they are added into the current vocabulary, and thereafter can be used immediately.

So with all your content in the text file MYWORDS in main RAM of the 71B, just use:

" MYWORDS" LOADF and it will read and process the content into your FORTH system (maintained in the FORTHRAM:MAIN file in RAM).

Also note that if you read this file in again, it will add the new words above the old words (i.e. it will not replace them, they are simply added at the end) and use up valuable RAM. Use the Forth command:

" BLAH" FORGET to remove all the words in your dictionary from the word BLAH to the end.

hth

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
09-27-2022, 10:37 AM (This post was last modified: 09-27-2022 11:32 AM by Stefan_Titan2944A.)
Post: #6
RE: loading FORTH via HP-IL to 71B
So,

the FORTH code TEXT file is in a LIF volume on a mass storage.
It should already be an HP ASCII text, in LlF Type 1 format.
(Is it possible to write a non-HP ASCII TEXT file to a LIF volume,
without adding EXTFILES first?. Hm ...)

1.
RESTORE IO in BASIC

2.
" [text_file_name]:MASSMEM" LOADF in FORTH



N.B.
The file is not "loaded into the 71B Forth module", but
COMPILED into the CURRENT VOCABULARY of the FORTHRAM file.

CORRECTION:
The TEXT file is streamed as an input (like keyboard inputs) and parsed - WORD definitions ( : ; ) are COMPILED, all other stuff is executed as IMMEDIATE.
Given the way FORTH works (in general), even ( : ; ) is executed IMMEDIATE, with a COMPILED result. :-)
Find all posts by this user
Quote this message in a reply
09-27-2022, 11:05 AM
Post: #7
RE: loading FORTH via HP-IL to 71B
Thanks Sylvain, Bob and Stefan - exactly what I was looking for - I wasn't far off and all working now :-)

I understand about the compiling into a vocabulary so excuse my generic terms ;-)

Regards, dmh

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
09-27-2022, 11:21 AM
Post: #8
RE: loading FORTH via HP-IL to 71B
(09-27-2022 11:05 AM)dmh Wrote:  I understand about the compiling into a vocabulary so excuse my generic terms ;-)

No problem - it was just hard to nail your issue.
Always relieving to have some TITAN / FORTH folks here!
Have fun.
Find all posts by this user
Quote this message in a reply
Post Reply 




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