Post Reply 
Text files import/export on HP-41CX, HP-IL, Mac OS
07-14-2016, 02:05 PM
Post: #1
Text files import/export on HP-41CX, HP-IL, Mac OS
I'm having hard times figuring out how to import CX text files, made on my mac, to the 41CX. My setup is HP-41CX with 2 extended memory modules, HP-IL module, PIL-Box, pyILPER on Mac OS Yosemite. I use those text files as databases and printout, on the field, with the 41.
For export I use this tiny program inspired from ‘Extended Functions Made Easy’ by Keith Jarett and then copy the content from the printer’s log of the Pyilper program:

Code:

01◆LBL "PRFLAS"
 02 STO L
 03 ADV
 04 INT
 05 SEEKPTA
 06 LASTX
 07 FRC
 08 SF 25
 09◆LBL 01
 10 GETREC
 11 FC? 25
 12 RTN
 13 ACA
 14 FS? 17
 15 GTO 01
 16 PRBUF
 17 X=0?
 18 GTO 01
 19 ISG L
 20 GTO 01
 21 CLA
 22 END

Use:
- Put the name file on the Alpha register or erase it to work on the current selected text file.
- Put 0 on the X register to print the entire file or use ISG format iii.fff where i is the initial record (or line) to be printed and f the final one.
The stack is lost, L is used as index, no other register is used.

Be my saver!
Thanks
André
Find all posts by this user
Quote this message in a reply
07-14-2016, 04:14 PM
Post: #2
RE: Text files import/export on HP-41CX, HP-IL, Mac OS
As it was out there, I realized that PRFLAS could benefit from some minor changes. Also, if you want to use this (we never know…) on 41c be aware of the possibility of the PURFL bug or add ALENG 1/X RDN after the program label.
Use remains the same as above.

Code:

 01◆LBL "PRFLAS"
 02 STO L
 03 ADV
 04 INT
 05 SEEKPTA
 06 LASTX
 07 FRC
 08 SF 25
 09◆LBL 11
 10 GETREC
 11 FC? 25
 12 GTO 12
 13 ACA
 14 FS? 17
 15 GTO 11
 16 PRBUF
 17 X≠0?
 18 ISG L
 19 GTO 11
 20◆LBL 12
 21 CLA
 22 END


A.
Find all posts by this user
Quote this message in a reply
08-29-2016, 06:03 AM
Post: #3
RE: Text files import/export on HP-41CX, HP-IL, Mac OS
Hello André,

transfer the text file(s) from the HP-41CX to the virtual disk. Then you can import / export HP LIF text files to or from the file system. You need to install a recent version of the LIF-Utilities to get the file management controls enabled in pyILPER.

Regards,
Joachim
Find all posts by this user
Quote this message in a reply
08-29-2016, 02:54 PM
Post: #4
RE: Text files import/export on HP-41CX, HP-IL, Mac OS
Here is an alternative to import text files using the DOSLINK device.
Importing text data from an external device is easy when the text strings are less than 24 characters (such as a list of numbers) but for managing text strings larger than 24 characters, you need the Extended I/O ROM and the INACL function that uses the flag 17 as a end-of-line indication as is doing GETREC.

Here is a small piece of code that may be a good starting point for you (== not extensively tested).
To use it (in AUTOIO), set DOSLINK to point to your text file. Use an empty line as a end-of-file indication in your file.
The ASCII file in the 41C X-M must be existing.

Code:

 LBL "INFLAS"
  0  SEEKPTA
  "DOSLINK"  FINDID  SELECT
  CLRDEV
LBL 01
  INACL  ATOX
  ALENG  X=0?  GTO 09
  APPREC
  GTO 03
LBL 02
  INACL  ATOX
  APPCHR
LBL 03
  FS? 17  GTO 02
  GTO 01
LBL 09
  CLA 
  END
Visit this user's website Find all posts by this user
Quote this message in a reply
09-01-2016, 01:21 PM (This post was last modified: 09-01-2016 01:34 PM by dayd.)
Post: #5
RE: Text files import/export on HP-41CX, HP-IL, Mac OS
Thank you very much Joachim and Jean-François for your replies,

I finally have now a solution to to transfer text files back and forward, sometimes what a man need is just… a little push!
I do have explored the LIF-Utilities (for an amount of time that will stay confidential), but I don’t really know why, files didn’t compile correctly. At the time I thought maybe it wasn’t fit for the 41cx but only for the 71b, I was wrong. After Joachim response, I give it another try and get things done in the first attempt.
The alternative J-F solution is indeed very interesting. If I understand correctly, ASCII data served by a device will be be compiled by the HP41 into a text file. I look forward to test it later on my development process as for now I do not have access (yet) to the Extended I/O ROM. I guess DOSLINK can run on small connected devices which can lead to original applications in the 41.
For those who may be interested I will, in a later post, show step by step how text files can be imported to the HP-41 using Joachim multiplatform version of ILPER (pyILPER) and lifutils that you can found here https://github.com/bug400

