×   Main Menu ALL The 8BS News Manuals (New menu) Links Worth a Look Tools Disc and Basic Webring Site Map 8BS Guestbook Old Guest Book Me The Barnsley Rovers   
8-Bit Software

The BBC and Master Computer Public Domain Library

A118 NUMASC (Numeric value to ASCII String conversion)

Submitted by Steve Fewell

Routine:numasc
Name: NUMASC (Numeric value to ASCII String conversion)
Starting Address: &A118
Entry criteria: Either the IWA or the FWA contains the numeric value to convert into ASCII (for printing to the screen, etc...).
&15 is negative if the value should be converted to ASCII with a Hexadecimal representation of the value.
Y is negative if the value is a Floating-Point value (stored in the FWA), or positive
if the value is an Integer value (stored in the IWA).
Exit: The SWA contains the ASCII result.

Description:

A118 - A137: validate the format & number of digits to print
The format that the number will be converted to and the number of digits to print
is specified by variable @%. This variable consists of 4 bytes with the following meanings:
Byte 4: Conains a non-zero value if STR$ function should use @% Number conversion format (default value 0).

Byte 3: Contains one of the following:
0 - for General format (e.g. nnn.nnn), Byte 2 contains max digits printed
1 - for Exponential format (e.g. n.nnnnnEnn), Byte 2 contains number of digits printed
2 - for Fixed format (e.g. nnn.nnnnn), Byte 2 contains numberof digits after decimal point to print
The default value for byte 3 is 0 (general format).
Byte 2: Has the following meanings depending on Format type:
If General format, contains number of digits to print before Exponential format needs to be used.
If Exponential format, contains maximum number of significant digits to be printed after the decimal point.
If Fixed format, contains exact number of digits required to follow the decimal point.
The default value for byte 2 is 9 (print 9 decimals).
Byte 1: Print field width (0-255) (when using the PRINT statement with commas).
Only bytes 3 and 2 are used by the NUMASC routine. The default value for byte 1 is 10.

This routine sets &37 to a copy of byte 3 and &4D to a copy of byte 2.
If the Format is not between 0 to 2, then &37 (format) is set to 0.
If the Number of decimals is not between 0 to 10, then &4D (decimals) is set to 10.
If the Format is not 2 (Fixed) and the number of decimals is 0 then set &4D (decimals)
to 10.
If this routine is called from location &A132, then the @% format settings will not be used.

