| 1 |
#ifndef DEBUGDEVICE_HH |
| 2 |
#define DEBUGDEVICE_HH |
| 3 |
|
| 4 |
#include "FilenameSetting.hh" |
| 5 |
#include "MSXDevice.hh" |
| 6 |
|
| 7 |
#include <cstdint> |
| 8 |
#include <fstream> |
| 9 |
|
| 10 |
namespace openmsx { |
| 11 |
|
| 12 |
class DebugDevice final : public MSXDevice |
| 13 |
{ |
| 14 |
public: |
| 15 |
explicit DebugDevice(const DeviceConfig& config); |
| 16 |
|
| 17 |
void reset(EmuTime time) override; |
| 18 |
void writeIO(uint16_t port, byte value, EmuTime time) override; |
| 19 |
|
| 20 |
template<typename Archive> |
| 21 |
void serialize(Archive& ar, unsigned version); |
| 22 |
|
| 23 |
|
| 24 |
enum class Mode : uint8_t {OFF, SINGLEBYTE, MULTIBYTE, ASCII}; |
| 25 |
|
| 26 |
private: |
| 27 |
enum class DisplayType : uint8_t {HEX, BIN, DEC, ASC}; |
| 28 |
|
| 29 |
void outputSingleByte(byte value, EmuTime time); |
| 30 |
void outputMultiByte(byte value); |
| 31 |
void displayByte(byte value, DisplayType type); |
| 32 |
void openOutput(std::string_view name); |
| 33 |
|
| 34 |
private: |
| 35 |
FilenameSetting fileNameSetting; |
| 36 |
std::ostream* outputStrm; |
| 37 |
std::ofstream debugOut; |
| 38 |
std::string fileNameString; |
| 39 |
Mode mode; |
| 40 |
byte modeParameter; |
| 41 |
}; |
| 42 |
|
| 43 |
} |
| 44 |
|
| 45 |
#endif |