Post Reply 
FC?C and FS?C usefulness
11-16-2021, 10:14 PM
Post: #1
FC?C and FS?C usefulness
A couple questions for the gurus:

1) what's the usefulness of the FC?C and FS?C apart from their obvious meaning? Is there some neat trick they can be used to accomplish?
2) why aren't there their counterparts FC?S and FS?S ?
Find all posts by this user
Quote this message in a reply
11-16-2021, 10:37 PM
Post: #2
RE: FC?C and FS?C usefulness
These instructions let you test a flag and then clear it. The alternative would be code like:

Code:
FS? 0
GTO 00
CF 0
...
LBL 00
CF 0
...

I.e. they save steps and simplify understanding the logic.


The WP 34S introduced the extra flavours and more.


Pauli
Find all posts by this user
Quote this message in a reply
11-16-2021, 10:49 PM
Post: #3
RE: FC?C and FS?C usefulness
Thanks Pauli, I didn't realize that the instructions originate from RPN so I haven't specified that I was referring to RPL language.

I can see why they're useful in RPN context but their utility in RPL escapes me, since at user level the conditionals don't follow the skip-if-true logic.

And then, why no FC?S and FS?S ? It's evident that whoever proposed these commands gave greater importance to flags being cleared than set... probably the reason is obvious to those versed in RPN, but I'm not one of the lot!
Find all posts by this user
Quote this message in a reply
11-16-2021, 10:54 PM
Post: #4
RE: FC?C and FS?C usefulness
(11-16-2021 10:49 PM)JoJo1973 Wrote:  Thanks Pauli, I didn't realize that the instructions originate from RPN so I haven't specified that I was referring to RPL language.

I can see why they're useful in RPN context but their utility in RPL escapes me, since at user level the conditionals don't follow the skip-if-true logic.

And then, why no FC?S and FS?S ? It's evident that whoever proposed these commands gave greater importance to flags being cleared than set... probably the reason is obvious to those versed in RPN, but I'm not one of the lot!

Hmmm, now that I think about it maybe they're useful if you're testing an exception flag...
Find all posts by this user
Quote this message in a reply
11-17-2021, 02:51 AM (This post was last modified: 11-17-2021 03:03 AM by Sylvain Cote.)
Post: #5
RE: FC?C and FS?C usefulness
(11-16-2021 10:14 PM)JoJo1973 Wrote:  1) what's the usefulness of the FC?C and FS?C apart from their obvious meaning?
... Is there some neat trick they can be used to accomplish?
These are great for error handling.

FOCAL example:
Code:
...
SF 25     // set "Ignore Error" flag
/         // do something that can produce an error, here a division by zero
FS?C 25   // did we had an error ? ... and reset "Ignore Error" flag for next operations
GTO 01    // no error, branch to the success code
...       // handle error
LBL 01    // success code
...

(11-16-2021 10:14 PM)JoJo1973 Wrote:  2) why aren't there their counterparts FC?S and FS?S ?
There was no more space left in the ROMs or in the functions tables I would assume.

Edit: Doh! I should have know better, they had 256 entries in the functions table.
Half of them are 1 byte functions and the rest are 2 and 3 bytes functions, labels and text.
So they had to make a choice about what functions to keep and what functions to leave out.
Most of the missing test functions can be simulated with the others.

SYNTHETIX Card: SIDE #1 & SIDE #2

Missing from FOCAL:
Code:
X>=0?
Simulated with
Code:
X<0?
X=0?
Example: flag 00 is set if test is successfull and clear if test fail
Code:
LBL "X>=0?"
CF 00
X<0?
X=0?
SF 00
RTN

Sylvain
Find all posts by this user
Quote this message in a reply
11-17-2021, 07:48 AM
Post: #6
RE: FC?C and FS?C usefulness
Imagine you want to toggle a flag.
Without these functions, that would look like

Code:
FS? 00
GTO 00
SF 00
GTO 01
LBL 00
CF 00
LBL 01

instead of simply

Code:
FC?C 00
SF 00

I never missed the FC?S and FS?S counterparts - you just switch the flag meaning and you can use FC?C and FS?C..

(11-16-2021 10:37 PM)Paul Dale Wrote:  
Code:
FS? 0
GTO 00
CF 0
...
LBL 00
CF 0
...

The first CF 0 is not needed ;-)

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)