Hi Peter,
Sure, you can do it.
First off, you'll need to lose one of zero's from that 1,250,000,000
If you start off with 125,000,000 it brings it down to a managable range.
125,000,000 / 32000 = 3906.2
125,000,000 / 6200 = 20161.2
Then you have most of the number from the integer portion, and the last digit is in the remainder, in the form of a Modulas. By dividing the (Modulas*10) by the original divisor, you can recover the last digit.Result = 201612Code:<font color="#000000"><b>Temp </b><font color="#008000"><b>VAR WORD</b></font> <b>Divisor </b><font color="#008000"><b>VAR WORD </b></font><b>Remainder </b><font color="#008000"><b>VAR WORD </b></font><font color="#0000FF"><b><i>;----[Load a 32-bit constant into PBP registers, Prior to DIV32]-------- </i></b></font><font color="#008000"><b>ASM </b></font><font color="#000080">PutMulResult macro Const32 MOVE?CB low Const32, R2 MOVE?CB low (Const32 >> 8), R2 + 1 MOVE?CB low (Const32 >> 16), R0 MOVE?CB low (Const32 >> 24), R0 + 1 endm </font><font color="#008000"><b>ENDASM </b></font><b>Divisor </b>= <b>6200 </b><font color="#000080">@ PutMulResult 125000000 </font><b>Temp </b>= <font color="#008000"><b>DIV32 </b></font><b>Divisor Remainder </b>= <b>R2 </b>* <b>10 Remainder </b>= <font color="#008000"><b>DIV32 </b></font><b>Divisor </b><font color="#008000"><b>LCDOUT </b></font><font color="#FF0000">"Result="</font>,<font color="#008000"><b>DEC </b></font><b>Temp</b>,<font color="#008000"><b>DEC1 </b></font><b>Remainder</b>
HTH,
Darrel




Bookmarks