56h MT$FBIN convert floating point to string
Input A register - field width of output string.
X register - address of output buffer.
Output B register - length of the output string.

Converts floating-point accumulator to numeric ascii text, in integer format. The value in the B register is irrelevant in this routine, as there are no decimal places involved. If the value in the floating-point accumulator is not an integer, then the string output is the accumulator value rounded to the nearest integer.

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.

Other floating point to string conversion utilities: MT$FBDC, MT$FBEX and MT$FBGN.

See also: technical manual > utility system services > floating point numbers

Example The following code will convert the value in the accumulator to an integer format string in a field width of 16:
        LDX     #STRING_BUF
        LDAA    #16             ;field width in A
        OS      MT$FBIN

        DS      16
If the accumulator contained e.g. 172.65, STRING_BUF will now contain the string "173" and the B register will contain 3. Further examples of the output strings corresponding to various floating-point values follow:
    Accumulator  Width           Output String
    -10102         10             -10102
    500             3             500
    -500            3             Error
    6666.7         10             6667
    0              10             0
    0.0002          5             0
Errors 250 - output string too long for field width or greater than maximum work buffer length of 34 (NUM to STR Error)