DM42 program with EVERY instruction?

Contributions to this software library are always welcome. Please ensure that you post program listings rather than .raw files. They give a reasonable idea of what your program does without having to load them into a DM42 and you can also include comments in your code. Check out the following link for a decoder/encoder: https://technical.swissmicros.com/decoders/dm42/

You can then copy/paste the listing and post it in "code" tags.
Post Reply
hsilop
Posts: 70
Joined: Thu Mar 14, 2019 1:35 am
Location: Canberra, Australia

DM42 program with EVERY instruction?

Post by hsilop »

For fun I am building an DM42 decoder that I can run from the command line. Developing it in PHP. I'm about two thirds through I guess but I haven't got a program that contains all the byte codes for me to test it on. Does anyone know if there is such a program? It doesn't have to do anything sensible, just present every possible instruction with all the allowable variations.

The plan is to build the decoder first, then the encoder. I'm retired so it's more-or-less just a hobby.

Thanks.
Steve

DM32 SN: 00316
DM41X SN: 00854
DM42 SN: 03223


HP11C, HP12C, HP15C, HP16C, HP25, HP32S, HP33C, HP41CV, HP46, HP65
User avatar
pauli
Posts: 252
Joined: Tue May 02, 2017 10:11 am
Location: Australia

Re: DM42 program with EVERY instruction?

Post by pauli »

Look at the Free42 source code?

For import/export it uses an extension of the HP-41 coding.
Internally, it is very different.

Pauli
Thomas Okken
Posts: 1102
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: DM42 program with EVERY instruction?

Post by Thomas Okken »

The "stress" program at http://thomasokken.com/free42/42progs/ is what you're looking for. It's what I used to test Import and Export in Free42. Listing: http://thomasokken.com/free42/42progs/stress.txt

I should update it since it currently only includes non-synthetic variants, while Free42 2.0.16 and later also support synthetic variants for raw imports (nothing as exciting or useful as on the HP-41, but they are working instructions, for the most part). I've never encountered HP-42S programs containing synthetic instructions, though, so this is more of a curiosity than anything else.

You may want to at least support common variants like E4 (number without mantissa) since they do appear in HP-41 listings, and it is nice to be able to handle those.
Thomas Okken
Posts: 1102
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: DM42 program with EVERY instruction?

Post by Thomas Okken »

I just checked the STRESS listing, and it is missing short-form GTO (GTO 00-14). Ugh. I'll review the program, and add the synthetics, this weekend. It's still a useful test case for raw<->text conversions, even in its current state, though.
cdmackay
Posts: 281
Joined: Fri Oct 05, 2018 8:33 pm
Location: Cambridge, UK
Contact:

Re: DM42 program with EVERY instruction?

Post by cdmackay »

Thomas Okken wrote:
Tue Mar 26, 2019 9:52 am
I've never encountered HP-42S programs containing synthetic instructions, though, so this is more of a curiosity than anything else.
off-topic: by coincidence, only today I read that the new Jake's PPC Archive DVD version has added the "recently-located 6-page EduCALC Technical Note #24" on 42S synthetic programming.
Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot
Casio, Rockwell 18R
Thomas Okken
Posts: 1102
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: DM42 program with EVERY instruction?

Post by Thomas Okken »

By an even greater coincidence, I came into the possession of a copy of that Technical Note as well today (thanks Bob!).

Free42 supports the HP-42S synthetic instructions, and has done so since release 2.0.16, but don't get too excited: basically it just means a few more local labels and a few more directly addressable registers.

On the real 42S, you can do ΣREG ST X (and Y, Z, T, L), which causes the ΣREG pointer to point somewhere in the wild blue yonder. I haven't been brave enough yet to try to find out if that can be used in interesting ways, or whether it just crashes the calculator or doesn't do anything at all.
Last edited by Thomas Okken on Wed Mar 27, 2019 1:31 am, edited 1 time in total.
hsilop
Posts: 70
Joined: Thu Mar 14, 2019 1:35 am
Location: Canberra, Australia

Re: DM42 program with EVERY instruction?

Post by hsilop »

Thanks Thomas, I'll have a look at the "stress" program. Sounds like what I am after.
Steve

DM32 SN: 00316
DM41X SN: 00854
DM42 SN: 03223


HP11C, HP12C, HP15C, HP16C, HP25, HP32S, HP33C, HP41CV, HP46, HP65
rprosperi
Posts: 1703
Joined: Mon Apr 24, 2017 7:48 pm
Location: New York

Re: DM42 program with EVERY instruction?

Post by rprosperi »

There are no coincidences...

After recently finding a copy in my files (no idea at all where I got it, or when) I sent it to Jake so everyone can get a copy, and then seeing Thomas' notes about updating the program to test the import, I thought it may be helpful.

Now to try to convince my wife that my pack-rat tendencies pays off every now and then, though I suspect she won't appreciate it all that much...
--bob p

DM42: β00071 & 00282, DM41X: β00071 & 00656, DM10L: 071/100
cdmackay
Posts: 281
Joined: Fri Oct 05, 2018 8:33 pm
Location: Cambridge, UK
Contact:

Re: DM42 program with EVERY instruction?

Post by cdmackay »

thank your wife for us, please Bob :)
Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot
Casio, Rockwell 18R
Thomas Okken
Posts: 1102
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: DM42 program with EVERY instruction?

Post by Thomas Okken »

I updated the STRESS program, adding GTO 14, and also FIX/SCI/ENG 09/10.
GTO 14 because you need to handle short-form GTO (00-14) as well as long-form (all other local labels).
I added the extra display mode instructions because FIX/SCI/ENG 10/11 are encoded in a weird way, different from the 00-09 case, so having only FIX/SCI/ENG 11 as test cases is inadequate.

I also added a new program SYNTH, containing all the synthetic HP-41 functions that need special handling to emulate their behavior in the HP-42S. Note that there are many more possible synthetic combinations on the HP-42S, but this is only for testing HP-41 program import, so you won't find, say, KEY 1 XEQ ST L, even though that is a possible combination, which does work (if there is a LBL ST L for it to jump to, anyway).

Note that handling synthetics is rather optional. I implemented it in Free42 because I could, but I have never encountered programs that actually used HP-42S synthetics, so you're not missing much if you leave it out. Even for importing HP-41 code with synthetics, only synthetic numbers are relevant (namely, period and E by themselves, used as slightly faster alternatives for 0 and 1, I believe). Anything else, like the clever tricks involving registers M-P and whatnot, isn't going to work on the 42S or Free42. Argument bytes 0x64-0x65 and 0x75-0x7a are simply treated as label or register numbers 100-101 and 117-122, and 0x66-0x6f are local labels A-J and 0x7b-0x7f are local labels a-e, in LBL, GTO, XEQ, KEY GTO, and KEY XEQ, and register numbers 102-111 and 123-127 everywhere else, and finally 0x70-0x74 are always X-T and L.
Post Reply