A138 - A154: Initialise & Convert numeric value to Float & handle 0.00 valuet
Sets &36 to zero (SWA length), as we are starting with a blank string.
Set &48 to zero (this is the Exponential value (the value printed after the 'E')).
If &15 is negative then convert the numeric value to an ASCII string in Hexadecimal notation (&A0CA).
If the numeric value is an Integer (Y is positive, most likely #&40, which means Integer) then
convert the Integer value to a Float (storing the result in the FWA). This is so that the routine
only needs to handle Floating-Point values (i.e. one format of storage).
Call routine &A3F2 to obtain the sign of the Floating-Point value.
If the sign is 0 then the value is 0.00, so if the format is 1 (exponential) or 2 (Fixed) then
jump to &A1D0 to print the value 0.00 in that format; Otherwise, set A to "0" and jump to &A2D0
to add a single 0 to the SWA, and exit.
If the value is not 0.00 then jump to &A102 to check the value.

A0CA - A101: Convert Numeric value to ASCII String in Hexadecimal notation
If the Numeric value is a Floating-Point value (Y is negative) then call &96C3 to convert the
Floating-Point value to Integer and put the result in the IWA.
This is because only the Integer portion of Hexadecimal values is converted.
Additionally, the Hexadecimal conversion for negative values is in two's complement format,
I.e. -4 in BASIC's Hexadecimal format ('~') is &FFFFFFFC.

Set X and Y to zero. Y is the current byte offset and X is the next free location for the Hex values.
Loop for each byte of the IWA value. For each byte do the following:
* Get the next byte of the Integer value (LSB first) and push this value to the stack.
* Clear the top half (top 4 bits of the value). This leaves the lower Hex digit of the 2-digit byte
   (4 bits per digit).
* Store the Hex digit (lower half of byte) in the next location (&3F-&46) and increment X.
* Pop the byte from the Stack. Divide this value by 8 (to get rid of the lower 4-bits
   of the value) and move the top 4-bits to the lower half of the byte.
* Store the Hex digit (top half of byte) in the next location (&3F-&46) and increment X.
* Increment Y (byte offset) to point to the next byte in the IWA.
* If the byte offset (Y) is less than 4 then loop again.
Now, locations &3F to &46 contain the 8 Hex digit values for the Integer value in the IWA.

Now, loop for each of the Hex dgits (starting at the last one, &46, which is the most significant digit).
For each digit, check if it is zero. If it is zero (and it isn't the first digit) then skip it,
as we do not want leading zeros in the ASCII string value.

When we have found the first non-zero digit, or the last digit (if all other digits are zero),
then we can begin to add the digits to the SWA (ASCII string value).
To add a digit, add #&30 to the value (plus an extra #&07 if the digit is 10-15 ['A'-'F']).
Now, we have the ASCII value for the Hex digit, so call routine &A2D0 to add the ASCII character
to the end of the existing SWA string value.
Next, decrement X and repeat the adding digit to SWA process for the other digits.
When X is negative then we have finished as the last digit added to the SWA value was the least
significant digit of the hexadecimal value.

Finally exit as we have finished the ASCNUM conversion.

A102 - A10A: Handle '-' for negative Floating-Point values
If the Floating-Point value is negative (the FWA sign routine returned with the negative flag set)
so add a leading '-' to the SWA (ASCII String) output value [via routine &A2D0].

A10B - A117: Multiply Floating-Point value until it is >= 1
Test the FWA exponent, if the exponent is more than or equal to #&81 then jump to &A15C to
check that the Floating-Point value is less than 1.
If the FWA exponent is less than #&81 then the FWA value is less than 1 so multiply the
numeric value by 10 [via routine &A436] and decrement &48 (the Exponent value).
Keep repeating this until the FWA exponent is >=&81 (i.e. we have a value with an Integer part
between 1 and 9.99999999 - this representation will aid the conversion to ASCII procedure).
When the value is within the required range then jump to &A15C.

A15C - A16E: Divide Floating-Point value until it is <= 9.9999999999
Test the FWA exponent, if the exponent is less then #&84 then jump to &A16F as
the FWA value is within the required range (less than 10).
If the FWA exponent is equal to #&84 then check the FWA Mantissa byte 1 (MSB) value.
If the FWA Mantissa byte 1 value is less ten &A0 then the FWA contains a value less
than 10, so jump to &A16F to continue the conversion procedure.
Otherwise the FWA value is >&eq;10, so divide the numeric value by 10 [via routine &A478]
and increment &48 (the Exponent value).
Jump back to &A10B to check the FWA value again.
Keep repeating this until the FWA contains a value between 1 and 9.99999999, and then
jump to &A16F to continue the conversion to ASCII procedure.

A16F - A1CF: Check that the value can be printed in the requested format
At this stage the Floating-Point value is between 1.0 and 9.99999999999, and &48 contains the
base 10 exponent value (so that the original value can be determined).

Temporarily store the FWA rounding byte (&35) into location &27 and store the FWA value
as a packed Floating-Point variable at location &046C-&0470.
The rounding byte needs to be stored separately as it is not included in the packed variable.

If the requested format is Fixed-Point then check the following:
* Add the number of digits required to follow the decimal point (&4D) to the exponent (&48).
* If the result is negative then the Floating-Point value is too small to fix to the number of decimal
   places suggested, so set the FWA to 0.00 & zero the exponent (&48) [by jumping to &A1D4].
* If the result is less than 11 then the value will fit in the display field (without the need to
   display the 'E' value (as in the exponential format)).
* Otherwise, if the result is more than 11 then the value's exponent is too large to display in Fixed-point
   format without including the exponent value as part of the output, so set the number of digits
   (&38) to 10 and set the format to 0 (general), so that the 'E' part of the value will be output.
[A190] Set the FWA to 5.0 and divide this value by 10 * The number of digits to output.
I.e. if the number of digits to output is 9 then set FWA to 0.000000005.
Unpack the temporary Floating-Point variable stored at &046C-&0470 (i.e. the numeric
value that we are outputting) to the FWB, and restore the
Rounding byte (that we temporarily stored to &27).
Add the FWB number to the FWA value. This will round up the last significant digit (that we are outputting)
if the entire numeric value cannot be outputted (to the required number of decimals) and the next
(non-outputted) digit is >&eq;5.

If the FWA exponent is less than #&84 then keep dividing the FWA mantissa by 2 and incrementing the FWA exponent
until the FWA exponent >&eq;#&84. This will make sure that the FWA value is >&eq;1 if the calculations
above caused the FWA value to drop below 1.0.
If the FWA exponent is more than #&A0 then the calculations above caused the FWA value to be rounded
to more than 10.0, so jump to &A157 to set the FWA value to 1.0 and increment the decimal exponent (&48)
by 1 to result in an actual FWA value of 10.0. This solves the problems caused by the rounding.

If the number of digits is 0 then [&A1D4] set the FWA value to 0.0 and the decimal exponent (&48) to 0,
as there are no digits required to be output.
Otherwise, jump to &A1DE to output the value to the requested number of digits in the requested format.

A1D0 - A1DD: Set Floating-Point value to 0.00 if A is not 1
If the number format requested (A) is 0 (general) or 2 (Fixed) then the FWA value to print is 0.00,
so set the FWA to 0.00 and [&A1D4] zero &48 (the decimal Exponent); next, increment the number
of decimals to print (&38) [from 0 to 1], as 0 decimals were originally requested.

A1DE - A2CF: Convert Floating-Point value to ASCII in required format
If the requested number format is 1 (Exponential format) then [&A215] Set the position of the decimal
point to 1 (&4D) - as in exponential format, the decimal point always appears after the first digit; and�
jump to &A217 to convert the Floating-Point value to ASCII.

Otherwise (format is General or Fixed-Point).
If the exponent value (&48) is positive and greater than or equal to the number of decimals to print (&38),
then the value will be converted in Exponential-format (as it is too large to be converted without the 'E'xponent),
so [&A215] Set the position of the decimal point to 1 (&4D) - as in exponential format, the decimal
point always appears after the first digit; & jump to &A217 to convert the
Floating-Point value to ASCII.

If the exponent value (&48) is positive and less than the number of decimals to print (&38),
then the value can be converted without the exponential value, so [&A215] Set the position of the
decimal point (&4D) to the exponential value (&48) plus 1, so that the decimal point will occur in the
correct potition (i.e. value 1E3 will print the decimal point after the 4th digit - as the decimal value is '1000.00'),
clear &48 - the exponential value & jump to &A217 to convert the Floating-Point value to ASCII.

[&A1F2] If the requested format is General and the exponential value is not &FF, then
the Floating-Point value contains a negative exponent that needs to be converted in exponential format.
(i.e. the Floating-Point value is not a single fractional digit, i.e. 0.3), so [&A215] Set the position
of the decimal point to 1 (&4D) and jump to &A217 to convert the Floating-Point
value to ASCII in exponential format. This is because BASIC always converts a general format number to
exponential format if it is smaller than or equal to 0.01.

Otherwise, [&A1FE] The Floating-Point value can be converted in Fixed-Point format
Firstly, add the characters "0." to the output string (SWA), as we are converting a fractional value.
Next, Keep incrementing &48 (the exponent value), until the exponent &48 is zero, for each loop
add a zero "0" to the output string (SWA). This adds the required number of leading zeros to the output value.
Set &4D to #&80. &4D is the number of digits to output before the decimal point (".") is output.
The value &80 means that routine section &A217-&A2CF will not output a decimal point (as it has
already been output). Now, continue with the next routine section - &A217.

A217 - A2CF: Convert the Floating-Point value to ASCII string (in SWA)
Call &A26C to add the top digit of the Floating-Point (FWA) Mantissa value to the output string and
then remove the top digit and multiply the rest of the FWA mantissa by 10 (so that the new top digit is the next digit).
&A26C does the following:
1) Load FWA Mantissa byte 1 and divide it by 8 (to place the top 4 bits in the lower 4 bits - also
clearing the top 4 bits.
2) Call &A2CE to ORA the 4 lower bits (from step 1) with #&30 (this adds &30 to the digit
value, and thus converts the digit from a numeric value to ASCII value (offset from 48)) and continue to
&A2D0 to add the digit to the output string.
3) Set the top 4 bits of the FWA mantissa to zero (this removes the digit that we have just output from
the FWA mantissa value).
4) Store result from step 3, and FWA Mantissa bytes &31 to &33 to the stack.
Set X to &34 and A to &35.
5) Multiply FWA Mantissa (A and Mantissa bytes &34 to &31) by 4
6) Add the FWA Mantissa values (now, multiplied by 4) to the previous FWA mantissa values (before
the multiplication, stored in &35, X and the other 3 bytes from the Stack).
7) Now the FWA mantissa has been multiplied by 5 (4 plus 1), so multiply the FWA mantissa again, this
time by 2, in order to achieve the desired result of multipling the FWA value by 10.
8) Exit with A = the lower 4 bits of &31 (before the multiplication by 10 occurred).
Next, decrement &4D (the number of digits to output before the decimal point value).
If &4D has reached zero then add a decimal point, ".", to the output string.

