As such, I thought I would take a stab at trying to code up a function to do exactly that.
It's got a few flaws so I'm still trying to work out how to work around them. I used ABS to force the base number into the LSTx register for the loop. This means it only works for positive base numbers.
Happy to hear any suggestions - just note I'm new to this and I'm still learning what's possible with the DM16. I'm half expecting that there is something obvious I missed with this attempt.
Code: Select all
Command Program Code [g][LBL] E 001 - 43,22, E Example program start 5^4 = 5 [Enter] 4 [GSB] E [DEC] 002 - 24 Ensure in DEC mode 1 003 - 1 [-] 004 - 30 Subtract 1 from Exponent (used in loop) [f][I] 005 - 44 32 Store modified Exponent into I Register [R Dwn] 006 - 33 Roll base number to X Register [g][ABS] 007 - 43 8 Force base number into Lstx Register [g][LBL] 0 008 - 43,22, 0 Loop '0' start [g][LSTx] 009 - 43 36 [X] 010 - 20 Multiply result by Base number [g][DSZ] 011 - 43 23 Decrement the I register and [GTO] 0 012 - 22 0 Repeat until I register = 0 [g][RTN] 013 - 43 21