1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-19 23:32:28 +00:00

Merge pull request #1332 from TomHarte/NoPrintf

Trim some printfs.
This commit is contained in:
Thomas Harte 2024-02-15 21:18:43 -05:00 committed by GitHub
commit 64bec0cc3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 27 additions and 29 deletions

View File

@ -82,6 +82,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

@ -11,6 +11,7 @@
#include <array> #include <array>
#include "../../../ClockReceiver/ClockReceiver.hpp" #include "../../../ClockReceiver/ClockReceiver.hpp"
#include "../../../Outputs/Log.hpp"
namespace MOS::MOS6526 { namespace MOS::MOS6526 {
@ -220,7 +221,8 @@ struct MOS6526Storage {
control = v; control = v;
if(v&2) { if(v&2) {
printf("UNIMPLEMENTED: PB strobe\n"); Log::Logger<Log::Source::MOS6526> log;
log.error().append("UNIMPLEMENTED: PB strobe");
} }
} }

View File

@ -55,10 +55,6 @@ uint8_t IWM::read(int address) {
logger.info().append("Invalid read\n"); logger.info().append("Invalid read\n");
return 0xff; return 0xff;
// "Read all 1s".
// printf("Reading all 1s\n");
// return 0xff;
case 0: case 0:
case ENABLE: { /* Read data register. Zeroing afterwards is a guess. */ case ENABLE: { /* Read data register. Zeroing afterwards is a guess. */
const auto result = data_register_; const auto result = data_register_;

View File

@ -30,7 +30,6 @@ DoubleDensityDrive::DoubleDensityDrive(int input_clock_rate, bool is_800k) :
// MARK: - Speed Selection // MARK: - Speed Selection
void DoubleDensityDrive::did_step(Storage::Disk::HeadPosition to_position) { void DoubleDensityDrive::did_step(Storage::Disk::HeadPosition to_position) {
// printf("At track %d\n", to_position.as_int());
// The 800kb drive automatically selects rotation speed as a function of // The 800kb drive automatically selects rotation speed as a function of
// head position; the 400kb drive doesn't do so. // head position; the 400kb drive doesn't do so.
if(is_800k_) { if(is_800k_) {

View File

@ -125,13 +125,13 @@ void SCSICard::perform_bus_operation(Select select, bool is_read, uint16_t addre
case 0xb: case 0xb:
if(!is_read) { if(!is_read) {
printf("TODO: NCR reset\n"); logger_.error().append("TODO: NCR reset");
} }
break; break;
case 0xd: case 0xd:
if(!is_read) { if(!is_read) {
printf("TODO: Enable PDMA\n"); logger_.error().append("TODO: Enable PDMA");
} }
break; break;
@ -143,7 +143,7 @@ void SCSICard::perform_bus_operation(Select select, bool is_read, uint16_t addre
break; break;
default: default:
printf("Unhandled: %04x %c %02x\n", address, is_read ? 'r' : 'w', *value); logger_.error().append("Unhandled: %04x %c %02x\n", address, is_read ? 'r' : 'w', *value);
break; break;
} }
break; break;

View File

@ -17,6 +17,8 @@
#include "../../../Storage/MassStorage/SCSI/DirectAccessDevice.hpp" #include "../../../Storage/MassStorage/SCSI/DirectAccessDevice.hpp"
#include "../../../Storage/MassStorage/MassStorageDevice.hpp" #include "../../../Storage/MassStorage/MassStorageDevice.hpp"
#include "../../../Outputs/Log.hpp"
#include <array> #include <array>
#include <memory> #include <memory>
@ -47,6 +49,7 @@ class SCSICard: public Card {
SCSI::Bus scsi_bus_; SCSI::Bus scsi_bus_;
NCR::NCR5380::NCR5380 ncr5380_; NCR::NCR5380::NCR5380 ncr5380_;
SCSI::Target::Target<SCSI::DirectAccessDevice> storage_; SCSI::Target::Target<SCSI::DirectAccessDevice> storage_;
Log::Logger<Log::Source::AppleIISCSICard> logger_;
}; };
} }

View File

@ -16,7 +16,7 @@ using namespace Atari::ST;
namespace { namespace {
Log::Logger<Log::Source::AtariSTDMAController> logger; [[maybe_unused]] Log::Logger<Log::Source::AtariSTDMAController> logger;
enum Control: uint16_t { enum Control: uint16_t {
Direction = 0x100, Direction = 0x100,

View File

@ -28,7 +28,6 @@ void BD500::write(int address, uint8_t value) {
access(address); access(address);
if(address >= 0x0320 && address <= 0x0323) { if(address >= 0x0320 && address <= 0x0323) {
// if(address == 0x320) printf("Command %02x\n", value);
WD::WD1770::write(address, value); WD::WD1770::write(address, value);
} }
@ -69,9 +68,7 @@ void BD500::access(int address) {
case 0x314: enable_overlay_ram_ = true; break; case 0x314: enable_overlay_ram_ = true; break;
case 0x317: disable_basic_rom_ = false; break; case 0x317: disable_basic_rom_ = false; break;
default: default: break;
// printf("Switch %04x???\n", address);
break;
} }
select_paged_item(); select_paged_item();

View File

@ -23,6 +23,7 @@ enum class Source {
AmigaCopper, AmigaCopper,
AmigaChipset, AmigaChipset,
AmigaBlitter, AmigaBlitter,
AppleIISCSICard,
AtariST, AtariST,
AtariSTDMAController, AtariSTDMAController,
CommodoreStaticAnalyser, CommodoreStaticAnalyser,
@ -36,6 +37,7 @@ enum class Source {
MasterSystem, MasterSystem,
MultiMachine, MultiMachine,
MFP68901, MFP68901,
MOS6526,
MSX, MSX,
NCR5380, NCR5380,
OpenGL, OpenGL,
@ -64,10 +66,13 @@ constexpr bool is_enabled(Source source) {
case Source::AmigaChipset: case Source::AmigaChipset:
case Source::AmigaCopper: case Source::AmigaCopper:
case Source::AmigaDisk: case Source::AmigaDisk:
case Source::DirectAccessDevice:
case Source::IWM: case Source::IWM:
case Source::MFP68901: case Source::MFP68901:
case Source::NCR5380: case Source::NCR5380:
case Source::SCC: return false; case Source::SCC:
case Source::SCSI:
return false;
} }
} }
@ -81,9 +86,11 @@ constexpr const char *prefix(Source source) {
case Source::AmigaChipset: return "Chipset"; case Source::AmigaChipset: return "Chipset";
case Source::AmigaCopper: return "Copper"; case Source::AmigaCopper: return "Copper";
case Source::AmigaDisk: return "Disk"; case Source::AmigaDisk: return "Disk";
case Source::AppleIISCSICard: return "SCSI card";
case Source::AtariST: return "AtariST"; case Source::AtariST: return "AtariST";
case Source::AtariSTDMAController: return "DMA"; case Source::AtariSTDMAController: return "DMA";
case Source::CommodoreStaticAnalyser: return "Commodore Static Analyser"; case Source::CommodoreStaticAnalyser: return "Commodore Static Analyser";
case Source::DirectAccessDevice: return "Direct Access Device";
case Source::Enterprise: return "Enterprise"; case Source::Enterprise: return "Enterprise";
case Source::i8272: return "i8272"; case Source::i8272: return "i8272";
case Source::IntelligentKeyboard: return "IKYB"; case Source::IntelligentKeyboard: return "IKYB";
@ -91,6 +98,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 +120,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) {