Porting a HP41 program to the DM42

Discussion around the Swiss Micros DM42 calculator.
mcc
Posts: 236
Joined: Fri Jun 23, 2017 5:10 am

Porting a HP41 program to the DM42

Post by mcc »

Hi,

suppose I would find a HP41-program for the HP41* in binary form freely downloadable from the net and there is no
textual representation of that program...

Would this work:
Load the binary blob into the bin-to-ascii converter for the DM41x.
Copy the textual for to a file.
Check the file for synthetic programming and other pitfalls and adapt those if possible.
Convert the corrected textform to a binary blob with the according converter for the DM42.
Load the binary blob into the DM42
Enjoy the result.

By the way: Would be nice to have a
HP41* ascii to DM42 ascii converter, which gives hints to fix those pifalls and mark incompatible parts of the input.

Cheers!
Meino
DM 42 - SN: 00373, Firmware release v.:3.16. / DMCP 3.20. as compiled by SwissMicros
Thomas Okken
Posts: 819
Joined: Tue May 02, 2017 5:48 pm
Location: United States
Contact:

Re: Porting a HP41 program to the DM42

Post by Thomas Okken »

There is no need for a conversion step. Free42 and the DM42 can load HP-41 raw files.
It is a good idea to load the raw file into an HP-41 (real or emulated) first, to check for synthetic instructions.
Thomas Okken
Posts: 819
Joined: Tue May 02, 2017 5:48 pm
Location: United States
Contact:

Re: Porting a HP41 program to the DM42

Post by Thomas Okken »

mcc wrote:
Fri Oct 16, 2020 4:30 pm
By the way: Would be nice to have a
HP41* ascii to DM42 ascii converter, which gives hints to fix those pifalls and mark incompatible parts of the input.
My rom2raw program does this, except it doesn't read HP-41 text, but ROM images. It could be adapted to read raw files..

Parsing program text is a bit harder. Free42 parses HP-42S and HP-41 program text (but doesn't handle synthetics), and program listings always keep showing up that have quirks the parser can't handle... Not exactly a well-standardized format!
mcc
Posts: 236
Joined: Fri Jun 23, 2017 5:10 am

Re: Porting a HP41 program to the DM42

Post by mcc »

Hi Thomas,

The last time I visited the converter page of this site I didn't found a way to convert from ascii to raw. If it is really missing (and the problem isn't
located right in front of my monitor...<cough>)...it would miss it (sorry...this sentence is somehow quirky...)

Without exactly knowing, what is already there/possible:
It is really nice and good to know, that the DM42 and Free42 can read ascii files and convert them to raw format.
On the other hand - since the DM42 has no fully fledged filebrowser (NO critism! This is a calculator and no pocket UNIX! :) one would have
an extra file in the eeprom, which only can be removed via an USB-connection. And if the converting process fails for one reason or another
it is extra work.
Especially, when trying to "bulk convert" programs from sites like this one: http://hp41programs.yolasite.com/ (look under "astrononmy"...what
a treasure!) a command line would be really handy, which can be integrated into batch scripts or even a GUI made with TCL/TK (for example).

Is there any "conversion table" (HP41/42), a lex/yass grammar or anything else, which could help in implementing such a commandline tool beside the method of "read the source, luke!" :) ;) ?

Cheers!
Meino
DM 42 - SN: 00373, Firmware release v.:3.16. / DMCP 3.20. as compiled by SwissMicros
Thomas Okken
Posts: 819
Joined: Tue May 02, 2017 5:48 pm
Location: United States
Contact:

Re: Porting a HP41 program to the DM42

Post by Thomas Okken »

mcc wrote:
Sat Oct 17, 2020 3:04 am
It is really nice and good to know, that the DM42 and Free42 can read ascii files and convert them to raw format.
That's not quite correct. Free42 and the DM42 can read raw files, but as far as text is concerned, you can paste program text into Free42, but since the DM42 doesn't have Copy / Paste, you can't do that there. You'd have to convert your listings to raw files before transferring them to the DM42.
mcc wrote:
Sat Oct 17, 2020 3:04 am
Especially, when trying to "bulk convert" programs from sites like this one: http://hp41programs.yolasite.com/ (look under "astrononmy"...what
a treasure!) a command line would be really handy, which can be integrated into batch scripts or even a GUI made with TCL/TK (for example).

