mirror of
				https://github.com/davidgiven/fluxengine.git
				synced 2025-10-24 11:11:02 -07:00 
			
		
		
		
	CRC checking!) most of the Zilog MCS disk. However, we're still stumped by the extra index hole.
		
			
				
	
	
		
			42 lines
		
	
	
		
			742 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			742 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "globals.h"
 | |
| #include "bytes.h"
 | |
| #include "fmt/format.h"
 | |
| 
 | |
| void hexdump(std::ostream& stream, const Bytes& buffer)
 | |
| {
 | |
| 	size_t pos = 0;
 | |
| 
 | |
| 	while (pos < buffer.size())
 | |
| 	{
 | |
| 		stream << fmt::format("{:05x} : ", pos);
 | |
| 		for (int i=0; i<16; i++)
 | |
| 		{
 | |
| 			if ((pos+i) < buffer.size())
 | |
| 				stream << fmt::format("{:02x} ", buffer[pos+i]);
 | |
| 			else
 | |
| 				stream << "-- ";
 | |
| 		}
 | |
| 		stream << " : ";
 | |
| 		for (int i=0; i<16; i++)
 | |
| 		{
 | |
| 			if ((pos+i) >= buffer.size())
 | |
| 				break;
 | |
| 
 | |
| 			uint8_t c = buffer[pos+i];
 | |
| 			stream << (isprint(c) ? (char)c : '.');
 | |
| 		}
 | |
| 		stream << std::endl;
 | |
| 
 | |
| 		pos += 16;
 | |
| 	}
 | |
| }
 | |
| 
 | |
| void hexdumpForSrp16(std::ostream& stream, const Bytes& buffer)
 | |
| {
 | |
| 	for (uint8_t byte : buffer)
 | |
| 		stream << fmt::format("{:02x}", byte);
 | |
| 	stream << std::endl;
 | |
| }
 | |
| 
 | |
| 
 |