Jeremy Leach
Senior Member
Here's a routine following a recent thread about how to display the result of multiplying two Words, when there is overflow.
This is just one method and isn't the fastest method, but is possibly the easiest to understand. It converts the input Words (Operands) into their decimal digits, then does what I call a 'long-hand' multiplication, as if you were multiplying on paper.
The only thing it does differently is that it adds the partial results to the result value as it goes along. This is just to make it more efficient, using less code and less RAM.
I've attached a table explaining the memory map,with a dummy example of Operand digits and result ,and attached the code.
It seems to work, although I haven't extensively tested.
This is just one method and isn't the fastest method, but is possibly the easiest to understand. It converts the input Words (Operands) into their decimal digits, then does what I call a 'long-hand' multiplication, as if you were multiplying on paper.
The only thing it does differently is that it adds the partial results to the result value as it goes along. This is just to make it more efficient, using less code and less RAM.
I've attached a table explaining the memory map,with a dummy example of Operand digits and result ,and attached the code.
It seems to work, although I haven't extensively tested.
Attachments
-
27.2 KB Views: 120
-
2.8 KB Views: 145