Decrement &38, the number of decinals to print, and if this value hasn't reached zero then there
are still further digits to print, so jump back to &A217 to output the next digit.

Now, all required digits have been added to the output string.
If the output format is 0 (general) then strip any trailing zeros and decimal points, as follows:
1) Set Y to &36; i.e. the next free character in the output string.
2) Decrement Y (to point to the next character from the end of the output value).
3) If the current last character (&0600, Y) is zero then go back to step 2 (to skip all trailing zeros)
4) If the current last character is a decimal point then skip this also.
5) Now Y points to the actual length of the value, excluding any training zeros and decimal points, so
store Y in &36 to set the new length of the output string (SWA).
If the output format is 2 (fixed-point) or 0 (general) and the Exponent (&48) is zero then exit.
Otherwise, there is an exponent value to output.

The exponent value is outputted as follows:
1) Add "E" to the output string value.
2) If &48 is negative then add "-" to the output string and subtract the exponent (&48) from zero to
obtain the positive exponent value (reverse the two's compliment).
3) [&A2BF] Keep subtracting 10 from the exponent value and incrementing X until the exponent value
is less than 10. Now X contains the ten's part (first digit) of the exponent value.
4) A now contains the number of units, the second digit of the exponent value. Store this value on the stack.
5) If the number of ten's (X) (the first digit) of the exponent value is not zero then set A = X and call &A2D0
to add the digit to the end of the output string.
6) Pop the number of units (second digit) in the exponent value from the stack, and call &A2D0 to add
the digit to the end of the output string.
7) If the output format (&37) is 0 (general) then exit.
Otherwise, we may need to add spaces to the end of the output value, to ensure that the exponent value
lines up with other printed numerical values.
8) If the exponent value (&48) is positive then add a space to the end of the output string (to make
up for the "-" that we didn't need to add!).
9) If X is zero (the exponent was 1 digit long, no ten's value) then add a space to the end of the output
string (to make up for the extra digit that we did not need to add!).
Exit from the routine as the SWA now contains the original numerical value (from the FWA) converted to ASCII format.
Note: this routine does not preserve the original value of the FWA.


A2D0 - A2D9: Add character to the end of the current ASCII value
Temporarily store X on the stack.
Store the ASCII character in A in location &0600 + &36 (the end of the current SWA value).
Retrieve X from the stack.
Increment &36, so that the SWA length is now correctly incrememted by 1 character and return.



Examples:


Example 1:
Value = 1000 (FWA Exponent is &8A, FWA Mantissa is &FA)
Output format = 0 (General format).
The NUMASC routine will process this value as follows:
[&A10B] The FWA exponent is > &83, so divide the FWA by 10 and increment the decimal exponent.
Now, FWA = 100 (Exponent &87, Mantissa &C8). &48 = 1.
The FWA exponent is > &83, so divide the FWA by 10 and increment the decimal exponent.
Now, FWA = 10 (Exponent &84, Mantissa &A0). &48 = 2.
The FWA exponent is > &83, so divide the FWA by 10 and increment the decimal exponent.
Now, FWA = 1 (Exponent &81, Mantissa &80). &48 = 3.

[&A16F] ?&38 = ?&4D (9).
Output format is not 2 so goto &A190.
Decimals (?&38) is 9, so the roundup value is 0.000000005.
Add roundup value to numeric value = 1.000000005 (Exponent = &81, Mantissa = &8000000ABC).
FWA Exponent is < &84, so divide FWA by 2 & increment exponent; FWA now = 1.000000005 (Exp: &82, Mantissa: &400000055E)
FWA Exponent is < &84, so divide FWA by 2 & increment exponent; FWA now = 1.000000005 (Exp: &83, Mantissa: &20000002AF)
FWA Exponent is < &84, so divide FWA by 2 & increment exponent; FWA now = 1.000000005 (Exp: &84, Mantissa: &1000000157)

[&A1C6] FWA Mantissa byte 1 is less than #&A0, so okay, continue to &A1DE.
[&A1DE] Format is not scientific and Exponent is not negative or greater than &48 (the number of digits
to print, so the value can be outputted without the exponent, so set &48 to zero.
The exponent is not #&FF so jump to &A215.
[&A215] Set ?&4D to decimal point position (A) = position 4 in the output string.
[&A217] Call &A26C (output top digit "1", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&0000000D66)
Decrement &4D to 3; &4D is not zero, so [&A223] Decrement &38 to 8; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&00000085FC)
Decrement &4D to 2; &4D is not zero, so [&A223] Decrement &38 to 7; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&0000053BD8)
Decrement &4D to 1; &4D is not zero, so [&A223] Decrement &38 to 6; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&0000345670)
Decrement &4D to 0; &4D is zero, so [&A21E] Add "." to the output string.
Decrement &38 to 5; (no decrement for the "." as it isn't a significant digit!). Jump to &A217 as &38 not zero.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&00020B6060)
Decrement &4D to &FF; &4D is not zero, so [&A223] Decrement &38 to 4; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&001471C3C0)
Decrement &4D to &FE; &4D is not zero, so [&A223] Decrement &38 to 3; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&00CC71A580)
Decrement &4D to &FD; &4D is not zero, so [&A223] Decrement &38 to 2; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&07FC707700)
Decrement &4D to &FC; &4D is not zero, so [&A223] Decrement &38 to 1; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&4FDC64A600)
Decrement &4D to &FB; &4D is not zero, so [&A223] Decrement &38 to 0; &38 is now zero so goto &A227.