Best regards,
André
Find all posts by this user
Quote this message in a reply
09-01-2016, 09:45 PM (This post was last modified: 09-01-2016 09:46 PM by dayd.)
Post: #6
RE: Text files import/export on HP-41CX, HP-IL, Mac OS
I’ll be using my text files more for database purposes, but here for sharing this little process here’s a different exercise; printing from the 41 the content of code frame bellow:

Code:
 ******* _/ **********
****    _/         ****
***    _/           ***
**    _/_/_/ _/_/_/  **
**   _/  _/ _/  _/   **
**  _/  _/ _/_/_/    **
***       _/        ***
****     _/        ****
 ****** _/ ***********
 
 i   n   v   e   n   t

At this point, I assume you have a 41C/CV with Extended Functions module or a 41CX, the great PIL-Box, and pyILPER and LIF-Utilities already installed from the like above (If not you can found the PIL-Box here http://www.jeffcalc.hp41.eu/hpil/index.html ).
Some details may vary if you’re not on Mac OS.

- Copy the text and paste it in your usual text editor (like TextMate, Total Commander, etc…) and save it as logo.txt (I almost always use UTF-8 LF encoding norm) in your working folder; now we have our text file.
- Use a Lif disk file in that same folder or change the code accordingly, I provide one here, that contains PRFLAS and PKFLAS for printing and packing text files.
- Open a Terminal window and point to your working folder.

Code:
cd ~/pyILPER/Projects/Design

Non we can compile the text in a new file and compatible format with:

Code:
cat logo.txt | textlif LOGO > logo.t41

And put that file in the file disk:

Code:
lifput disk.lif logo.t41

At this point we are pretty much done on the computer side, just, as we have to create the file in Extended memory, is better to know his size, so, with all the text selected in the original logo.txt file, in Texmate I do [MAJ CTRL N] which gives me the total number of characters (and linefeed).
238 + 1 (last line without linefeed) + 1 = 240 bytes
240 / 7 = 34,286
so 35 registers are needed (otherwise you can still use more registers and pack later).

Fire up the hardware, create the file LOGO in EM, load the LOGO file in it from disk.lif with pyILPER’s help, and then send it to the printer with PRFLAS.

In my own files, I also have the boring step of transposing incompatibles characters, like removing accents and so on. At some point I will have to create or find a script to do so. If you’re already have one that works well don’t hesitate do share it here…

Images are the output of the text on the HP-IL printer 82162A and Infrared printer 82240B from the 41CX. Interesting to see how spacing is different one from another. The IR one seams better suited for graphics and the HP-IL for readability. Don’t know if the 82143A is also different. I do have an HP-IL 2225 but it doesn’t print (cartridge contacts corroded).

André


.zip  disk.and.images.zip (Size: 75.41 KB / Downloads: 12)
Find all posts by this user
Quote this message in a reply
09-01-2016, 10:16 PM (This post was last modified: 09-07-2016 01:29 AM by dayd.)
Post: #7
RE: Text files import/export on HP-41CX, HP-IL, Mac OS
Here’s the code and usage of the mentioned program PKFLAS

It works only with the 41CX/CL (as it uses special functions from the CX) and text files.
I find it useful for managing memory and file sizes.

Usage:

Put the file name in alpha register or clear it to work on the selected file and execute PKFLAS

It will display:
the amount of Extended Memory available (max size for the file),
the actual file size,
and the minimum size the file can be (with the actual content).

From there you can:
Press R/S to pack the file to its minimum or
Put your specific amount (between min and max) and press R/S or
Press RDN and R/S to use all available registers
(or don’t hit R/S and the file remains intact and selected).

Code:
01◆LBL "PKFLAS"
 02 EMROOM
 03 PSE
 04 FLSIZE
 05 PSE
 06 ASROOM
 07 7
 08 /
 09 INT
 10 -
 11 STOP
 12 RESZFL
 13 END

André
Find all posts by this user
Quote this message in a reply
02-05-2020, 01:39 AM (This post was last modified: 02-05-2020 04:23 AM by dayd.)
Post: #8
RE: Text files import/export on HP-41CX, HP-IL, Mac OS
As the program PKFLAS, was brought to my attention, today, I noticed a stupid mistake I did years ago in the post above and make a change to reflect more the behaviour I wanted. I hope I’ll get it completely right this time...
To make it simple: the registers available are not the max size possible for the file. So the new version display the same thing, Available free registers in XM / Actual file size / Minimum file size, except that when it stops the actual max size possible for the file is in Y so you can toggle between min and max with X<>Y and hit R/S to validate. Ouf...sorry...
Added just line 6 Wink

Code:
 01◆LBL "PKFLAS"
 02 EMROOM
 03 PSE
 04 FLSIZE
 05 PSE
 06 ST+ Y
 07 ASROOM
 08 7
 09 /
 10 INT
 11 -
 12 STOP
 13 RESZFL
 14 END
Find all posts by this user
Quote this message in a reply
Post Reply 




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