HP Forums

Full Version: MCODE Mantissa Digit Reversal
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.

Reference URL's