/*======================================================================*
| Planet Fastest Unsigned PICmicro Math |
| (c) 1999 Jose Luiz Pinto Souto |
| souto (at ) cryogen.com |
| |
...
| |
| Compiled with CC5X, see also CC5xfree, a free 1K limited |
| C compiler from B. Knudsen Data - http://bknd.com/. |
| |
| For algorithm details see Microchip's application note AN617. |
| PICmicro is registered Trademark of Microchip Technology Inc. |
| Alpha version - please report any bug to e-mail above. |
| If any faster algorithm is found, please report. |
*======================================================================*/
Notes for assembly language programmers:
-
You can copy the "assembly language output" and paste into your own programs, as long as you also copy and paste the copyright.
-
None of these library routines use "call" -- so calling any of them uses only 1 stack cell.
-
Most routines use the A and B series of registers as inputs, the R series of registers as outputs (or the "remainder" from division). Those routines don't touch FSR or INDF.
-
Some routines expect you to set FSR to point to data outputs and/or inputs.
They expect [FSR] == INDF to be the least-significant byte of the data, [1+FSR] to be a more-significant byte ... up to [3+FSR] as the most-significant byte of a 32 bit number.
-
Gotcha: You know those routines that use FSR to point to data inputs and/or outputs? Gotcha: Those routines mangle FSR in a data-dependent way.
Work-around:
If you need that value of FSR, save it somewhere else before calling these routines.
Assume that these routines trash FSR (and W, and ww, and ix, etc. ).
The next time you need to use FSR
(perhaps when calling one of these routines),
re-load it with a known good value.
See also:
Comments: