Txt to Raw and Raw to Txt

General discussion about calculators, SwissMicros or otherwise
tycho
Posts: 35
Joined: Sun Nov 05, 2017 4:09 pm
Location: Norway

Re: Txt to Raw and Raw to Txt

Post by tycho »

Below is the old txt2raw utility v1.0 from 2005 written in perl, which used to be linked from the Free42 site. It does not seem to handle all txt file inputs, so some adjustments are needed. Being a developer I may look into this during the holidays, but I would prefer to translate it to python or c++.

PS: If you install git, perl is included.
txt2raw.zip
(7.09 KiB) Downloaded 519 times
"The Answer to the Great Question... Of Life, the Universe and Everything... Is... DM42" ― Adam Douglas
tycho
Posts: 35
Joined: Sun Nov 05, 2017 4:09 pm
Location: Norway

Re: Txt to Raw and Raw to Txt

Post by tycho »

Here is another old code that I dug out from Wayback Machine: Erik Ehrling's 42s2html.exe tool. I added an awk script, gawk.exe and a bat file in order to simplify the usage: raw2txt.bat "prog.raw". Currently it creates "prog.raw.txt" output file, but that can easily be changed.
Because all characters of the HP-42S are not availble in the standard Windows character map some characters are printed as {} escape-sequences, e.g. {DIV}, {SIGMA} etc.
So the awk script tries to convert those back to characters again. However, this is not yet complete/correct, but a good start. All the standard included raw programs does however convert correctly to txt, I think.
raw2txt.zip
(177.21 KiB) Downloaded 475 times
"The Answer to the Great Question... Of Life, the Universe and Everything... Is... DM42" ― Adam Douglas
cappy
Posts: 93
Joined: Sun Jul 30, 2017 7:30 pm

Re: Txt to Raw and Raw to Txt

Post by cappy »

mcc wrote:
Sat Dec 23, 2017 9:01 am
Hi,

over the time I collect A LOT of HP41/HP42s programs in raw format from the internet for the Free42 on my Android tablet.
Some does not run, and until now I found one which 'kills' Free42.
A commandline tool (I am UNIX/Linux based) to batch convert all of these would make it MUCH easier to view
them for problems before transferring them to the Android table or the DM42 internal flash only to see, that
they will not run.

Cheers!
Meino
Did you report this program that kills Free42 to Thomas Okken?
I’m sure he would fix it, which means everyone who has a DM42 would eventually benefit from the fix, in a future FW update.
DM42 SN: 0612
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: Txt to Raw and Raw to Txt

Post by Walter »

cappy wrote:
Sun Jan 21, 2018 2:44 pm
mcc wrote:
Sat Dec 23, 2017 9:01 am
... Some does not run, and until now I found one which 'kills' Free42. ...
Did you report this program that kills Free42 to Thomas Okken?
I’m sure he would fix it, which means everyone who has a DM42 would eventually benefit from the fix, in a future FW update.
Analyzing Meino's sentence, I'm not 100% convinced he meant what he wrote. But he should know ...
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
Thomas Okken
Posts: 1098
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Txt to Raw and Raw to Txt

Post by Thomas Okken »

mcc wrote:
Sat Dec 23, 2017 9:01 am
over the time I collect A LOT of HP41/HP42s programs in raw format from the internet for the Free42 on my Android tablet.
Some does not run, and until now I found one which 'kills' Free42.
I would be interested in seeing those programs. Generally speaking, not all HP-41 programs will run on the HP-42S; specifically, those that depend on ROMs or peripherals, or on the 41's 10-digit precision or 2-digit exponent.

Programs that run on the 42S should run on Free42, again with the possible exception of programs that depend of the 42S' 12-digit precision or -499 to 499 exponent range. Any program that fails for any reason other than numeric precision or range indicates a bug in Free42 and should be reported.

N.B. I believe programs that fail on Free42 because of its greater precision or range to be rare. It's easy to write code that highlights the difference, e.g. 1 ENTER 3 ENTER 1/x x - LOG returns -12 on the 42S and -34 on Free42, but in practice, I haven't encountered any programs yet that have a problem with the precision or range in Free42 (Decimal; Binary is another matter, but the DM42 runs Free42 Decimal).
Tim Butler
Posts: 7
Joined: Fri Feb 02, 2018 10:05 pm

