DumpMemory

Purpose: Invoke a routine which formats and emits a selected portion of SRAM, EEPROM or FLASH (or PROGRAM) memory to the serial port.
Assumes: The BIT_OS_DUMP_FG_ONLY in EEbFlags_OS can select FOREGROUND instead of the default BACKGROUND processing.
Passed:    R25:R24  BYTE *   bPtrStart the starting address
R23:R22  BYTE * bPtrEnd the ending address
R20  BYTE bType "E" selects EEPROM; either "F" or "P" select FLASH, any other value selects SRAM
R18  BYTE bFlags in which the following are supported:
 BIT_DM_FOREGROUND (1: foreground, 0: background) output
 BIT_DM_IHEX (1: IntelHEX, 0: SYMDEB) format
 BIT_DM_OMITHEADER (1: do not print: 0: print) a header
 BIT_DM_OMITIHEXSEG (1: do not print: 0: print) iHEX Segment
 BIT_DM_OMITIHEXEOF (1: do not print: 0: print) iHEX EOF
 BIT_DM_IHEX_8_WIDE (1: 8 data bytes; 0: 16 data bytes)
Returns: Nothing.
Alters: R18 through R25, R30, R31, wMemDumpStart, wMemDumpEnd, and bFlags_BackGnd
Example:  Sometimes it is helpful to see what characters are actually in the Parsing Buffer before starting to work with it.
A_Last = bParseBufferCount + BParseBufferSize

DumpParsingBuffer:                        ; Note: BParseBufferSize = bParseBufferCount
   CALL    APushAll                       ;       + sizeof (bParseBuffer[] array)
   LDI     R25, bParseBufferCount >> 8
   LDI     R24, bParseBufferCount & 0xFF  ; Set the starting address in R25:R24
   LDI     R23, A_Last >> 8
   LDI     R22, A_Last & 0xFF             ; Set the ending address in R23:R22
   LDI     R20, 0                         ; Select SRAM
;----------
;# LDI     R18, 0                         ; Select BACKGROUND, 16 WIDE, etc.
   LDI     R18, B_MASK_FG                 ; Select the FOREGROUND option ('+')
;----------                               ;  (since BACKGROUND output is confusing)
   CALL    ADumpMemory
   JMP     APopAll
Notes: By default, the output is generated while the other system functions continue (i.e., "in the BACKGROUND") but that may be overridden, if desired, be selecting the BIT_DM_FOREGROUND option bit in R18.
Dropin: 
(setup
code)
;   Setup for the DumpMemory() call:
; Passed: R25:R24 BYTE * bPtrStart is the starting address
;         R23:R22 BYTE * bPtrEnd is the ending address
;             R20 BYTE   bType "E" (EEPROM) or "F" or "P" (FLASH), else SRAM
;             R18 BYTE   bFlags (type and BACKGROUND)
;                  BIT_DM_FOREGROUND  (1: foreground, 0: background) output
;                  BIT_DM_IHEX        (1: IntelHEX, 0: SYMDEB) format
;                  BIT_DM_OMITHEADER  (1: do not print: 0: print) a header
;                  BIT_DM_OMITIHEXSEG (1: do not print: 0: print) iHEX Segment
;                  BIT_DM_OMITIHEXEOF (1: do not print: 0: print) iHEX EOF line
;                  BIT_DM_IHEX_8_WIDE (1: 8 data bytes; 0: 16 data bytes)
; Returns: Nothing.
; Alters:  R18 through R25, R30, R31, wMemDumpStart, wMemDumpEnd, and bFlags_BackGnd