PrintCHAR

Purpose: Output a single character (CHAR) to the serial port.
Assumes:   Values less than 7 are unprintable, as is the value 255.
Passed: R24   CHAR   cValue   the character to print (or enbuffer)
Returns: R24 CHAR cValue   the same cValue that was passed in R24, unchanged
Alters: Only the FLAGs (SREG) and the COM1 Transmit buffer

Example:  
.ORG  0x1000

CSZ_SpEqSp = 0x3AD2               ; FLASH address of the string " = ", NULL

OutputOneCHAR:
   LDI     R21, 1 << BIT_PV_HEX   ; BIT_PV_HEX = 1, in case parsing is skipped
   ADIW    R26, 0                 ; If there is no command tail, don't try to
   BREQ    ASaveDataCHAR          ;  parse anything starting at SRAM address 0!
   MOVW    R24, R26               ; Move the command tail pointer to R25:R24 in
   CALL    AParseValue            ;  order to parse any value found there
   MOV     R24, R22               ; Use parsed value's LSByte (or 0) to R24

SaveDataCHAR:
   MOV     R26, R24               ; Preserve the CHAR to be output
   SBRS    R21, BIT_PV_HEX        ; If a value was input in decimal notation,
   CALL    APrint0xHexBYTE        ;  print it in standard hex notation
   SBRC    R21, BIT_PV_HEX        ; But if it was input in hexadecimal format,
   CALL    APrintBYTE             ;  print it in decimal notation instead
   LDI     R25, CSZ_SpEqSp >> 8   ; Point to the delimiter string, which is
   LDI     R24, CSZ_SpEqSp & 0xFF ;  already contained in the FLASH memory
   CALL    APrintFLASHASCIIz      ; Print the NULL terminated string
   LDI     R24, '"'               ; To highlight the CHAR printed, surround it
   CALL    APrintCHAR             ;  in double quotes, so print the first one
   MOV     R24, R26               ; Restore the CHAR to be printed
   CALL    APrintCHAR
   LDI     R24, '"'               ; Normally, a single quote would be used for
   CALL    APrintCHAR             ;  a CHAR, but ''' is somewhat confusing
   JMP     APrintNewLine          ; Print Carriage Return, Line Feed & exit
Test it:
m>@ 4096          ; With a command tail but no parameter
0x00 = ""
m>@ 4096
0 = ""
m>@ 4096  1       ; No output for CHAR values 0 through 7
0x01 = ""
m>@ 4096  9       ; This is the TAB character
0x09 = "        "
m>@ 4096 10       ; This is the "Line Feed" character
0x0A = "
"
m>@ 4096 0x20
32 = " "
m>@ 4096 0x41
65 = "A"
m>@ 4096 122
0x7A = "z"
m>                                                                                        
Notes: This is a "wrapper" around the COM1_Write1CHAR routine, which does not preserve R25, R26, R27, R30, or R31.
Any CHAR value from 7 through 254 is output, so non-standard ASCII characters (those above 127) may be printed.
The value 255 (= 0xFF) is discarded since it likely was read from an area of uninitialized FLASH.
As with the other Print functions, this function can block.
Dropin: 
(setup
code)
;   Setup for the PrintCHAR() call:
; Passed:  R24 CHAR cValue to print in binary format
; Returns: R24 CHAR cValue, unchanged
; Alters:  the FLAGs and the COM1 Transmit Buffer
Also see: The System Functions PrintBYTE, Print0xPrefix, the PrintBYTE family, and the PrintWORD family.