Porting a HP41 program to the DM42

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

Porting a HP41 program to the DM42

Post by mcc » Fri Oct 16, 2020 4:30 pm

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: 758
Joined: Tue May 02, 2017 5:48 pm
Location: United States
Contact:

Re: Porting a HP41 program to the DM42

Post by Thomas Okken » Fri Oct 16, 2020 9:18 pm

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: 758
Joined: Tue May 02, 2017 5:48 pm
Location: United States
Contact:

Re: Porting a HP41 program to the DM42

Post by Thomas Okken » Sat Oct 17, 2020 12:37 am

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: 233
Joined: Fri Jun 23, 2017 5:10 am

Re: Porting a HP41 program to the DM42

Post by mcc » Sat Oct 17, 2020 3:04 am

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: 758
Joined: Tue May 02, 2017 5:48 pm
Location: United States
Contact:

Re: Porting a HP41 program to the DM42

Post by Thomas Okken » Sat Oct 17, 2020 3:48 am

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: 246
Joined: Thu May 04, 2017 12:20 pm
Location: France

Re: Porting a HP41 program to the DM42

Post by dlachieze » Sat Oct 17, 2020 7:52 am

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: 233
Joined: Fri Jun 23, 2017 5:10 am

Re: Porting a HP41 program to the DM42

Post by mcc » Sat Oct 17, 2020 12:51 pm

Oh! Thanks! :)
DM 42 - SN: 00373, Firmware release v.:3.16. / DMCP 3.20. as compiled by SwissMicros

Post Reply