Is there any "conversion table" (HP41/42), a lex/yass grammar or anything else, which could help in implementing such a commandline tool beside the method of "read the source, luke!" :) ;) ?
I'm not aware of such a tool, but I've never really looked for one, either. It would be possible to take the program parsing logic from Free42 and build it as a command-line tool, but it would be a bit of work to separate it out. It would also require some work to make it support HP-41 synthetics. It does handle things like STO Z instead of STO ST Z, and ST/ instead of STO÷, etc., and it handles synthetic numbers, like E4 instead of 1E4, but it does not handle things like RCL M.
dlachieze
Posts: 261
Joined: Thu May 04, 2017 12:20 pm
Location: France

Re: Porting a HP41 program to the DM42

Post by dlachieze »

mcc wrote:
Sat Oct 17, 2020 3:04 am
Is there any "conversion table" (HP41/42), a lex/yass grammar or anything else, which could help in implementing such a commandline tool beside the method of "read the source, luke!" :) ;) ?
There is the HP41UC tool that can be used to convert HP 41 text programs to raw files. These raw files can then be imported in Free42/DM42, but you will have to check them for any non supported instruction (synthetic but not only, for ex. not all of the 41 extended functions are supported by the 42).
DM42: 00425 - DM41X: β00066
mcc
Posts: 236
Joined: Fri Jun 23, 2017 5:10 am

Re: Porting a HP41 program to the DM42

Post by mcc »

Oh! Thanks! :)
DM 42 - SN: 00373, Firmware release v.:3.16. / DMCP 3.20. as compiled by SwissMicros
hpgene
Posts: 30
Joined: Mon May 29, 2017 3:02 pm

Re: Porting a HP41 program to the DM42

Post by hpgene »

Thomas Okken wrote:
Sat Oct 17, 2020 12:37 am

My rom2raw program does this, except it doesn't read HP-41 text, but ROM images. It could be adapted to read raw files..

Gene: Sorry to post to a somewhat older thread, but I wondered if anyone had actually done this for all of the HP roms and /or several other roms that are available for the 41CL / 41X that only run user code? (thinking the FUNSTUFF rom, the HP-67 Games rom, etc. basically any rom with user-code only.

Is there a repository somewhere ?
Thomas Okken
Posts: 819
Joined: Tue May 02, 2017 5:48 pm
Location: United States
Contact:

Re: Porting a HP41 program to the DM42

Post by Thomas Okken »

hpgene wrote:
Sun Nov 01, 2020 3:55 pm
Thomas Okken wrote:
Sat Oct 17, 2020 12:37 am

My rom2raw program does this, except it doesn't read HP-41 text, but ROM images. It could be adapted to read raw files..

Gene: Sorry to post to a somewhat older thread, but I wondered if anyone had actually done this for all of the HP roms and /or several other roms that are available for the 41CL / 41X that only run user code? (thinking the FUNSTUFF rom, the HP-67 Games rom, etc. basically any rom with user-code only.

Is there a repository somewhere ?
Not that I'm aware of, but it could be done. I tested rom2raw with the MOD files from hp41.org and that seemed to work fine, and one user on this forum has reported being able to use the converted Navigation ROM with no issues. I'd post the converted ROMs on my web site but I don't want to jeopardize the Free42 project by posting copyrighted materials on my site, I'm nervous enough about having the HP-42S manual up there already. :)
grsbanks
Posts: 1073
Joined: Tue Apr 25, 2017 11:23 am
Location: Preston, Lancs, UK
Contact:

Re: Porting a HP41 program to the DM42

Post by grsbanks »

Thomas Okken wrote:
Sun Nov 01, 2020 6:21 pm
I'm nervous enough about having the HP-42S manual up there already. :)
You could take it down and link to Eric Rechlin's new documentation repository at https://literature.hpcalc.org/
There are only 10 kinds of people in the world: those who understand binary and those who do not.
Post Reply