1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-17 21:30:14 +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 "../Serial/Line.hpp"
#include "../../Outputs/Log.hpp"
namespace MOS::MOS6526 {
@ -82,6 +83,8 @@ template <typename PortHandlerT, Personality personality> class MOS6526:
void advance_counters(int);
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
#include <cassert>
#include <cstdio>
namespace MOS::MOS6526 {
enum Interrupts: uint8_t {
@ -132,13 +129,11 @@ void MOS6526<BusHandlerT, personality>::write(int address, uint8_t value) {
// Shift control.
case 12:
printf("TODO: write to shift register\n");
log.error().append("TODO: write to shift register");
break;
default:
printf("Unhandled 6526 write: %02x to %d\n", value, address);
assert(false);
break;
// Logically unreachable.
default: break;
}
}
@ -179,10 +174,8 @@ uint8_t MOS6526<BusHandlerT, personality>::read(int address) {
// Shift register.
case 12: return shift_data_;
default:
printf("Unhandled 6526 read from %d\n", address);
assert(false);
break;
// Logically unreachable.
default: break;
}
return 0xff;
}

View File

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