Hi,
I wrote a little program, which "(re-)sets" my DM42 into a known state...just like the state file but without interferring
with the current programs.
This program has a lot of SF and CF commands and a bunch of mode settings and was written as one of the first programs.
With the new A2LIN and X2LIN functions of the new 3.19 firmware (Hallo Thomas! ein herzliches DANKE dafuer! ) it will
be possible to shorten this program by quite a amount of lines by using RCLFL and STOFL in compbination with X2LIN to
set all flags in one go.
Q: Are all mode settings reflected by flags? Or do I need to set certain modes "manually" in the program nonetheless?
Cheers!
mcc
PS:"(Hallo Thomas! ein herzliches DANKE dafuer! )" is german for
"(Hello Thomas! Cordial thanks for that! )"
modes and flags
modes and flags
DM 42 - SN: 00373, Firmware release v.:3.22. / DMCP 3.24. as compiled by SwissMicros
Re: modes and flags
I just tried in the Free42 Android app 3.03 to do:
RCLFLAG
X2LINE
and then execute the three program lines created by X2LINE.
It works well when in RECT mode: the complex number created by the program is identical to the one from RCLFLAG, however in POLAR mode it's different, so you may not restore the flags to their original value if you work in polar mode.
In Y the RCLFLAG value, in X the value generated by the program lines from X2LINE:
RCLFLAG
X2LINE
and then execute the three program lines created by X2LINE.
It works well when in RECT mode: the complex number created by the program is identical to the one from RCLFLAG, however in POLAR mode it's different, so you may not restore the flags to their original value if you work in polar mode.
In Y the RCLFLAG value, in X the value generated by the program lines from X2LINE:
Code: Select all
00 { 27-Byte Prgm }
01 10515703136256
02 360842304
03 COMPLEX
04 END
DM42: 00425 - DM41X: β00066 - WP43: 00042
-
- Posts: 1100
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: modes and flags
Hmm, yes, instead of reassembling the flags using COMPLEX, it should be using something that always treats X and Y as rectangular. It shouldn't depend on the mode the calculator is in when the generated code is executed.
I guess this will require a new instruction!
Or change COMPLEX to 1 0 COMPLEX +/- SQRT × +
Ugly...
Or insert RECT before COMPLEX and let STOFLAG restore POLAR mode... But that won't work if you're using a range with STOFLAG that doesn't include flag 73... Or in the more general case of using X2LINE with a complex number that isn't just meant to be passed to STOFLAG.
Last edited by Thomas Okken on Fri May 14, 2021 3:51 pm, edited 2 times in total.
-
- Posts: 1100
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: modes and flags
Not all mode settings. WSIZE is not encoded in the flags, for one. Check the flags list in the manual to make sure, or just try it!
Also, flags that are pure status indicators are not restored by STOFLAG (obviously!), but neither are those that affect the menu system or INPUT mode. Specifically:
27 CUSTOM menu
44 Continuous ON
45 Solving
46 Integrating
47 VARMENU
48 ALPHA
49 Low battery
53 INPUT
65 Matrix editor
75 Programmable menu
Re: modes and flags
Hi Thomas,
thank you for the info!
The only thing wanted to prevent was comparing flags and modes (which is a bit tideous and possible error prone) only
to come to the result, that every thing is in sync with no exception like WSIZE as you pointe out for example.
Since I now know that there are exceptions I will go to find them...
Cheers!
mcc
thank you for the info!
The only thing wanted to prevent was comparing flags and modes (which is a bit tideous and possible error prone) only
to come to the result, that every thing is in sync with no exception like WSIZE as you pointe out for example.
Since I now know that there are exceptions I will go to find them...
Cheers!
mcc
DM 42 - SN: 00373, Firmware release v.:3.22. / DMCP 3.24. as compiled by SwissMicros
-
- Posts: 1100
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: modes and flags
It'll be two new instructions: RCOMPLX and PCOMPLX. RCOMPLX acts like COMPLEX in RECT mode, and PCOMPLX acts like COMPLEX in POLAR mode, regardless of the actual RECT/POLAR mode setting. And, of course, X2LINE will use RCOMPLX instead of COMPLEX.Thomas Okken wrote: ↑Fri May 14, 2021 1:17 pmHmm, yes, instead of reassembling the flags using COMPLEX, it should be using something that always treats X and Y as rectangular. It shouldn't depend on the mode the calculator is in when the generated code is executed.
I guess this will require a new instruction!
These will be in 3.0.4.