HP Forums
MCODE Mantissa Digit Reversal - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP-41C Software Library (/forum-11.html)
+--- Thread: MCODE Mantissa Digit Reversal (/thread-16899.html)

MCODE Mantissa Digit Reversal - Ángel Martin - 05-08-2021 05:33 PM

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.