HP Forums
Connect HP41 to Apple - 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: Connect HP41 to Apple (/thread-20985.html)



Connect HP41 to Apple - PeterP - 12-14-2023 06:37 PM

Hi, I am using my HP41CY in the office every day. its powered neatly by the USB Powersupply from Diego.

I would like to have an easy way to move different roms from the computer into the RAMBOX of the CY. Exchanging progam code would be a nice plus but are of secondary interest.

What is the most elegant set-up possible today for me to do so - from a modern Apple computer.

Any tips will be much appreciated (even though they might be detrimental to my work productivity at times...)

Cheers,

PeterP


RE: Connect HP41 to Apple - Sylvain Cote - 12-15-2023 05:09 AM

Hello Peter,

To transfer files between the HP-41 and my MacBook Pro intel, I use the following: Formatting a virtual tape

Create a LIF volume file of 128KB that can hold a maximum of 64 files
Code:
lifinit -z -m cass tape01.dat 64

Set LIF volume name to TAPE01
Code:
liflabel tape01.dat TAPE01

Show lif volume catalog
Code:
lifdir tape01.dat
Code:
Volume : TAPE01 , formatted : 14/12/23 23:00:00
Tracks: 2 Surfaces: 1 Blocks/Track: 256 Total size: 512 Blocks, 131072 Bytes
0 files (64 max), last block used: 0 of 512

In pyILPER,
  • add a mass media (aka drive) peripheral and give it a name (ex.: TAPE)
  • restart pyILPER
  • select your drive tab (ex.: TAPE)
  • set the "Drive Type" to "HP82161A"
  • change the "LIF Image File" to "tape01.dat"

Transfer HP-41 program(s) from the computer to the HP-41

Computer side

Write your program in a text file
Ex.: cat hello.txt
Code:
LBL "HELLO"
"HELLO !!!"
AVIEW
END

Compile the HP-41 program from a text file to a raw file
Code:
comp41 <hello.txt >hello.raw

Add a lif header with a name
Code:
raw41lif HELLO <hello.raw >hello.lif

Add lif file to the lif volume
Code:
lifput tape01.dat hello.lif

Show lif volume catalog
Code:
lifdir tape01.dat
Code:
Volume : TAPE01 , formatted : 14/12/23 23:00:00
Tracks: 2 Surfaces: 1 Blocks/Track: 256 Total size: 512 Blocks, 131072 Bytes
HELLO       PGM41          24/256
1 files (64 max), last block used: 10 of 512

HP-41 side

Read HELLO program from tape to main memory
Code:
"HELLO"
LOADP
XEQ "HELLO"

Transfer HP-41 program(s) from the HP-41 to the computer

HP-41 side

save WORLD program from main memory to tape
Code:
"WORLD"
WRTP

Computer side

Catalog lif volume
Code:
lifdir tape01.dat
Code:
Volume : TAPE01 , formatted : 14/12/23 23:00:00
Tracks: 2 Surfaces: 1 Blocks/Track: 256 Total size: 512 Blocks, 131072 Bytes
HELLO       PGM41          24/256
WORLD       PGM41          20/256
2 files (64 max), last block used: 11 of 512

Save WORLD program to a raw file
Code:
lifget -r tape01.dat WORLD world.raw

Decompile the HP-41 program from a raw file to a text file
Code:
decomp41 <world.raw >world.txt

cat world.txt
Code:
LBL "WORLD"
"WORLD"
AVIEW
END

Transfer HP-41 ROM from the computer to the HP-41

Computer side

Show ROM content
Code:
rom41cat <math.rom
Code:
XROM 01,00 Entry = 0068 (Mcode) -MATH_1D
XROM 01,01 Entry = 006b (Focal) MATRIX
...
XROM 01,44 Entry = 0df3 (Focal) TRANS
XROM 01,45 Entry = 0f50 (Focal) *FN

Convert ROM file to ERAMCO
Code:
rom41er MATH1D <math.rom >math.lif

Add ROM lif file to the lif volume
Code:
lifput tape01.dat math.lif