[&A227] Now the output string is contained in SWA locations &600-&609, which contain the value "1000.00000".
Strip any trailing "0" and "."-characters from the value, now the value is "1000".
The Exponent value (&48) is zero, meaning that there is no exponent to print, so exit.


Example 2:
Value = 28.96301767 (FWA Exponent is &85, FWA Mantissa is &E7B4429C00)
Output format = 1 (Exponential format).
The NUMASC routine will process this value as follows:
[&A10B] The FWA exponent is > &83, so divide the FWA by 10 and increment the decimal exponent.
Now, FWA = 2.896301767 (Exponent &82, Mantissa &B95D021666). &48 = 1.

[&A16F] ?&38 = ?&4D (9).
Output format is not 2 so goto &A190.
Decimals (?&38) is 9, so the roundup value is 0.000000005.
Add roundup value to numeric value = 2.896301772 (Exponent = &82, Mantissa = &B95D021BC4).
FWA Exponent is < &84, so divide FWA by 2 & increment exponent; FWA now = 2.896301772 (Exp: &83, Mantissa: &5CAE810DE2)
FWA Exponent is < &84, so divide FWA by 2 & increment exponent; FWA now = 2.896301772 (Exp: &84, Mantissa: &2E574086F1)

[&A1C6] FWA Mantissa byte 1 is less than #&A0, so okay, continue to &A1DE.
[&A1DE] Format is scientific so jump to &A215
[&A215] Set ?&4D to decimal point position (A) = position 1 in the output string (as we are outputting in
exponential format).
[&A217] Call &A26C (output top digit "2", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&8F6885456A)
Decrement &4D to 0; &4D is zero, so [&A21E] Add "." to the output string.
Decrement &38 to 8; (no decrement for the "." as it isn't a significant digit!). Jump to &A217 as &38 not zero.
[&A217] Call &A26C (output top digit "8", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&9A1534B624)
Decrement &4D to &FF; &4D is not zero, so [&A223] Decrement &38 to 7; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "9", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&64D40F1D68)
Decrement &4D to &FE; &4D is not zero, so [&A223] Decrement &38 to 6; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "6", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&3048972610)
Decrement &4D to &FD; &4D is not zero, so [&A223] Decrement &38 to 5; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "3", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&02D5E77CA0)
Decrement &4D to &FC; &4D is not zero, so [&A223] Decrement &38 to 4; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&1C5B0ADE40)
Decrement &4D to &FB; &4D is not zero, so [&A223] Decrement &38 to 3; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "1", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&7B8E6CAE80)
Decrement &4D to &FA; &4D is not zero, so [&A223] Decrement &38 to 2; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "7", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&73903ED100)
Decrement &4D to &F9; &4D is not zero, so [&A223] Decrement &38 to 1; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "7", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&23A2742A00)
Decrement &4D to &F8; &4D is not zero, so [&A223] Decrement &38 to 0; &38 is now zero so goto &A244.

[&A244] Now the output string is contained in SWA locations &600-&609, which contain the value "2.89630177".
The output format is exponential, so add "E" to the output string (for the exponent).
The Exponent value (&48) is positive (1), so no minus sign required.
Call &A2BC to add the exponent to the output string - "1" is added.
The exponent was not negative, so add a space to the end of the output string.
The exponent was only 1-digit long, so add a space to the end of the output string.
The SWA output string value is now: "2.89630177E1 " so exit as complete.


Example 3:
Value = 3.1417321E-5 (FWA Exponent is &72, FWA Mantissa is &8F55347000)
Output format = 2 (Fixed-Point format).
The NUMASC routine will process this value as follows:
[&A10B] The FWA exponent is < &81, so multiply the FWA by 10 and increment the decimal exponent.
Now, FWA = 0.0003417321 (Exponent &75, Mantissa &B32A818C). &48 = &FF.
The FWA exponent is < &81, so multiply the FWA by 10 and increment the decimal exponent.
Now, FWA = 0.003417321 (Exponent &78, Mantissa &EFF521EF). &48 = &FE.
The FWA exponent is < &81, so multiply the FWA by 10 and increment the decimal exponent.
Now, FWA = 0.03417321 (Exponent &7C, Mantissa &8BF93536). &48 = &FD.
The FWA exponent is < &81, so multiply the FWA by 10 and increment the decimal exponent.
Now, FWA = 0.3417321 (Exponent &7F, Mantissa &AEF78283). &48 = &FC.
The FWA exponent is < &81, so multiply the FWA by 10 and increment the decimal exponent.
Now, FWA = 3.417321 (Exponent &82, Mantissa &DAB5632366). &48 = &FB.

