Post Reply 
(16C) show which bits are set in a number
03-04-2019, 02:15 AM
Post: #2
RE: (16C) show which bits are set in a number
(03-04-2019 12:57 AM)cdmackay Wrote:  I just wrote my first (!) RPN program.

Welcome to the club!

Quote:I'm not concerned about performance, but I would like minimise the precious resources used, e.g. registers/lines/labels.

I have just removed the use of registers (besides register I):
Code:
001-43,22, A :   ▸LBL A
002-    43 7 :    #B
003-   44 32 :    STO I
004-   43 36 :    LSTx
005-       0 :    0
006-43,22, 0 :   ▸LBL 0
007-    42 6 :    B?
008-    22 2 :    GTO 2
009-   43 36 :    LSTx
010-43,22, 1 :   ▸LBL 1
011-       1 :    1
012-      40 :    +
013-    22 0 :    GTO 0
014-43,22, 2 :   ▸LBL 2
015-   43 36 :    LSTx
016-   43 34 :    PSE
017-   43 23 :    DSZ
018-    22 1 :    GTO 1
019       33 :    R↓
020-   43 21 :    RTN

Example:

23 d
GSB A

»0 d«
»1 d«
»2 d«
»4 d«
23 d

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (16C) show which bits are set in a number - Thomas Klemm - 03-04-2019 02:15 AM



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