Catalog lif volume
Code:
lifdir tape01.dat
Code:
Volume : TAPE01 , formatted : 14/12/23 23:00:00
Tracks: 2 Surfaces: 1 Blocks/Track: 256 Total size: 512 Blocks, 131072 Bytes
HELLO       PGM41          24/256
WORLD       PGM41          20/256
MATH1D      X-M41        5121/5120
3 files (64 max), last block used: 31 of 512

HP-41 side

load MATH1D ROM from tape to rambox page
Code:
"MATH1D"        // ROM filename
12              // page to store ROM
READPG          // read ROM file and save it to the specified page

Transfer HP-41 ROM from the HP-41 to the computer

HP-41 side

Save a ROM page from rambox page to the tape
Code:
"MYROM"         // ROM filename
13              // page of the ROM to save
WRTPG           // save ROM at page to the tape

Computer side

Catalog lif volume
Code:
lifdir tape01.dat
Code:
Volume : TAPE01 , formatted : 14/12/23 23:00:00
Tracks: 2 Surfaces: 1 Blocks/Track: 256 Total size: 512 Blocks, 131072 Bytes
HELLO       PGM41          24/256
WORLD       PGM41          20/256
MATH1D      X-M41        5121/5120
MYROM       X-M41        5121/5120
4 files (64 max), last block used: 52 of 512

Get MYROM ROM from lif volume to a ROM file in ERAMCO format
Code:
lifget -r tape01.dat MYROM myrom.er

Convert the ERAMCO file to a ROM file format
Code:
er41rom <myrom.er >myrom.rom

Show ROM content
Code:
rom41cat <myrom.rom
Code:
...

edit: add more information for pyILPER


RE: Connect HP41 to Apple - PeterP - 12-15-2023 02:31 PM

Sylvain, wow, this is perfect and something I can implement given I have all the pieces. Thank you so much!
And even more so for the wonderful detail and structure in how you have laid this out for me. Thank you for taking the time!

Now I just have to come up with a good answer to "so what is this old black box connected to that smaller grey box connected to that kind old looking calculator doing on your desk?

Cheers

Peter


RE: Connect HP41 to Apple - Bill Duncan - 12-16-2023 12:52 AM

Awesome instructions!
Thank you so much!


(12-15-2023 05:09 AM)Sylvain Cote Wrote:  Hello Peter,

To transfer files between the HP-41 and my MacBook Pro intel, I use the following: Formatting a virtual tape

Create a LIF volume file of 128KB that can hold a maximum of 64 files
Code:
lifinit -z -m cass tape01.dat 64

Set LIF volume name to TAPE01
Code:
liflabel tape01.dat TAPE01

Show lif volume catalog
Code:
lifdir tape01.dat
Code:
Volume : TAPE01 , formatted : 14/12/23 23:00:00
Tracks: 2 Surfaces: 1 Blocks/Track: 256 Total size: 512 Blocks, 131072 Bytes
0 files (64 max), last block used: 0 of 512

In pyILPER,
  • add a mass media (aka drive) peripheral and give it a name (ex.: TAPE)
  • restart pyILPER
  • select your drive tab (ex.: TAPE)
  • set the "Drive Type" to "HP82161A"
  • change the "LIF Image File" to "tape01.dat"

Transfer HP-41 program(s) from the computer to the HP-41

Computer side

Write your program in a text file
Ex.: cat hello.txt
Code:
LBL "HELLO"
"HELLO !!!"
AVIEW
END

Compile the HP-41 program from a text file to a raw file
Code:
comp41 <hello.txt >hello.raw

Add a lif header with a name
Code:
raw41lif HELLO <hello.raw >hello.lif

Add lif file to the lif volume
Code:
lifput tape01.dat hello.lif

Show lif volume catalog
Code:
lifdir tape01.dat
Code:
Volume : TAPE01 , formatted : 14/12/23 23:00:00
Tracks: 2 Surfaces: 1 Blocks/Track: 256 Total size: 512 Blocks, 131072 Bytes
HELLO       PGM41          24/256
1 files (64 max), last block used: 10 of 512

HP-41 side

