(15c)(35s)(some other RPN) Flags toggle / inverting
|
04-26-2018, 06:21 PM
(This post was last modified: 04-26-2018 06:27 PM by Dieter.)
Post: #4
|
|||
|
|||
RE: (15c)(35s)(some other RPN) Flags toggle / inverting
(04-26-2018 03:20 PM)pinkman Wrote: I've been subject to terrible headaches while searching for the best method to toggle a flag, ie to invert it. This is not related to RPN. Only to the available command set of the particular calculator. For instance, some calculators have flag tests that clear the flag (after the test has been done). These are usually labelled FS?C (flag set? clear afterwards). Others also feature a FC?C (flag clear? clear afterwards). And there even are cases with a dedicated flip command. Examples: 1. RPN-calculator WP34s FF 01 Doesn't get shorter than this: a dedicated "flip flag" command. 2. RPN-calculator HP-41C/CV/CX FC?C 01 SF 01 Two lines, short and effective. 3. RPN-calculators HP67 and 97: F? 2 F? 2 SF 2 On the 67/97 the tests for flag 2 and 3 also clear the flag afterwards. The sequence above toggles flag 2. On the other hand every following test of this flag also clears it... #-) But this can be another method for the HP41: FS?C nn FS? nn SF nn Yes, the second test can be a simple FS?. But, as already noted, there is an even shorter method (cf. 2.). (04-26-2018 03:20 PM)pinkman Wrote: Method 2: sacrifice the stack There is one more pro: You get a visual feedback of the flag status. Imagine a short routine that toggles a mode setting: print on/off, TVM begin/end mode, etc. Here it's even just four steps since the 0 or 1 remains in X and the final Rv is omitted. (04-26-2018 03:20 PM)pinkman Wrote: Method 3: sacrifice a register (and the stack) Only 5 steps: Code: 1 Or on the 15C even just 3 steps, and with one stack level less: Code: 1 (04-26-2018 03:20 PM)pinkman Wrote: What do you think? You bet. ;-) Dieter |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(15c)(35s)(some other RPN) Flags toggle / inverting - pinkman - 04-26-2018, 03:20 PM
RE: (15c)(35s)(some other RPN) Flags toggle / inverting - SlideRule - 04-26-2018, 04:02 PM
RE: (15c)(35s)(some other RPN) Flags toggle / inverting - Dieter - 04-26-2018, 05:46 PM
RE: (15c)(35s)(some other RPN) Flags toggle / inverting - Dieter - 04-26-2018 06:21 PM
RE: (15c)(35s)(some other RPN) Flags toggle / inverting - pinkman - 04-26-2018, 09:11 PM
|
User(s) browsing this thread: 1 Guest(s)