Page 1 of 2

Porting a HP41 program to the DM42

Posted: Fri Oct 16, 2020 4:30 pm
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

Re: Porting a HP41 program to the DM42

Posted: Fri Oct 16, 2020 9:18 pm
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.

Re: Porting a HP41 program to the DM42

Posted: Sat Oct 17, 2020 12:37 am
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!

Re: Porting a HP41 program to the DM42

Posted: Sat Oct 17, 2020 3:04 am
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

Re: Porting a HP41 program to the DM42

Posted: Sat Oct 17, 2020 3:48 am
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.

Re: Porting a HP41 program to the DM42

Posted: Sat Oct 17, 2020 7:52 am
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).

Re: Porting a HP41 program to the DM42

Posted: Sat Oct 17, 2020 12:51 pm
by mcc
Oh! Thanks! :)

Re: Porting a HP41 program to the DM42

Posted: Sun Nov 01, 2020 3:55 pm
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 ?

Re: Porting a HP41 program to the DM42

Posted: Sun Nov 01, 2020 6:21 pm
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. :)

Re: Porting a HP41 program to the DM42

Posted: Sun Nov 01, 2020 7:23 pm
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/