Read HELLO program from tape to main memory
Code:
"HELLO"
LOADP
XEQ "HELLO"

Transfer HP-41 program(s) from the HP-41 to the computer

HP-41 side

save WORLD program from main memory to tape
Code:
"WORLD"
WRTP

Computer side

Catalog lif volume
Code:
lifdir tape01.dat
Code:
Volume : TAPE01 , formatted : 14/12/23 23:00:00
Tracks: 2 Surfaces: 1 Blocks/Track: 256 Total size: 512 Blocks, 131072 Bytes
HELLO       PGM41          24/256
WORLD       PGM41          20/256
2 files (64 max), last block used: 11 of 512

Save WORLD program to a raw file
Code:
lifget -r tape01.dat WORLD world.raw

Decompile the HP-41 program from a raw file to a text file
Code:
decomp41 <world.raw >world.txt

cat world.txt
Code:
LBL "WORLD"
"WORLD"
AVIEW
END

Transfer HP-41 ROM from the computer to the HP-41

Computer side

Show ROM content
Code:
rom41cat <math.rom
Code:
XROM 01,00 Entry = 0068 (Mcode) -MATH_1D
XROM 01,01 Entry = 006b (Focal) MATRIX
...
XROM 01,44 Entry = 0df3 (Focal) TRANS
XROM 01,45 Entry = 0f50 (Focal) *FN

Convert ROM file to ERAMCO
Code:
rom41er MATH1D <math.rom >math.lif

Add ROM lif file to the lif volume
Code:
lifput tape01.dat math.lif

Catalog lif volume
Code:
lifdir tape01.dat
Code:
Volume : TAPE01 , formatted : 14/12/23 23:00:00
Tracks: 2 Surfaces: 1 Blocks/Track: 256 Total size: 512 Blocks, 131072 Bytes
HELLO       PGM41          24/256
WORLD       PGM41          20/256
MATH1D      X-M41        5121/5120
3 files (64 max), last block used: 31 of 512

HP-41 side

load MATH1D ROM from tape to rambox page
Code:
"MATH1D"        // ROM filename
12              // page to store ROM
READPG          // read ROM file and save it to the specified page

Transfer HP-41 ROM from the HP-41 to the computer

HP-41 side

Save a ROM page from rambox page to the tape
Code:
"MYROM"         // ROM filename
13              // page of the ROM to save
WRTPG           // save ROM at page to the tape

Computer side

Catalog lif volume
Code:
lifdir tape01.dat
Code:
Volume : TAPE01 , formatted : 14/12/23 23:00:00
Tracks: 2 Surfaces: 1 Blocks/Track: 256 Total size: 512 Blocks, 131072 Bytes
HELLO       PGM41          24/256
WORLD       PGM41          20/256
MATH1D      X-M41        5121/5120
MYROM       X-M41        5121/5120
4 files (64 max), last block used: 52 of 512

Get MYROM ROM from lif volume to a ROM file in ERAMCO format
Code:
lifget -r tape01.dat MYROM myrom.er

Convert the ERAMCO file to a ROM file format
Code:
er41rom <myrom.er >myrom.rom

Show ROM content
Code:
rom41cat <myrom.rom
Code:
...

edit: add more information for pyILPER



RE: Connect HP41 to Apple - Sylvain Cote - 12-16-2023 12:57 AM

(12-15-2023 02:31 PM)PeterP Wrote:  Sylvain, wow, this is perfect and something I can implement given I have all the pieces. Thank you so much!
(12-16-2023 12:52 AM)Bill Duncan Wrote:  Awesome instructions! Thank you so much!
Glad I could help

(12-15-2023 02:31 PM)PeterP Wrote:  Now I just have to come up with a good answer to "so what is this old black box connected to that smaller grey box connected to that kind old looking calculator doing on your desk?
Well, this is out of my reach. Wink


RE: Connect HP41 to Apple - hesc - 01-20-2024 12:29 PM

