PrintScaledULONG

Purpose: Format and print a scaled integer value in floating point format with the specified number of digits after the decimal point.
Assumes: The value is positive.
Passed:    R25:R24:R23:R22   ULONG   ulValue   the positive value to be formatted
R20   BYTE bToRight   digit count after the decimal (limited to 8)
Returns:   Nothing
Alters: Only the FLAGs
Example:  In a rare glimpse into the MIRTOS Operating System source code, this example was extracted directly from the "2" though "6" system commands' source. This is why its format differs slightly from that of other examples.
Case_2:                   ; Bytes Clocks   "2" is to demonstrate scaling
   LDI     R30, 2            ;  2  1   Set the number of digits in R30; stored
   RJMP    ACase_2to6_Common ;  2  2    there since IncX2_ParseValue trashes R20
Case_3:                   ; Bytes Clocks   "3" is the same
   LDI     R30, 3            ;  2  1
   RJMP    ACase_2to6_Common ;  2  2
Case_4:                   ; Bytes Clocks   "4" is the same
   LDI     R30, 4            ;  2  1
   RJMP    ACase_2to6_Common ;  2  2
Case_5:                   ; Bytes Clocks   "5" is the same
   LDI     R30, 5            ;  2  1
   RJMP    ACase_2to6_Common ;  2  2
Case_6:                   ; Bytes Clocks   "6" is the same
   LDI     R30, 6            ;  2  1

Case_2to6_Common:         ; Bytes Clocks
   RCALL   AIncX2_ParseValue ;  2  3   Move past "#6" & call ParseValue(); get
   MOV     R20, R30          ;  2  1    LONG value, returned in R25:R24:R23:R22
   SBRC    R21, BIT_PV_VALID ;  2 1/2  Transfer the number of digits to R20
   RCALL   APrintScaledULONG ;  2  3   Call the routine to show the output
   RJMP    APrintNewLine     ;  2  2   Print the new line and return
Notes: -
Dropin: 
(setup
code)
;   Setup for the PrintScaledULONG() call:
; Passed:  R25:R24:R23:R22 ULONG ulValue  the value to be formatted
;                      R20 BYTE  bOnRight digit count right of the decimal (< 9)
; Returns: Nothing.
; Alters:  Only the FLAGs.
Also see:  System commands "2", "3", "4", "5", and "6".