[&A16F] ?&38 = ?&4D (9).
Output format is 2 (fixed) so do the following:
Add &48 (decimal exponent) to &38 (decimals to output) = &FB + 9 + 1 (carry) = &05.
The result (&05) is < #&0B, so Set &38 (digits to output) to 5 (the result), zero the exponent (&48),
and goto &A190.
[&A190] Decimals is 9, so the roundup value is 0.000000005.
Add roundup value to numeric value = 3.417321005 (Exponent = &82, Mantissa = &DAB56328C4).
FWA Exponent is < &84, so divide FWA by 2 & increment exponent; FWA now = 3.417321005 (Exp: &83, Mantissa: &6D5AB19462)
FWA Exponent is < &84, so divide FWA by 2 & increment exponent; FWA now = 3.417321005 (Exp: &84, Mantissa: &36AD58CA31)

[&A1C6] FWA Mantissa byte 1 is less than #&A0, so okay, continue to &A1E4.
[&A1DE] The exponent is negative and format is 2 (Fixed), so goto &A1FE.
[&A1FE] Add "0." to the output string (SWA).
Increment the Exponent value (&48), and keep adding "0" to the output string until &48 is 0.
Now the output string is "0.0000".
[&A213] Set ?&4D to &80 (as we do not need to print a decimal point now).
[&A217] Call &A26C (output top digit "3", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&42C577E5EA)
Decrement &4D to &7F; &4D is not zero, so [&A223] Decrement &38 to 4; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "4", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&1BB6AEFB24)
Decrement &4D to &7E; &4D is not zero, so [&A223] Decrement &38 to 3; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "1", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&7522D5CF68)
Decrement &4D to &7D; &4D is not zero, so [&A223] Decrement &38 to 2; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "7", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&335C5A1A10)
Decrement &4D to &7C; &4D is not zero, so [&A223] Decrement &38 to 1; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "3", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&219B8504A0)
Decrement &4D to &7B; &4D is not zero, so [&A223] Decrement &38 to 0; &38 is now zero so goto &A240.
[&A240] The exponent (&48) is zero so exit with SWA = "0.000034173".


Example 4:
value = 8.92381E-10 (FWA Exponent is &62, FWA Mantissa is &F54BBAF5)
Output format = 0 (General format).
The NUMASC routine will process this value as follows:
[&A10B] While the FWA exponent is < &81, so multiply the FWA by 10 and increment the decimal exponent.
Now, FWA = 8.92381 (Exponent &84, Mantissa &8EC7ECFEB7). &48 = &F6 (-10).

[&A16F] ?&38 = ?&4D (9).
Output format is not 2 so goto &A190.
Decimals (?&38) is 9, so the roundup value is 0.000000005.
Add roundup value to numeric value = 8.923810005 (Exponent = &84, Mantissa = &8EC7ED000E).

[&A1C6] FWA Mantissa byte 1 is less than #&A0, so okay, continue to &A1E4.
[&A1E4] The Exponent is negative, so [&A1F4] check whether the exponent is = #&FF
as a single zero before the first non-zero digit after the decimal point is the threshold for the
general output format. Our value does not meet this threshold, so store 1 in &4D (output in Exponential format).

[&A217] Call &A26C (output top digit "8", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&93CF42008C)
Decrement &4D to 0; &4D is zero, so [&A21E] Add "." to the output string.
Decrement &38 to 8; (no decrement for the "." as it isn't a significant digit!). Jump to &A217 as &38 not zero.
[&A217] Call &A26C (output top digit "9", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&2618940578)
Decrement &4D to &FF; &4D is not zero, so [&A223] Decrement &38 to 7; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "2", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&3CF5C836B0)
Decrement &4D to &FE; &4D is not zero, so [&A223] Decrement &38 to 6; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "3", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&8199D222E0)
Decrement &4D to &FD; &4D is not zero, so [&A223] Decrement &38 to 5; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "8", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&1002355CC0)
Decrement &4D to &FC; &4D is not zero, so [&A223] Decrement &38 to 4; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "1", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&0016159F80)
Decrement &4D to &FB; &4D is not zero, so [&A223] Decrement &38 to 3; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&00DCD83B00)
Decrement &4D to &FA; &4D is not zero, so [&A223] Decrement &38 to 2; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&08A0724E00)
Decrement &4D to &F9; &4D is not zero, so [&A223] Decrement &38 to 1; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&5644770C00)
Decrement &4D to &F8; &4D is not zero, so [&A223] Decrement &38 to 0; &38 is now zero so goto &A244.

[&A244] Now the output string is contained in SWA locations &600-&609, which contain the value "8.92381000".
The output format is exponential, so add "E" to the output string (for the exponent).
The Exponent value (&48) is negative (-10), so add a minus sign ("-") to the output string.
Call &A2BC to add the exponent to the output string - "10" is added.
The exponent is subtracted from 0 in order to obtain its positive value.
The SWA output string value is now: "8.92381000E-10" so exit as complete.


Example 5:
Value = 0.8 (FWA Exponent is &80, FWA Mantissa is &CCCCCCCD00)
Output format = 2 (Fixed-Point format).
The NUMASC routine will process this value as follows:
[&A10B] The FWA exponent is < &81, so multiply the FWA by 10 and increment the decimal exponent.
Now, FWA = 8.0 (Exponent &84, Mantissa &8000000020). &48 = &FF.

[&A16F] ?&38 = ?&4D (9).
Output format is 2 (fixed) so do the following:
Add &48 (decimal exponent) to &38 (decimals to output) = &FF + 9 + 1 (carry) = &09.
The result (&09) is < #&0B, so Set &38 (digits to output) to 9 (the result), zero the exponent (&48),
and goto &A190.
[&A190] Decimals is 9, so the roundup value is 0.000000005.
Add roundup value to numeric value = 8.000000005 (Exponent = &84, Mantissa = &8000000177).

