[WP34s] Decoding STOM


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?



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


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 ...
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


Instead of the 0 SB 22 SB 23:

        MASKR 02
SL 22

is one step shorter.



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
AND ' clear all except the two display mode bits
DECM ' result is 0 for ALL, 1 for FIX, 2 for SCI, 3 for ENG

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.



Hallo Walter,

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.


Possibly Related Threads...
Thread Author Replies Views Last Post
  [WP34S] WP34S firmware on the AT91SAM7L-STK dev kit? jerome ibanes 1 398 10-04-2012, 04:59 PM
Last Post: Paul Dale
  [wp34s] Incomplete Gamma on the wp34s Les Wright 18 1,503 12-06-2011, 11:07 AM
Last Post: Namir
  [wp34s] Romberg Integration on the wp34s Les Wright 2 499 12-04-2011, 10:49 PM
Last Post: Les Wright
  Decoding new serial numbers Jose Goncalves 7 780 05-19-2003, 10:05 PM
Last Post: jose goncalves
  Decoding newer serial numbers Holger Weihe 3 428 02-07-2003, 02:54 PM
Last Post: Frank B. (Germany)
  Decoding Serial Numbers J. Lopez (New York) 3 418 12-11-2001, 08:32 PM
Last Post: Ian Primus

Forum Jump: