AND/OR/XOR on non16C calcs

03162019, 06:06 PM
Post: #1




AND/OR/XOR on non16C calcs
Hi all.
Is there a way to program conditionals (and perhaps flag tests) that simulate and, or, and xor tests? Thanks 

03162019, 07:17 PM
(This post was last modified: 03162019 07:21 PM by Dieter.)
Post: #2




RE: AND/OR/XOR on non16C calcs
(03162019 06:06 PM)Matt Agajanian Wrote: Is there a way to program conditionals (and perhaps flag tests) that simulate and, or, and xor tests? I am not sure if I understand what you are trying to do. An "OR"test can be done on classic RPN calculators by having the inverse of the first condition followed by the second one. Examples: is flag 1 or flag 2 set? FC? 01 FS? 02 is x=0 or x>0? X≠0? X>0? But since you mention the 16C: how can you do this there? A bitwise OR is not a logical OR. Dieter 

03162019, 09:38 PM
Post: #3




RE: AND/OR/XOR on non16C calcs
(03162019 07:17 PM)Dieter Wrote:(03162019 06:06 PM)Matt Agajanian Wrote: Is there a way to program conditionals (and perhaps flag tests) that simulate and, or, and xor tests? Hi Dieter (and all), I mention the 16C as a reference point/example of Or/Xor/And as test types regardless of programmable. Okay. thanks for the Or tests. How do I structure an AND test? 

03162019, 10:27 PM
Post: #4




RE: AND/OR/XOR on non16C calcs  
03172019, 12:08 AM
Post: #5




RE: AND/OR/XOR on non16C calcs
Thanks Dieter & gsbanks. These help me incorporate the some new conditionals to my programming library.
If other users have tricks & tips, I’d like to see what other variations I could add to my library. 

03172019, 03:18 AM
Post: #6




RE: AND/OR/XOR on non16C calcs
If you want bitwise operations, the HP41 Advantage module has AND, OR, XOR, NOT, BIT?, ROTXY (rotate the number in Y to the right by the number of bits specified in X, and rotating right (32x) bits is equivalent to rotating left x bits).
Håkan Thörngren's 'Ladybug' module gives the 41 a new customizable binary integer mode, with most HP16C capabilities, and stack items up to 64bit (the last 8 bits being kept in a buffer). It does arithmetic, bitwise, and logical operations in bases 2, 8, 10, and 16. (Everything is in the .zip file at http://hpmuseum.org/forum/thread7545.html .) http://WilsonMinesCo.com (Lots of HP41 links at the bottom of the links page, http://wilsonminesco.com/links.html ) 

03172019, 09:16 AM
Post: #7




RE: AND/OR/XOR on non16C calcs
(03162019 10:27 PM)grsbanks Wrote: NOT(A AND B) = NOT(A) OR NOT(B) You may add an alwaysfalse test to get the usual "do if true" rule: FS? 01 FC? 02 FS? 54 DO IF BOTH SET Or, if you know that x cannot be negative at this point: FS? 01 FC? 02 X<0? DO IF BOTH SET Dieter 

03172019, 03:35 PM
Post: #8




RE: AND/OR/XOR on non16C calcs
Thanks for sharing more ‘tricks up your sleeve!’
They’ll come in handy. 

03172019, 04:57 PM
(This post was last modified: 03172019 04:58 PM by Dieter.)
Post: #9




RE: AND/OR/XOR on non16C calcs
(03172019 03:35 PM)Matt Agajanian Wrote: Thanks for sharing more ‘tricks up your sleeve!’ If you like this kind of stuff youshould take a look at HP Key Notes V1N3 (Octobher 1977) where this and similar topics are discussed. Please note that this article refers to the HP67/97 where testing flag 2 or flag 3 clears this flag, i.e. it works like a FS?C 2 and FS?C 3. Dieter 

03172019, 05:52 PM
Post: #10




RE: AND/OR/XOR on non16C calcs
Thanks again. Those HP Notes issues are absolutely essential!


03172019, 11:13 PM
Post: #11




RE: AND/OR/XOR on non16C calcs
(03172019 05:52 PM)Matt Agajanian Wrote: Thanks again. Those HP Notes issues are absolutely essential! For bazillions of very short, highlyefficient RPN miniroutines (including a few by me) that do all kinds of things like those you're asking for in this thread, one essential source would be the book "Calculator Tips and Routines" by John Dearing. I do own a copy and though it's several decades old I still use it frequently to this very day. Highly recommended. V. . 

03182019, 12:19 AM
Post: #12




RE: AND/OR/XOR on non16C calcs
I’ll look for it at ABE Books and of course Amazon. Thanks for the tip.


03182019, 01:58 AM
Post: #13




RE: AND/OR/XOR on non16C calcs
(03182019 12:19 AM)Matt Agajanian Wrote: I’ll look for it at ABE Books and of course Amazon. Thanks for the tip. Matt  This book is available at TOS, in PDF. Of course a real copy is always preferred, but at least this version can be used until you can locate an original copy. And I agree with Valentin  this book contains a LOT of useful small RPN tips, for all kinds of uses. Many times in the distant past I had concluded I had read it fully and no need to look again, but when eventually going back, found things I did not recall were there. The kind of book that each time you pick it up, you discover new things. You will enjoy it. Bob Prosperi 

03192019, 12:50 PM
Post: #14




RE: AND/OR/XOR on non16C calcs
There is an auction on eBay now for an HP41C with some accessories, including what appears to be a nice copy of the "Calculator Tips and Routines" book here.
I am not suggesting that a copy of this is book is worth $120.00 for everyone, however based on your collecting preferences and priorities, it is possible it may be worth it to someone, and that person would also get an HP41C & accessories for free. The 41C appears to be working, with tall keys, gold balls, s/n 2026A.... so it's actually not a bad deal at all, again depending on your needs. Might make a nice 41CL host. Just an FYI, I've no connection with the seller. Bob Prosperi 

03202019, 01:51 AM
Post: #15




RE: AND/OR/XOR on non16C calcs
Amazingly, here is another copy of the book:
https://www.ebay.com/itm/HP41Calculator...4170467331 And this time much cheaper, but no free 41C included. Bob Prosperi 

Today, 03:20 PM
Post: #16




RE: AND/OR/XOR on non16C calcs
"Calculator Tips and Routines" is also available on TOS and the HHC 2017 thumb drive.


« Next Oldest  Next Newest »

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