Text files import/export on HP-41CX, HP-IL, Mac OS
09-01-2016, 09:45 PM (This post was last modified: 09-01-2016 09:46 PM by dayd.)
Post: #6
 dayd Junior Member Posts: 48 Joined: Mar 2016
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é