Systronix_utilities.cpp
//---------------------------< H E X _ D U M P _ C O R E >----------------------------------------------------
//
// Render a 'page' (16 rows of 16 columns) of hex data and its character equivalent.  data_ptr MUST point to
// a buffer of at least 256 bytes.  This function always renders 256 items regardless of the size of the source.
// TODO: add support for 32-bit addressing
< H E X _ D U M P _ C O R E >
Render a 'page' (16 rows of 16 columns) of hex data and its character equivalent.  data_ptr MUST point to
a buffer of at least 256 bytes.  This function always renders 256 items regardless of the size of the source.
TODO: add support for 32-bit addressing
< H E X _ D U M P _ C O R E > Render a ' page ' ( 16 rows of 16 columns ) of hex data and its character equivalent . data_ptr MUST point to a buffer of at least 256 bytes . This function always renders 256 items regardless of the size of the source . TODO : add support for 32 - bit addressing
void Systronix_utilities::hex_dump_core (uint16_t address, uint8_t* data_ptr)
	{
	uint8_t*	text_ptr = data_ptr;					
	for (uint8_t i=0; i<16; i++)						
		{
		Serial.printf ("\n%.4X    ", address);
		for (uint8_t j=0; j<8; j++)						
			Serial.printf ("%.2x ", *data_ptr++);
		Serial.print (" -  ");							
		for (uint8_t j=0; j<8; j++)						
			Serial.printf ("%.2x ", *data_ptr++);
		Serial.print ("   ");							
		for (uint8_t j=0; j<16; j++)
			{
			if ((' ' > *text_ptr) || ('~' < *text_ptr))						
				Serial.print ('.');						
			else
				Serial.print ((char)*text_ptr);
			text_ptr++;									
			}
		address += 16;
		address &= 0x7FFF;								
		}
	}
void Systronix_utilities :: hex_dump_core ( uint16_t address , uint8_t * data_ptr ) { uint8_t * text_ptr = data_ptr ; for ( uint8_t i = 0 ; i < 16 ; i ++ ) { Serial . printf ( " \n " , address ) ; for ( uint8_t j = 0 ; j < 8 ; j ++ ) Serial . printf ( " " , * data_ptr ++ ) ; Serial . print ( " " ) ; for ( uint8_t j = 0 ; j < 8 ; j ++ ) Serial . printf ( " " , * data_ptr ++ ) ; Serial . print ( " " ) ; for ( uint8_t j = 0 ; j < 16 ; j ++ ) { if ( ( ' ' > * text_ptr ) || ( ' ' < * text_ptr ) ) Serial . print ( ' ' ) ; else Serial . print ( ( char ) * text_ptr ) ; text_ptr ++ ; } address += 16 ; address &= 0x7FFF ; } }
< H E X _ D U M P _ C O R E >
Render a 'page' (16 rows of 16 columns) of hex data and its character equivalent.
< H E X _ D U M P _ C O R E > Render a ' page ' ( 16 rows of 16 columns ) of hex data and its character equivalent .
// walks in tandem with data_ptr; prints the text // dump 'pages' that are 16 lines of 16 bytes // first half // mid array separator // second half // space between hex and character data // if a control character (0x00-0x1F) // print a dot // bump the pointer // limit to 32k