Post Reply 
MCODE Mantissa Digit Reversal
05-08-2021, 05:33 PM (This post was last modified: 05-11-2021 03:45 PM by Ángel Martin.)
Post: #1
MCODE Mantissa Digit Reversal
Here's a sweet & short Digit Reversal utility that will soon be added to the SandMath. Nothing really fancy here but way easier than an equivalent FOCAL routine - write your own if you don't believe me.

096    "V"    
005    "E"    Mantissa Reversal
012    "R"    
00D    "M"    Ángel Martin
0F8    READ 3(X)    
10E    A=C ALL    safekeep C.MS and C.X
2DC    PT= 13     counter
250    LD@PT- 9     will do 10 times
01C    PT= 3     fixed position
3FA    LSHFA M      scroll A.M left
102    A=C @PT    copy digit
3DA    RSFHC M      next C.M digit
27E    C=C-1 MS    decrease counter
3E3    JNC -04     no, do next
0AE    A<>C ALL     yes copy result to C.M
0E8    WRIT 3(X)    write back to X
3E0    RTN    done.

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

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