1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-08-09 05:25:01 +00:00

Eliminate use of printf.

This commit is contained in:
Thomas Harte
2024-02-15 13:32:49 -05:00
parent be99183f1d
commit b4a3b23571
3 changed files with 10 additions and 14 deletions

View File

@@ -12,6 +12,7 @@
#include "Implementation/6526Storage.hpp" #include "Implementation/6526Storage.hpp"
#include "../Serial/Line.hpp" #include "../Serial/Line.hpp"
#include "../../Outputs/Log.hpp"
namespace MOS::MOS6526 { namespace MOS::MOS6526 {
@@ -82,6 +83,8 @@ template <typename PortHandlerT, Personality personality> class MOS6526:
void advance_counters(int); void advance_counters(int);
bool serial_line_did_produce_bit(Serial::Line<true> *line, int bit) final; bool serial_line_did_produce_bit(Serial::Line<true> *line, int bit) final;
Log::Logger<Log::Source::MOS6526> log;
}; };
} }

View File

@@ -8,9 +8,6 @@
#pragma once #pragma once
#include <cassert>
#include <cstdio>
namespace MOS::MOS6526 { namespace MOS::MOS6526 {
enum Interrupts: uint8_t { enum Interrupts: uint8_t {
@@ -132,13 +129,11 @@ void MOS6526<BusHandlerT, personality>::write(int address, uint8_t value) {
// Shift control. // Shift control.
case 12: case 12:
printf("TODO: write to shift register\n"); log.error().append("TODO: write to shift register");
break; break;
default: // Logically unreachable.
printf("Unhandled 6526 write: %02x to %d\n", value, address); default: break;
assert(false);
break;
} }
} }
@@ -179,10 +174,8 @@ uint8_t MOS6526<BusHandlerT, personality>::read(int address) {
// Shift register. // Shift register.
case 12: return shift_data_; case 12: return shift_data_;
default: // Logically unreachable.
printf("Unhandled 6526 read from %d\n", address); default: break;
assert(false);
break;
} }
return 0xff; return 0xff;
} }

View File

@@ -36,6 +36,7 @@ enum class Source {
MasterSystem, MasterSystem,
MultiMachine, MultiMachine,
MFP68901, MFP68901,
MOS6526,
MSX, MSX,
NCR5380, NCR5380,
OpenGL, OpenGL,
@@ -91,6 +92,7 @@ constexpr const char *prefix(Source source) {
case Source::M50740: return "M50740"; case Source::M50740: return "M50740";
case Source::Macintosh: return "Macintosh"; case Source::Macintosh: return "Macintosh";
case Source::MasterSystem: return "SMS"; case Source::MasterSystem: return "SMS";
case Source::MOS6526: return "MOS6526";
case Source::MFP68901: return "MFP68901"; case Source::MFP68901: return "MFP68901";
case Source::MultiMachine: return "Multi-machine"; case Source::MultiMachine: return "Multi-machine";
case Source::MSX: return "MSX"; case Source::MSX: return "MSX";
@@ -112,8 +114,6 @@ class Logger {
public: public:
static constexpr bool enabled = is_enabled(source); static constexpr bool enabled = is_enabled(source);
Logger() {}
struct LogLine { struct LogLine {
public: public:
LogLine(FILE *stream) : stream_(stream) { LogLine(FILE *stream) : stream_(stream) {