Stand alone Encoder/Decoder

Discussion around the SwissMicros DM42 calculator
Bernd
Posts: 13
Joined: Sat Jul 22, 2017 10:17 pm

Re: Stand alone Encoder/Decoder

Post by Bernd »

You can use the Free42 to convert code from txt to raw and vice versa. Copy the code from the editor to the clipboard, switch to program mode in Free42 and paste the code. After this you can export the code to a Raw file. This works also the other way round from raw to txt.

Regards
Bernd
User avatar
Guenter
Posts: 168
Joined: Wed May 24, 2017 6:26 pm
Location: Germany

Re: Stand alone Encoder/Decoder

Post by Guenter »

toml_12953 wrote:
Sun Mar 18, 2018 3:53 am
Guenter wrote:
Sun Mar 18, 2018 12:04 am
Question: When the captain dates a flight attendant for [censored], Is that work or fun, suggestions?
Is he paid for this fun? If so, it's more like work (the kind of work I'd come out of retirement for!)
No work, it's really fun. If it was work, then tho co pilot (or first officer) had to do it.
Günter
Günter
DM42 SN:00004 and SN:00184 -- DM41X SN:00013 and SN:00955
jayhawk
Posts: 3
Joined: Sun Mar 18, 2018 1:06 pm

Re: Stand alone Encoder/Decoder

Post by jayhawk »

Mcastil7 wrote:
Fri Mar 16, 2018 5:57 pm
I would like to be able to encode/decode programs even when I'm not connected to the internet. Where can I get the program that I can run on my machine (Linux/Mac)—preferably, the source code?

Thanks,

Mauricio
I use Free42 v2.0.16 on Ubuntu Mate for this purpose.

In this version of Free42 You can copy/paste plain text in PRGM mode.

Note that the latest version in Ubuntu's repository is version 1.4.77-1.1, that does not implement this copy/paste feature. So get the latest version from Thomas' site.
User avatar
ijabbott
Posts: 253
Joined: Fri Dec 15, 2017 2:34 pm
Location: GB-MAN

Re: Stand alone Encoder/Decoder

Post by ijabbott »

jayhawk wrote:
Tue Mar 20, 2018 3:53 pm
I use Free42 v2.0.16 on Ubuntu Mate for this purpose.

In this version of Free42 You can copy/paste plain text in PRGM mode.

Note that the latest version in Ubuntu's repository is version 1.4.77-1.1, that does not implement this copy/paste feature. So get the latest version from Thomas' site.
Indeed, that works in all versions of Free42 2.0.x on all platforms except DM42.
jayhawk
Posts: 3
Joined: Sun Mar 18, 2018 1:06 pm

Re: Stand alone Encoder/Decoder

Post by jayhawk »

ijabbott wrote:
Tue Mar 20, 2018 8:42 pm
jayhawk wrote:
Tue Mar 20, 2018 3:53 pm
I use Free42 v2.0.16 on Ubuntu Mate for this purpose.

In this version of Free42 You can copy/paste plain text in PRGM mode.

Note that the latest version in Ubuntu's repository is version 1.4.77-1.1, that does not implement this copy/paste feature. So get the latest version from Thomas' site.
Indeed, that works in all versions of Free42 2.0.x on all platforms except DM42.
Exactly.
From the version history for Free42:
2017-04-22: release 2.0 (beta)

* Copy & Paste now handle matrices, ALPHA mode, and PRGM mode.
Versions prior to 2.0 only copy/paste from the X register.

And this:
2018-01-07: release 2.0.9

* Program Paste no longer requires line numbers.
is really cool. Makes You able to write complex programs in a txt editor.

As text editor I recommend Geany, an ultra lightweight all-purpose IDE. It has the cool feature of column-select (ALT+SHFT+cursor arrows) so You can quickly remove line numbers of programs pasted from Free42. Also don't forget to remove the first line: '00 { xxx-Byte Prgm }'
RobFisher
Posts: 3
Joined: Fri Mar 16, 2018 10:35 am

Re: Stand alone Encoder/Decoder

Post by RobFisher »

I threw together a quick hack to be able to get Free42 to convert a program from text to binary on the command line: https://github.com/RobFisher/free42-lin ... 0def4fb07f

Probably this could be developed further, such as removing the dependency on GTK and adding the option to convert raw back to text.

In fact a completely command-line Free42 would be nice. You could have it act like a filter (pipe in the program and arguments and it prints out X); and have an interactive mode for debugging. A fun project for anyone with spare time (I rarely do, these days). Oh, and an Emacs mode for editing, and have Free42 validate the code for flymake-mode to work... :D
User avatar
pica
Posts: 70
Joined: Fri Mar 30, 2018 11:36 am
Location: Eswatini

Re: Stand alone Encoder/Decoder

Post by pica »

Is there any reason why DM42 can't be persuaded to load programs in either .raw or .txt format?
Surely there there is already an interpreter which converts the programs we type in on the keyboard to machine language?
HP50G HP35s Free42 DM42.
Testing WP43S, C43.
rprosperi
Posts: 1703
Joined: Mon Apr 24, 2017 7:48 pm
Location: New York

Re: Stand alone Encoder/Decoder

Post by rprosperi »

pica wrote:
Fri Apr 13, 2018 12:39 am
Is there any reason why DM42 can't be persuaded to load programs in either .raw or .txt format?
Surely there there is already an interpreter which converts the programs we type in on the keyboard to machine language?
The programs are not converted to machine language, they are stored in an internal format, (likely very) close to .raw format, at least in the case of the 42S -Thomas is this the same for Free42?

The 42s ROM and Free42 program "interpret" the FOCAL code on-the-fly (though some things like jump addresses are stored to make program execution faster).
--bob p

DM42: β00071 & 00282, DM41X: β00071 & 00656, DM10L: 071/100
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Stand alone Encoder/Decoder

Post by Thomas Okken »

The format used internally by Free42 is completely different from that used inside the HP-42S. Without going into details, the Free42 format uses roughly twice as much memory, but is much easier to decode for program execution.

Free42 converts from the HP-42S format to its own format while importing raw files, and does the reverse when exporting raw files. The internal format is only used in memory and in the state files.

Could the DM42 be modified so that it could load and save programs in text format? Absolutely. In Free42 2.0, I added code that performs those conversions, for copying and pasting programs using the clipboard. That code, currently unused in the DM42 because it has no clipboard, could be used for loading and saving programs from and to text files as well.
axd
Posts: 15
Joined: Wed Oct 04, 2017 12:39 am

Re: Stand alone Encoder/Decoder

Post by axd »

You are right to point this out. I drew Michael's attention to this issue a long time ago.

It used to be possible to download the web page as HTML (complete), but now there seems to be an explicit dependency on a web site.

The dependency on a central server is crippling, IMHO there should be no reason to make users dependent on a web site to provide such services. Making users dependent is the pathway to programmed obsolescence.

The solution is to publish this kind of tools via eg Git or similar versioning, so that anyone can clone and/or download them, stay up-to-date, be able to archive such tools for future, post-apocalypse use (I'm kidding, but I deeply believe in the idea of archival and am convinced such hardware will outlive the makers, and therefore also the websites), and even contribute to ameliorate the tools.
DM15,41, HP15C/48SX/42S/32S
Elektronika, Casio, Facit, Sorobans...

Preserve the HP-42S software
Post Reply