Well, having never used the Floating Point routines before ... you still knew the value went in AARG instead of Aint ... that's worth something.
I guess it's easier when you know how it works.
A floating point value consists of 4 bytes (32-bits).
The highest byte is the exponent.
Looking at the list of variables in FP1832L.bas, the only way to put 4 bytes in a row with the exponent lining up with AEXP is to start at AARGB2 ($1d).
Code:
aint var long $1c ' Long access to AARG
AARGB3 var aint.byte0 ' $1c
AARGB2 var aint.byte1 ' $1d
AARGB1 var aint.byte2 ' $1e
AARGB0 var aint.byte3 ' $1f
AEXP var byte $20
Microchip saves RAM space by using the same memory for Floats and Integers.
But when you have an integer value, the LONG variable uses AARGB3-AARGB0 (aint).
I believe the routines were intended to be used by starting with integers, converting to floats, and doing the math from there.
They were never intended to accept previously encoded floating-point values, whether IEEE or Microchip format.
Hence that ability is not documented.
Undocumented features are way more fun than the documented ones.
Bookmarks