|54h||MT$FBEX||convert floating point to string|
|Input||A register - field width of output string.
B register - decimal places required.
X register - address of output buffer.
|Output||B register - length of the output string.|
Converts floating-point accumulator to numeric ascii text, in exponential (scientific) format. This is in the form n.nnnnnE+nn, a decimal mantissa with one digit before the decimal point followed by the exponent. The exponent is always expressed as a + or - sign followed by 2 numeric digits.
Returns the output string (not zero-terminated) at the address given by X on entry, with the length of the string in B. X should be preserved before calling, as there is no pointer to the output string on exit.
|Example|| The following code will convert the
value in the accumulator to an exponential format string with 4 decimal
places in a field width of 16:
LDX #STRING_BUF LDD #16*256 + 4 ;field width in A, dec. places in B OS MT$FBEX STRING_BUF: DS 16If the accumulator contained e.g. 172.65, STRING_BUF will now contain the string "1.7267E+02" and the B register will contain 10. Further examples of the output strings corresponding to various floating-point values follow:
Accumulator Width Dec. Places Output String 0 10 4 0.0000E+00 640 16 4 6.4000E+02 112233445566 30 16 1.1223344556600000E+11 112233445566 20 16 Error (Width too small) 0.000071 10 0 7E-05 0.000076 10 0 8E-05 0.99999 10 3 1.000E+00
|Errors||250 - output string too long for field width or greater than maximum work buffer length of 34 (NUM to STR Error)|