[&A1C6] FWA Mantissa byte 1 is less than #&A0, so okay, continue to &A1E4.
[&A1E4] The exponent is negative and format is 2 (Fixed), so goto &A1FE.
[&A1FE] Add "0." to the output string (SWA).
Increment the Exponent value (&48), the exponent value is now 0, so there are no further "0"'s to add after the
decimal point. Now the output string is "0.".
[&A213] Set ?&4D to &80 (as we do not need to print a decimal point now).
[&A217] Call &A26C (output top digit "8", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&0000000EA6)
Decrement &4D to &7F; &4D is not zero, so [&A223] Decrement &38 to 8; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&000000927C)
Decrement &4D to &7E; &4D is not zero, so [&A223] Decrement &38 to 7; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&000005B8D8)
Decrement &4D to &7D; &4D is not zero, so [&A223] Decrement &38 to 6; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&0000393870)
Decrement &4D to &7C; &4D is not zero, so [&A223] Decrement &38 to 5; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&00023C3460)
Decrement &4D to &7B; &4D is not zero, so [&A223] Decrement &38 to 4; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&00165A0BC0)
Decrement &4D to &7A; &4D is not zero, so [&A223] Decrement &38 to 3; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&00DF847580)
Decrement &4D to &79; &4D is not zero, so [&A223] Decrement &38 to 2; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&08BB2C9700)
Decrement &4D to &78; &4D is not zero, so [&A223] Decrement &38 to 1; &38 isn't zero so goto &A217.
[&A217] Call &A26C (output top digit "0", & multiply FWA mantissa by 10; now FWA=(Exp=&84, Mantissa=&574FBDE600)
Decrement &4D to &77; &4D is not zero, so [&A223] Decrement &38 to 0; &38 is now zero so goto &A240.
[&A240] The exponent (&48) is zero so exit with SWA = "0.800000000". Note: In Fixed-Point format the trailing
zeros are not stripped.


Disassembly for the NUMASC (Numeric value to ASCII String conversion) routine

Convert numeric value to ASCII (in Hexadecimal notation)
A0CA   152 98 TYA
A0CB   016 003 10 03 BPL 3 --> &A0D0
A0CD   032 195 150 20 C3 96 JSR &96C3 Convert Float to Integer
A0D0   162 000 A2 00 LDX#&00
A0D2   160 000 A0 00 LDY#&00
A0D4 * 185 042 000 B9 2A 00 LDA &002A,Y
A0D7 H 072 48 PHA
A0D8 ) 041 015 29 0F AND#&0F
A0DA ? 149 063 95 3F STA &3F,X
A0DC h 104 68 PLA
A0DD J 074 4A LSR A
A0DE J 074 4A LSR A
A0DF J 074 4A LSR A
A0E0 J 074 4A LSR A
A0E1   232 E8 INX
A0E2 ? 149 063 95 3F STA &3F,X
A0E4   232 E8 INX
A0E5   200 C8 INY
A0E6   192 004 C0 04 CPY#&04
A0E8   208 234 D0 EA BNE -22 --> &A0D4
A0EA   202 CA DEX
A0EB   240 004 F0 04 BEQ 4 --> &A0F1
A0ED ? 181 063 B5 3F LDA &3F,X
A0EF   240 249 F0 F9 BEQ -7 --> &A0EA
A0F1 ? 181 063 B5 3F LDA &3F,X
A0F3   201 010 C9 0A CMP#&0A
A0F5   144 002 90 02 BCC 2 --> &A0F9
A0F7 i 105 006 69 06 ADC#&06
A0F9 i0 105 048 69 30 ADC#&30
A0FB   032 208 162 20 D0 A2 JSR &A2D0 Add ASCII character to existing output string (SWA)
A0FE   202 CA DEX
A0FF   016 240 10 F0 BPL -16 --> &A0F1
A101 ` 096 60 RTS

Multiply FWA value until number is greater than or equal to 1
A102   016 007 10 07 BPL 7 --> &A10B
A104 - 169 045 A9 2D LDA#&2D
A106 d. 100 046 64 2E STZ &2E
A108   032 208 162 20 D0 A2 JSR &A2D0 Add ASCII character to existing output string (SWA)
A10B 0 165 048 A5 30 LDA &30
A10D   201 129 C9 81 CMP#&81
A10F K 176 075 B0 4B BCS 75 --> &A15C
A111 6 032 054 164 20 36 A4 JSR &A436 Floating-point multiply by 10 [FWA=FWA*10]
A114 H 198 072 C6 48 DEC &48
A116   128 243 80 F3 BRA -13 --> &A10B

NUMASC : Check conversion formats & conv IWA to FWA & handle zero
A118   174 002 004 AE 02 04 LDX &0402
A11B   224 003 E0 03 CPX#&03
A11D   144 002 90 02 BCC 2 --> &A121
A11F   162 000 A2 00 LDX#&00
A121 7 134 055 86 37 STX &37
A123   173 001 004 AD 01 04 LDA &0401
A126   240 006 F0 06 BEQ 6 --> &A12E
A128   201 010 C9 0A CMP#&0A
A12A   176 006 B0 06 BCS 6 --> &A132
A12C   128 006 80 06 BRA 6 --> &A134
A12E   224 002 E0 02 CPX#&02
A130   240 002 F0 02 BEQ 2 --> &A134
A132   169 010 A9 0A LDA#&0A
A134 8 133 056 85 38 STA &38
A136 M 133 077 85 4D STA &4D
A138 d6 100 054 64 36 STZ &36
A13A dH 100 072 64 48 STZ &48
A13C $ 036 021 24 15 BIT &15
A13E 0 048 138 30 8A BMI -118 --> &A0CA
A140   152 98 TYA
A141 0 048 003 30 03 BMI 3 --> &A146
A143   032 133 129 20 85 81 JSR &8185 Convert Integer to Float
A146   032 242 163 20 F2 A3 JSR &A3F2 Obtain Sign of the FWA Floating-Point value
A149   208 183 D0 B7 BNE -73 --> &A102
A14B 7 165 055 A5 37 LDA &37
A14D   208 005 D0 05 BNE 5 --> &A154
A14F 0 169 048 A9 30 LDA#&30
A151 L 076 208 162 4C D0 A2 JMP &A2D0 Add ASCII character to existing output string (SWA)
A154 L 076 208 161 4C D0 A1 JMP &A1D0

Divide FWA value until number is less than 1
A157   032 216 165 20 D8 A5 JSR &A5D8 Set FWA to 1.0
A15A   128 015 80 0F BRA 15 --> &A16B
A15C   201 132 C9 84 CMP#&84
A15E   144 015 90 0F BCC 15 --> &A16F
A160   208 006 D0 06 BNE 6 --> &A168
A162 1 165 049 A5 31 LDA &31
A164   201 160 C9 A0 CMP#&A0
A166   144 007 90 07 BCC 7 --> &A16F
A168 x 032 120 164 20 78 A4 JSR &A478 Divide Floating-Point value by 10 [FWA=FWA/10]
A16B H 230 072 E6 48 INC &48
A16D   128 156 80 9C BRA -100 --> &A10B

Check the number can be converted to required format
A16F 5 165 053 A5 35 LDA &35
A171 ' 133 039 85 27 STA &27
A173   032 017 165 20 11 A5 JSR &A511 Store FWA to &046C & set argp=&046C
A176 M 165 077 A5 4D LDA &4D
A178 8 133 056 85 38 STA &38
A17A 7 166 055 A6 37 LDX &37
A17C   224 002 E0 02 CPX#&02
A17E   208 016 D0 10 BNE 16 --> &A190
A180 eH 101 072 65 48 ADC &48
A182 0P 048 080 30 50 BMI 80 --> &A1D4
A184 8 133 056 85 38 STA &38
A186   201 011 C9 0B CMP#&0B
A188   144 006 90 06 BCC 6 --> &A190
A18A   169 010 A9 0A LDA#&0A
A18C 8 133 056 85 38 STA &38
A18E d7 100 055 64 37 STZ &37
A190   032 184 166 20 B8 A6 JSR &A6B8 Clear FWA (except Exp/Mantissa1)
A193   169 160 A9 A0 LDA#&A0
A195 1 133 049 85 31 STA &31
A197   169 131 A9 83 LDA#&83
A199 0 133 048 85 30 STA &30
A19B 8 166 056 A6 38 LDX &38
A19D   240 006 F0 06 BEQ 6 --> &A1A5
A19F x 032 120 164 20 78 A4 JSR &A478 Divide Floating-Point value by 10 [FWA=FWA/10]
A1A2   202 CA DEX
A1A3   208 250 D0 FA BNE -6 --> &A19F
A1A5   032 146 165 20 92 A5 JSR &A592 Set argp to &046C
A1A8   032 224 164 20 E0 A4 JSR &A4E0 Unpack (&4A, &4B) variable to FWB
A1AB ' 165 039 A5 27 LDA &27
A1AD A 133 065 85 41 STA &41
A1AF h 032 104 131 20 68 83 JSR &8368 Floating-Point Addition
A1B2 0 165 048 A5 30 LDA &30
A1B4   201 132 C9 84 CMP#&84
A1B6   176 014 B0 0E BCS 14 --> &A1C6
A1B8 f1 102 049 66 31 ROR &31
A1BA f2 102 050 66 32 ROR &32
A1BC f3 102 051 66 33 ROR &33
A1BE f4 102 052 66 34 ROR &34
A1C0 f5 102 053 66 35 ROR &35
A1C2 0 230 048 E6 30 INC &30
A1C4   208 236 D0 EC BNE -20 --> &A1B2
A1C6 1 165 049 A5 31 LDA &31
A1C8   201 160 C9 A0 CMP#&A0
A1CA   176 139 B0 8B BCS -117 --> &A157
A1CC 8 165 056 A5 38 LDA &38
A1CE   208 014 D0 0E BNE 14 --> &A1DE

If A is not 1 then set the FWA value to 0.00
A1D0   201 001 C9 01 CMP#&01
A1D2 A 240 065 F0 41 BEQ 65 --> &A215
A1D4   032 180 166 20 B4 A6 JSR &A6B4 JSR &A6B4 Clear FWA
A1D7 dH 100 072 64 48 STZ &48
A1D9 M 165 077 A5 4D LDA &4D
A1DB   026 1A INC A
A1DC 8 133 056 85 38 STA &38

Covert the numeric to the required format
A1DE   169 001 A9 01 LDA#&01
A1E0 7 197 055 C5 37 CMP &37
A1E2 1 240 049 F0 31 BEQ 49 --> &A215
A1E4 H 164 072 A4 48 LDY &48
A1E6 0 048 010 30 0A BMI 10 --> &A1F2
A1E8 8 196 056 C4 38 CPY &38
A1EA ) 176 041 B0 29 BCS 41 --> &A215
A1EC dH 100 072 64 48 STZ &48
A1EE   200 C8 INY
A1EF   152 98 TYA
A1F0 # 208 035 D0 23 BNE 35 --> &A215
A1F2 7 165 055 A5 37 LDA &37
A1F4   201 002 C9 02 CMP#&02
A1F6   240 006 F0 06 BEQ 6 --> &A1FE
A1F8   169 001 A9 01 LDA#&01
A1FA   192 255 C0 FF CPY#&FF
A1FC   208 023 D0 17 BNE 23 --> &A215
A1FE 0 169 048 A9 30 LDA#&30
A200   032 208 162 20 D0 A2 JSR &A2D0 Add ASCII character to existing output string (SWA)
A203 . 169 046 A9 2E LDA#&2E
A205   032 208 162 20 D0 A2 JSR &A2D0 Add ASCII character to existing output string (SWA)
A208 0 169 048 A9 30 LDA#&30
A20A H 230 072 E6 48 INC &48
A20C   240 005 F0 05 BEQ 5 --> &A213
A20E   032 208 162 20 D0 A2 JSR &A2D0 Add ASCII character to existing output string (SWA)
A211   128 247 80 F7 BRA -9 --> &A20A
A213   169 128 A9 80 LDA#&80
A215 M 133 077 85 4D STA &4D
A217 l 032 108 162 20 6C A2 JSR &A26C
A21A M 198 077 C6 4D DEC &4D
A21C   208 005 D0 05 BNE 5 --> &A223
A21E . 169 046 A9 2E LDA#&2E
A220   032 208 162 20 D0 A2 JSR &A2D0 Add ASCII character to existing output string (SWA)
A223 8 198 056 C6 38 DEC &38
A225   208 240 D0 F0 BNE -16 --> &A217
A227 7 164 055 A4 37 LDY &37
A229   136 88 DEY
A22A   240 024 F0 18 BEQ 24 --> &A244
A22C   136 88 DEY
A22D   240 017 F0 11 BEQ 17 --> &A240
A22F 6 164 054 A4 36 LDY &36
A231   136 88 DEY
A232   185 000 006 B9 00 06 LDA &0600,Y
A235 0 201 048 C9 30 CMP#&30
A237   240 248 F0 F8 BEQ -8 --> &A231
A239 . 201 046 C9 2E CMP#&2E
A23B   240 001 F0 01 BEQ 1 --> &A23E
A23D   200 C8 INY
A23E 6 132 054 84 36 STY &36
A240 H 165 072 A5 48 LDA &48
A242 ' 240 039 F0 27 BEQ 39 --> &A26B
A244 E 169 069 A9 45 LDA#&45
A246   032 208 162 20 D0 A2 JSR &A2D0 Add ASCII character to existing output string (SWA)
A249 H 165 072 A5 48 LDA &48
A24B   016 010 10 0A BPL 10 --> &A257
A24D - 169 045 A9 2D LDA#&2D
A24F   032 208 162 20 D0 A2 JSR &A2D0 Add ASCII character to existing output string (SWA)
A252 8 056 38 SEC
A253   169 000 A9 00 LDA#&00
A255 H 229 072 E5 48 SBC &48
A257   032 188 162 20 BC A2 JSR &A2BC Add exponent to the output string
A25A 7 165 055 A5 37 LDA &37
A25C   240 013 F0 0D BEQ 13 --> &A26B
A25E   169 032 A9 20 LDA#&20
A260 H 164 072 A4 48 LDY &48
A262 0 048 003 30 03 BMI 3 --> &A267
A264   032 208 162 20 D0 A2 JSR &A2D0 Add ASCII character to existing output string (SWA)
A267   224 000 E0 00 CPX#&00
A269 e 240 101 F0 65 BEQ 101 --> &A2D0 Add ASCII character to existing output string (SWA)
A26B ` 096 60 RTS
A26C 1 165 049 A5 31 LDA &31
A26E J 074 4A LSR A
A26F J 074 4A LSR A
A270 J 074 4A LSR A
A271 J 074 4A LSR A
A272   032 206 162 20 CE A2 JSR &A2CE
A275   169 240 A9 F0 LDA#&F0
A277 1 020 049 14 31 TRB &31
A279 H 072 48 PHA
A27A 4 166 052 A6 34 LDX &34
A27C 1 165 049 A5 31 LDA &31
A27E H 072 48 PHA
A27F 2 165 050 A5 32 LDA &32
A281 H 072 48 PHA
A282 3 165 051 A5 33 LDA &33
A284 H 072 48 PHA
A285 5 165 053 A5 35 LDA &35
A287   010 0A ASL A
A288 &4 038 052 26 34 ROL &34
A28A &3 038 051 26 33 ROL &33
A28C &2 038 050 26 32 ROL &32
A28E &1 038 049 26 31 ROL &31
A290   010 0A ASL A
A291 &4 038 052 26 34 ROL &34
A293 &3 038 051 26 33 ROL &33
A295 &2 038 050 26 32 ROL &32
A297 &1 038 049 26 31 ROL &31
A299 e5 101 053 65 35 ADC &35
A29B 5 133 053 85 35 STA &35
A29D   138 8A TXA
A29E e4 101 052 65 34 ADC &34
A2A0 4 133 052 85 34 STA &34
A2A2 h 104 68 PLA
A2A3 e3 101 051 65 33 ADC &33
A2A5 3 133 051 85 33 STA &33
A2A7 h 104 68 PLA
A2A8 e2 101 050 65 32 ADC &32
A2AA 2 133 050 85 32 STA &32
A2AC h 104 68 PLA
A2AD e1 101 049 65 31 ADC &31
A2AF 5 006 053 06 35 ASL &35
A2B1 &4 038 052 26 34 ROL &34
A2B3 &3 038 051 26 33 ROL &33
A2B5 &2 038 050 26 32 ROL &32
A2B7 * 042 2A ROL A
A2B8 1 133 049 85 31 STA &31
A2BA h 104 68 PLA
A2BB ` 096 60 RTS
A2BC   162 255 A2 FF LDX#&FF
A2BE 8 056 38 SEC
A2BF   232 E8 INX
A2C0   233 010 E9 0A SBC#&0A
A2C2   176 251 B0 FB BCS -5 --> &A2BF
A2C4 i 105 010 69 0A ADC#&0A
A2C6 H 072 48 PHA
A2C7   138 8A TXA
A2C8   240 003 F0 03 BEQ 3 --> &A2CD
A2CA   032 206 162 20 CE A2 JSR &A2CE
A2CD h 104 68 PLA
A2CE 0 009 048 09 30 ORA#&30

Add ASCII character to existing output string (SWA)
A2D0   218 DA PHX
A2D1 6 166 054 A6 36 LDX &36
A2D3   157 000 006 9D 00 06 STA &0600,X
A2D6   250 FA PLX
A2D7 6 230 054 E6 36 INC &36
A2D9 ` 096 60 RTS

 


 Back to 8BS
Or