HP Forums
[WP34s] Decoding STOM - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: [WP34s] Decoding STOM (/thread-253328.html)



[WP34s] Decoding STOM - Dieter - 10-20-2013

Although the 34s allows the user to obtain the current state of many mode settings (e.g. "RM?" or "REGS?") it does not seem to provide a direct way to get the current display setting, i.e. ALL, FIX, SCI or ENG and the number of digits. However, this information can be decoded from the value returned by STOM (which BTW recalls rather than STOres the current Mode setting).

Now I wonder what might be the best way to retrieve and decode certain bits from the 64-bit-block returned by STOM. For instance bits 22 and 23 that reflect the display setting, or bits 24..27 that contain the number of digits (c.f. WP34s manual, Appenix H).

Let's assume STOM X has returned a somewhat odd-looking value in X. What's the next step now to extract certain bits?

Dieter


Re: [WP34s] Decoding STOM - Paul Dale - 10-20-2013

The value used by STOM/RCLM was intended to be opaque -- for saving and restoring the entire state only. We didn't intend for users to modify the state -- there are bit combinations that the calculator cannot normally reach and we've no idea what they'll do & don't have program space to validate everything. I was all for not documenting what the various bits even did -- Walter won out here.

Doing the masking and decoding in integer mode is the best way. The floating point representation is quite convoluted and it might not even be possible to isolate all the bits independently (I'm pretty sure it isn't). The STOM X needs to be done in integer mode too, otherwise stack conversion will cause problems -- this isn't an issue if you use a non-stack register.

Think of it as STOM storing the state information into a register, rather than recalling the state data.


- Pauli


Re: [WP34s] Decoding STOM - Walter B - 10-20-2013

Hallo Dieter,

The names STOM and RCLM may be interpreted arbitrarily in a way - you may find good reasons for either way. The present meaning is as Pauli told - just look for RCLM in the manual.

And the table in App. H is just meant to help you in decoding what you get by RCLM. Ich wollte den "User" einfach nicht im Regen stehen lassen mit völlig Unverständlichem - schließlich ist eine Bedienungsanleitung dazu da, die Dinge zu erklären.

d:-)


Re: [WP34s] Decoding STOM - Dieter - 10-21-2013

OK. However, in some cases there is no other way to obtain certain status information, for instance the display setting. Reminds me of the good old '41 and decoding its system flag settings. ;-) These flags were documented in the manual, just as the structure of the 34s 64-bit mode value returned by STOM. This may be left undocumented, but then all encoded information should be made available by dedicated commands. Most of it already is.

With the provided information I now managed to retrieve the display mode this way:

  BASE 16 ' or BASE 02, or ...
0
SB 22
SB 23 ' setup a bit mask with the two display mode bits
STOM Y ' store mode in Y
AND ' clear all except the two display mode bits
SR 22 ' move the result to the two LSBs
DECM ' result is 0 for ALL, 1 for FIX, 2 for SCI, 3 for ENG
Dieter


Re: [WP34s] Decoding STOM - Paul Dale - 10-21-2013

Instead of the 0 SB 22 SB 23:

        MASKR 02
SL 22

is one step shorter.


Pauli


Re: [WP34s] Decoding STOM - Didier Lachieze - 10-22-2013

Saving an additional step:

  BASE 16 ' or BASE 02, or ...
STOM X ' store mode in X
SR 22 ' move the display mode bits to the two LSBs
MASKR 02
AND ' clear all except the two display mode bits
DECM ' result is 0 for ALL, 1 for FIX, 2 for SCI, 3 for ENG



Re: [WP34s] Decoding STOM - Dieter - 10-22-2013

Hallo Walter,

Quote:
And the table in App. H is just meant to help you in decoding what you get by RCLM

What you get by STOM. There you are. ;-)

But yes, I like the table. This way I could decode the current display mode.

Dieter