Re: Txt to Raw and Raw to Txt

Post by Tim Butler »

grsbanks wrote:
Sat Dec 23, 2017 9:43 am
If you want the source code (PHP) for the on-line encoder/decoder, you're welcome to adapt that to CLI.
Yes please!

In particular I am interested in a start on the decoding logic to support
editing programs on the calculator and then automatically merging annotations and comments from
a separate source text file.

I'm considering using MVAR commands as descriptive text noop anchors for comments
in addition to local labels.

Thanks!

-tim
RobFisher
Posts: 3
Joined: Fri Mar 16, 2018 10:35 am

Re: Txt to Raw and Raw to Txt

Post by RobFisher »

mcc wrote:
Sat Dec 23, 2017 9:01 am
A commandline tool (I am UNIX/Linux based) to batch convert all of these would make it MUCH easier to view
them
The code to do this is in Free42 already, since you can copy a program to the clipboard as text. I made a command line option to do the reverse, here:
https://github.com/RobFisher/free42-lin ... 0def4fb07f

If I get around to doing the opposite (convert from raw to text) then it will be in this branch (which also contains a couple of fixes to make building on Ubuntu work):
https://github.com/RobFisher/free42-lin ... aw-convert

Usage is:

Code: Select all

free42dec -text-to-raw input.txt output.raw
Limitations are that it only converts one program (I'm not sure yet how multiple programs look in text format) and you need GTK installed (but you don't need an X display, because the program exits before gtk_init). Probably a standalone command line tool is possible but I could only find a makefile for the GTK GUI.
jjohnson873
Posts: 13
Joined: Tue Mar 27, 2018 2:19 pm
Location: Carmel, IN USA

Re: Txt to Raw and Raw to Txt

Post by jjohnson873 »

I look forward to an offline converter program (Txt to Raw and Raw to Txt). The one on the Swiss Micros website works well, but would rather not have to sign online to do the conversion. Is someone working on cross OS platform (Mac OS, Windows 10, Linux) versions of a converter program?

Am I missing something very elementary? I can create a program on my DM42, but I cannot figure out how to save the TXT listing of that program off to a computer file. The DM42 can save my program to a .raw file on my pc or Mac, but how can I get the simple TXT program listing off of my DM42? Is this is possible? Can someone please point me to the procedure?
DM41X S/N: 00010(beta), DM41X S/N: 0866(production) and some other HP calcs.
User avatar
Russel
Posts: 14
Joined: Fri Mar 16, 2018 8:38 pm
Location: USA

Re: Txt to Raw and Raw to Txt

Post by Russel »

jjohnson873 wrote:
Mon Apr 02, 2018 2:44 pm
[...] Am I missing something very elementary? I can create a program on my DM42, but I cannot figure out how to save the TXT listing of that program off to a computer file. The DM42 can save my program to a .raw file on my pc or Mac, but how can I get the simple TXT program listing off of my DM42? Is this is possible? Can someone please point me to the procedure?
I think you must save the program on the DM42 in raw format. Put the DM42 in disk mode and connect to your computer. Copy the program in raw to your computer. Then using the DM42 decoder/encoder web page upload the raw file, then copy and paste the program in text form to a text editor on your computer and save it.

I realize that you are looking for a method to do this on the DM42, but I don't think there is one. At least, not that I know of.

Note: You can simply plug the DM42 (in disk mode) into your computer and upload the raw file directly from the DM42 without copying to your computer. This is what I did below, simply copying and pasting from the decoder web page to this message.

A very simple program to calculate the horse power required (assuming 100% efficiency) given flow in GPM and pressure.

00 { 16-Byte Prgm }
01▸LBL "HydHP"
02 ×
03 1714
04 ÷
05 END
MichaelBak
Posts: 4
Joined: Mon Jun 18, 2018 1:22 am
Location: Virgin Islands
Contact:

Txt to Raw and Raw to Txt

Post by MichaelBak »

Hi
Thanx for your quick reply. Where do I get these forms from please? And can I transfer the properties even if they have outstanding mortgages on them? Thanx in advance for your help

:)
Post Reply