Big stack and program decoder.

Post here to share useful tips and tricks, to ask questions about using your DM42 or to report software-related problems
Post Reply
User avatar
pica
Posts: 70
Joined: Fri Mar 30, 2018 11:36 am
Location: Eswatini

Big stack and program decoder.

Post by pica »

When trying to decode the attached program
Stack.raw
(142 Bytes) Downloaded 155 times
the online decoder gives an error
" Invalid TEXT subcommand at PC:004E "

Rather than copying the listing by hand, I imported it to Free42 on my PC (Linux version 2.5.19) and got the following listing, using Ctrl C and Ctrl V on the display.

I have added comments where the listing came out garbled. The first problem is indeed at line 21, hex 004E

Postscript:
I have just upgraded to Free42 3.0.7, and the program imports fine into Free42. This is a rare case where there was benefit to running an outdated software. So the problem is only with the online decoder.
Following from this, is it recommended to use the PC version of free42 for program decoding? Its not more work than using the online decoder.

Code: Select all

00 { 139-Byte Prgm }
01▸LBL "Stack"
02 CLMENU
03 "PICN"
04 KEY 1 GTO 01
05 "DEPTH"
06 KEY 2 GTO 02
07 "R↑"
08 KEY 3 GTO 03
09 "CLSTK"
10 KEY 4 GTO 04
11 "UNPIC"
12 KEY 5 GTO 05
13 "DUPN"
14 KEY 6 GTO 06
15 KEY 7 GTO 07
16 MENU
17 STOP
18▸LBL 01
19 STO 01
20 DROP
21 "#ʏ"         	 # This should read     PICK IND 01
22 GTO 07
23▸LBL 02
24 XROM 31,38   	# This should read     DEPTH
25 GTO "Stack"
26▸LBL 03
27 R↑
28 RTN
29 GTO "Stack"
30▸LBL 04
31 CLST
32 GTO 07
33▸LBL 05
34 STO 05
35 DROP
36 "$Σ"         	# This should read      UNPICK IND 05
37 GTO "Stack"
38▸LBL 08
39 GTO "Stack"
40▸LBL 06
41 STO 04
42 R↓
43 ""▒"         	# This should read      DUPN IND 04
44 RTN
45▸LBL 07
46 SF 27
47 RTN
48 END
HP50G HP35s Free42 DM42.
Testing WP43S, C43.
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Big stack and program decoder.

Post by Thomas Okken »

Apparently, the latest functions to be added to the code editor were LSTO and YMD, which were introduced in Free42 2.2 in April 2019. There have been a bunch of functions added to Free42 since then: WSIZE WSIZE? BWRAP BSIGNED BRESET (2.4), ANUM X<>F RCLFLAG STOFLAG (2.5.21), LASTO NOP GETKEY1 (2.5.22), FMA (2.5.23), FUNC RTNYES RTNNO RTNERR (2.5.24), NSTK 4STK LNSTK L4STK DEPTH DROP DROPN DUP DUPN R↓N R↑N PICK UNPICK PGMMENU STRACE (3.0), PRMVAR X=? X≠? X<? X≤? X>? X≥? 0=? 0≠? 0<? 0≤? 0>? 0≥? (3.0.1), VARMNU1 ERRNO ERRMSG XSTR (3.0.3), RCOMPLX PCOMPLX (3.0.4), and APPEND EXTEND C→N N→C S→N N→S HEAD LENGTH LIST? NEWLIST XASTO LXASTO NEWSTR POS REV SUBST CAPS Mixed (3.0.6).
Last edited by Thomas Okken on Mon Dec 20, 2021 6:13 am, edited 2 times in total.
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Big stack and program decoder.

Post by Thomas Okken »

That's not counting FPTEST, which is only implemented in debug builds, and ACCEL LOCAT HEADING, which are only implemented in the Android and iOS version, and the 12 Time Module functions I implemented; all of these had been present in Free42 long before I started adding all that new core functionality in 2019 (and still continuing, although now it's all happening in Plus42), starting with SST→ and SST↑ in 2.1 and LSTO in 2.2.

SST→ SST↑ A2LINE A2+LINE X2LINE aren't programmable so the code editor doesn't need to handle them; in fact it couldn't handle them anyway, since they don't even have raw opcodes.

It might make sense to support the Plus42 functions, just so they are recognized; they are ΣN ΣX ΣX2 ΣY ΣY2 ΣXY ΣLNX ΣLNX2 ΣLNY ΣLNY2 ΣLNXLNY ΣXLNY ΣYLNX PARSE UNPARSE EVAL EQN? STD COMP GTOL XEQL GSTO GRCL SVAR GETITEM = ≠ < ≤ > ≥ && || ^^ ! IF? TRUNC DDAYSC GETEQN →PAR FDEPTH PUTITEM EVALN EQNSLV EQNINT EQNVAR EQNMENU EQNMNU1 SPPV SPFV USPV USFV N I%YR PV PMT FV RAISE CONVERT UBASE UVAL UFACT →UNIT UNIT→ N+U UNIT?
User avatar
pica
Posts: 70
Joined: Fri Mar 30, 2018 11:36 am
Location: Eswatini

Re: Big stack and program decoder.

Post by pica »

Thanks for the exhaustive reply.
Clearly Free42 is currently the best way to encode/decode for the DM42, if any of the new functionality is being used.
Plus 42 looks exiting. I will be downloading and building it soon.
HP50G HP35s Free42 DM42.
Testing WP43S, C43.
User avatar
pica
Posts: 70
Joined: Fri Mar 30, 2018 11:36 am
Location: Eswatini

Re: Big stack and program decoder.

Post by pica »

One nice thing about the online decoder, is that if I export all my programs as a single .raw file, I can load it into the online decoder, and get a listing of my entire program memory. I can then move around blocks of code for individual programs so that they appear in a specific order later when I press XEQ or other key that brings up the list of programs.

I wonder if there is any way of persuading free42 to print out the entire program memory as a single text file? Pressing PRP 40 times is a bit tedious and prone to error.
HP50G HP35s Free42 DM42.
Testing WP43S, C43.
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Big stack and program decoder.

Post by Thomas Okken »

pica wrote:
Tue Dec 21, 2021 11:31 am
I wonder if there is any way of persuading free42 to print out the entire program memory as a single text file? Pressing PRP 40 times is a bit tedious and prone to error.
Hmmm... no. I always use Copy when I want a program listing... but, like PRP, that only works on one program at a time, and is not programmable.
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Big stack and program decoder.

Post by Thomas Okken »

I actually offered SM, some time ago, to help with adding support for the new functions to the online encoder/decoder, since I had added a lot of new functions and was planning to add a lot more. They never took me up on that, but if they're interested, I could still do it. I could host a copy on my own web site as well, assuming it doesn't have any fancy requirements beyond whatever PHP my web host provides.
User avatar
pica
Posts: 70
Joined: Fri Mar 30, 2018 11:36 am
Location: Eswatini

Re: Big stack and program decoder.

Post by pica »

I would use it only occasionally, when I have the time and inclination to to reorder the whole program memory to optimise the XEQ button.
I am not even sure how useful that is, since I would have to go through the process again each time I add a new program. I am not sure what other purpose it would have. For the most part, it is reassuring that I can get reliable program listings for individual programs through free42 for record keeping purposes. I wonder what other users might think. When it comes to actual programming, I prefer to work on the calculator itself, as typing commands into a text editor opens up a huge area of errors due to typos.
HP50G HP35s Free42 DM42.
Testing WP43S, C43.
Post Reply