| Purpose: | Generate a character string that is the decimal
representation of the UNSIGNED LONG INTEGER value passed. Optionally print and/or copy the string generated. |
||||
| Assumes: | There is sufficient buffer space if copying is enabled (maximum 15 BYTEs, e.g., "4,294,967,294 ", NULL.) | ||||
| Passed: | R25:R24:R23:R22 | ULONG | ulValue | value to be formatted | |
| R21:R20 | BYTE * | bPtrBuffer | starting SRAM address at which to generate output; NULL omits copying | ||
| R18 | BYTE | bFlags | option BITs BIT_FMT_COMMAS, BIT_FMT_POST_Sp, BIT_FMT_PRINT, and BIT_FMT_SIGNED. | ||
| Returns: | Nothing. | ||||
| Alters: | SREG (the FLAGs) and possibly the caller's buffer and/or the print buffer; all other Registers are preserved. | ||||
| Example: |
|
||||
| Test it: |
| ||||
| Notes: | The StackAlloc50 System Function is used by this routine to create a local buffer, into which the string is written. | ||||
| The formatted string is then copied, or printed, or both (or neither.) | |||||
| The BIT_FMT_COMMAS BIT causes a comma to delimit the string at the expected three-digit intervals. | |||||
| The BIT_FMT_POST_Sp BIT pads a space character after the last numeric digit. | |||||
| The BIT_FMT_PRINT BIT causes the string to be transferred into the COM1 serial port buffer. | |||||
| The BIT_FMT_SIGNED BIT causes the Most Significant BIT in R25 to be checked, and if logic 1, causes the value to be output as a SIGNED LONG, with '-' sign leading. | |||||
| A SIGNED LONG has the range of -2,147,483,648 = 0x80000000 to 0x7FFFFFFF = +2,147,483,647. | |||||
| Negative signed values range from -2,147,483,648 = 0x80000000 to -1 = 0xFFFFFFFF. | |||||
| Dropin: (setup code) |
; Setup for the FormatULONG() call: ; Passed: R25:R24:R23:R22 ULONG ulValue to be formatted ; R21:R20 BYTE * bPtrBuffer pointer to the SRAM buffer or NULL ; R18 BYTE bFlags (BIT_FMT_... COMMAS, POST_Sp, & PRINT) ; Returns: Nothing. ; Alters: Only the FLAGs and the copy and/or print buffer(s) selected | ||||
| Also see: | The FormatULONGHex, FormatWORD, and FormatCopyAndPrint System Functions. | ||||