Stand alone Encoder/Decoder

Discussion around the Swiss Micros DM42 calculator.
Bernd
Posts: 10
Joined: Sat Jul 22, 2017 8:17 pm

Re: Stand alone Encoder/Decoder

Post by Bernd » Mon Mar 19, 2018 9:07 pm

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: 100
Joined: Wed May 24, 2017 4:26 pm
Location: Germany

Re: Stand alone Encoder/Decoder

Post by Guenter » Mon Mar 19, 2018 9:49 pm

toml_12953 wrote:
Sun Mar 18, 2018 2:53 am
Guenter wrote:
Sat Mar 17, 2018 11:04 pm
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
DM42 SN:00004 and SN:00184

jayhawk
Posts: 3
Joined: Sun Mar 18, 2018 12:06 pm

Re: Stand alone Encoder/Decoder

Post by jayhawk » Tue Mar 20, 2018 2:53 pm

Mcastil7 wrote:
Fri Mar 16, 2018 4: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: 87
Joined: Fri Dec 15, 2017 1:34 pm
Location: Manchester, UK

Re: Stand alone Encoder/Decoder

Post by ijabbott » Tue Mar 20, 2018 7:42 pm

jayhawk wrote:
Tue Mar 20, 2018 2: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 12:06 pm

Re: Stand alone Encoder/Decoder

Post by jayhawk » Wed Mar 21, 2018 6:47 am

ijabbott wrote:
Tue Mar 20, 2018 7:42 pm
jayhawk wrote:
Tue Mar 20, 2018 2: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 9:35 am

Re: Stand alone Encoder/Decoder

Post by RobFisher » Tue Mar 27, 2018 10:26 am

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: 16
Joined: Fri Mar 30, 2018 9:36 am
Location: Swaziland

Re: Stand alone Encoder/Decoder

Post by pica » Thu Apr 12, 2018 10:39 pm

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?

rprosperi
Posts: 355
Joined: Mon Apr 24, 2017 5:48 pm
Location: New York

Re: Stand alone Encoder/Decoder

Post by rprosperi » Thu Apr 12, 2018 10:51 pm

pica wrote:
Thu Apr 12, 2018 10:39 pm
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

Thomas Okken
Posts: 456
Joined: Tue May 02, 2017 3:48 pm
Contact:

Re: Stand alone Encoder/Decoder

Post by Thomas Okken » Fri Apr 13, 2018 1:17 am

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: 10
Joined: Tue Oct 03, 2017 10:39 pm

Re: Stand alone Encoder/Decoder

Post by axd » Sat May 12, 2018 2:16 pm

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