LS,
I wrote a lot of programs for my old HP41CV (which is dead since yesterday, 44 years old…, but I have a second one) and had some experience to copy these programs, making use of an HP-IL HP41 interface and a so-called Pil-box. For that purpose, I made use of a file transfer program Ilper.exe. The transfer was not very stable, because sometimes it did not recognize COM 5 (my USB, I believe) and also gave an error at the end sometimes.
However, some years ago I was successful in transferring programs in that way and used a file conversion program named HP41UC. I made notices of it and made the use of option /l to /t, i.e. *.lif to *.txt. For some reasons that does not work anymore, but I still had the *.dat file from the original file transfer and a *.txt file from the conversion result. In the meantime I looked at the *.dat file and copied it to a *.BIN file and a *.RAW file. In that case the transfer to the *.TXT file worked, but with some typical headers.
Question to you is:
What is the original file format resulting from the HP41 to HPIL transfer and what kind of headers are connected to the raw and bin format?
Do you have an idea why the transfer is not very stable? Do you think there is a mismatch in serial? Settings or so?
Now, I am using an older Windows computer. The *.exe work under a DOS environment. I tried a parallel desktop with windows 11 on my Mac Studio, but then the *.exe do not work. Has someone an idea how to solve these problems?
Sorry for the long intro… Hope you have time to answer…
Kind regards,
Henk Schellen


RE: Connect HP41 to Apple - hesc - 01-22-2024 06:57 PM

Dear Sylvain,

This is a beautiful overview for people like me who do not have a lot of experience with the exchange of files between different systems. I was able to exchange files between my HP41 and windows and now with your help I am able to transfer files between my HP41 and my Mac, making use of

82160A - HP-41/IL interface
PIL-Box - HP-IL/USB interface
pyILPER - virtual HP-IL peripherals
lifutils - LIF/41/71/75 files utilities

I wonder if you have an analog overview for transferring files/programs between my HP71B and my Mac.
Thanks on forehand.

Kind regards,
Henk Schellen


RE: Connect HP41 to Apple - Sylvain Cote - 01-23-2024 01:24 PM

Hello Henk,
I do not have any free time right now, I will post an answer to your last two messages in a couple of days.


RE: Connect HP41 to Apple - hesc - 01-23-2024 05:45 PM

Dear Sylvain,

Thank you. I look forward to it.

Kind regards,

Henk


RE: Connect HP41 to Apple - Sylvain Cote - 01-24-2024 01:59 AM

Hello Henk,

(01-20-2024 12:29 PM)hesc Wrote:  What is the original file format resulting from the HP41 to HPIL transfer and what kind of headers are connected to the raw and bin format?

HP-41 compiled program file formats
Code:
.RAW →                    [compiled code] + [1-byte checksum] + [trailer]
.BIN → [ 2-byte header] + [compiled code] + [1-byte checksum] + [trailer]
.DAT → [ 4-byte header] + [compiled code] + [2-byte checksum]

HP-IL formats
Code:
.LIF → LIF file   - a file with a 32-byte lif header
.DAT → LIF volume - a virtual cassette or floppy disk
Code:
.LIF → [32-byte header] + [file data]
.P41 → same a .LIF
.PAK → same a .LIF
.DAT → [256-byte system record] + [n * 256-byte unused/reserved records] + [n * 256-byte directory records] + [n * 256-byte file data records]

More information can be found here:
(01-20-2024 12:29 PM)hesc Wrote:  Do you have an idea why the transfer is not very stable?
Do you think there is a mismatch in serial? Settings or so?
I have never used HP41UC so I cannot help you here.


RE: Connect HP41 to Apple - floppy - 01-24-2024 10:33 AM

(01-22-2024 06:57 PM)hesc Wrote:  I wonder if you have an analog overview for transferring files/programs between my HP71B and my Mac.
A mac is expensive. A ligther version is possible ;-)
https://www.hpmuseum.org/forum/thread-19053-post-181142.html#pid181142


RE: Connect HP41 to Apple - hesc - 01-24-2024 02:55 PM

Dear Sylvain,

Thank you for the overview. In the meantime I solved my connection problems between HP71 and Mac. Yesterday, I published a new tread on it. If you have time, would you please have a look at it foor possible corrections?

Thanks,
Henk