1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-26 03:29:40 +00:00

Definitively eliminate per-logger state.

This commit is contained in:
Thomas Harte
2025-09-11 23:29:47 -04:00
parent 53cc8ecaf0
commit 105272630e
53 changed files with 382 additions and 399 deletions
@@ -12,9 +12,7 @@
#include <algorithm>
namespace {
Log::Logger<Log::Source::MultiMachine> logger;
using Logger = Log::Logger<Log::Source::MultiMachine>;
}
using namespace Analyser::Dynamic;
@@ -71,8 +69,8 @@ bool MultiMachine::would_collapse(const std::vector<std::unique_ptr<DynamicMachi
void MultiMachine::did_run_machines(MultiTimedMachine &) {
std::lock_guard machines_lock(machines_mutex_);
if constexpr (logger.InfoEnabled) {
auto line = logger.info();
if constexpr (Logger::InfoEnabled) {
auto line = Logger::info();
for(const auto &machine: machines_) {
auto timed_machine = machine->timed_machine();
line.append("%0.4f %s; ", timed_machine->get_confidence(), timed_machine->debug_type().c_str());
+1 -1
View File
@@ -258,7 +258,7 @@ analyse_starting_address(uint16_t starting_address) {
case 0x1c01:
// TODO: assume C128.
default:
Log::Logger<Log::Source::CommodoreStaticAnalyser>().error().append(
Log::Logger<Log::Source::CommodoreStaticAnalyser>::error().append(
"Unrecognised loading address for Commodore program: %04x", starting_address);
[[fallthrough]];
case 0x1001:
+19 -19
View File
@@ -12,7 +12,7 @@
#include "Outputs/Log.hpp"
namespace {
Log::Logger<Log::Source::WDFDC> logger;
using Logger = Log::Logger<Log::Source::WDFDC>;
}
using namespace WD;
@@ -31,10 +31,10 @@ void WD1770::write(const int address, const uint8_t value) {
if((value&0xf0) == 0xd0) {
if(value == 0xd0) {
// Force interrupt **immediately**.
logger.info().append("Force interrupt immediately");
Logger::info().append("Force interrupt immediately");
posit_event(int(Event1770::ForceInterrupt));
} else {
logger.error().append("TODO: force interrupt");
Logger::error().append("TODO: force interrupt");
update_status([] (Status &status) {
status.type = Status::One;
});
@@ -101,14 +101,14 @@ uint8_t WD1770::read(const int address) {
if(status_.type == Status::One)
status |= (status_.spin_up ? Flag::SpinUp : 0);
}
// logger.info().append("Returned status %02x of type %d", status, 1+int(status_.type));
// Logger::info().append("Returned status %02x of type %d", status, 1+int(status_.type));
return status;
}
case 1:
logger.info().append("Returned track %d", track_);
Logger::info().append("Returned track %d", track_);
return track_;
case 2:
logger.info().append("Returned sector %d", sector_);
Logger::info().append("Returned sector %d", sector_);
return sector_;
case 3:
update_status([] (Status &status) {
@@ -216,7 +216,7 @@ void WD1770::posit_event(const int new_event_type) {
// Wait for a new command, branch to the appropriate handler.
case 0:
wait_for_command:
logger.info().append("Idle...");
Logger::info().append("Idle...");
set_data_mode(DataMode::Scanning);
index_hole_count_ = 0;
@@ -233,7 +233,7 @@ void WD1770::posit_event(const int new_event_type) {
status.track_zero = false; // Always reset by a non-type 1; so reset regardless and set properly later.
});
logger.info().append("Starting %02x", command_);
Logger::info().append("Starting %02x", command_);
if(!(command_ & 0x80)) goto begin_type_1;
if(!(command_ & 0x40)) goto begin_type_2;
@@ -263,7 +263,7 @@ void WD1770::posit_event(const int new_event_type) {
status.data_request = false;
});
logger.info().append("Step/Seek/Restore with track %d data %d", track_, data_);
Logger::info().append("Step/Seek/Restore with track %d data %d", track_, data_);
if(!has_motor_on_line() && !has_head_load_line()) goto test_type1_type;
if(has_motor_on_line()) goto begin_type1_spin_up;
@@ -343,7 +343,7 @@ void WD1770::posit_event(const int new_event_type) {
READ_ID();
if(index_hole_count_ == 6) {
logger.info().append("Nothing found to verify");
Logger::info().append("Nothing found to verify");
update_status([] (Status &status) {
status.seek_error = true;
});
@@ -361,7 +361,7 @@ void WD1770::posit_event(const int new_event_type) {
}
if(header_[0] == track_) {
logger.info().append("Reached track %d", track_);
Logger::info().append("Reached track %d", track_);
update_status([] (Status &status) {
status.crc_error = false;
});
@@ -434,7 +434,7 @@ void WD1770::posit_event(const int new_event_type) {
READ_ID();
if(index_hole_count_ == 5) {
logger.info().append("Failed to find sector %d", sector_);
Logger::info().append("Failed to find sector %d", sector_);
update_status([] (Status &status) {
status.record_not_found = true;
});
@@ -444,12 +444,12 @@ void WD1770::posit_event(const int new_event_type) {
distance_into_section_ = 0;
set_data_mode(DataMode::Scanning);
logger.info().append("Considering %d/%d", header_[0], header_[2]);
Logger::info().append("Considering %d/%d", header_[0], header_[2]);
if( header_[0] == track_ && header_[2] == sector_ &&
(has_motor_on_line() || !(command_&0x02) || ((command_&0x08) >> 3) == header_[1])) {
logger.info().append("Found %d/%d", header_[0], header_[2]);
Logger::info().append("Found %d/%d", header_[0], header_[2]);
if(get_crc_generator().get_value()) {
logger.info().append("CRC error; back to searching");
Logger::info().append("CRC error; back to searching");
update_status([] (Status &status) {
status.crc_error = true;
});
@@ -507,18 +507,18 @@ void WD1770::posit_event(const int new_event_type) {
set_data_mode(DataMode::Scanning);
if(get_crc_generator().get_value()) {
logger.info().append("CRC error; terminating");
Logger::info().append("CRC error; terminating");
update_status([] (Status &status) {
status.crc_error = true;
});
goto wait_for_command;
}
logger.info().append("Finished reading sector %d", sector_);
Logger::info().append("Finished reading sector %d", sector_);
if(command_ & 0x10) {
sector_++;
logger.info().append("Advancing to search for sector %d", sector_);
Logger::info().append("Advancing to search for sector %d", sector_);
goto test_type2_write_protection;
}
goto wait_for_command;
@@ -602,7 +602,7 @@ void WD1770::posit_event(const int new_event_type) {
sector_++;
goto test_type2_write_protection;
}
logger.info().append("Wrote sector %d", sector_);
Logger::info().append("Wrote sector %d", sector_);
goto wait_for_command;
+17 -17
View File
@@ -11,7 +11,7 @@
#include "Outputs/Log.hpp"
namespace {
Log::Logger<Log::Source::NCR5380> logger;
using Logger = Log::Logger<Log::Source::NCR5380>;
}
// TODO:
//
@@ -36,7 +36,7 @@ NCR5380::NCR5380(SCSI::Bus &bus, const int clock_rate) :
void NCR5380::write(const int address, const uint8_t value, bool) {
switch(address & 7) {
case 0:
logger.info().append("[0] Set current SCSI bus state to %02x", value);
Logger::info().append("[0] Set current SCSI bus state to %02x", value);
data_bus_ = value;
if(dma_request_ && dma_operation_ == DMAOperation::Send) {
@@ -45,7 +45,7 @@ void NCR5380::write(const int address, const uint8_t value, bool) {
break;
case 1: {
logger.info().append("[1] Initiator command register set: %02x", value);
Logger::info().append("[1] Initiator command register set: %02x", value);
initiator_command_ = value;
bus_output_ &= ~(Line::Reset | Line::Acknowledge | Line::Busy | Line::SelectTarget | Line::Attention);
@@ -61,7 +61,7 @@ void NCR5380::write(const int address, const uint8_t value, bool) {
} break;
case 2:
logger.info().append("[2] Set mode: %02x", value);
Logger::info().append("[2] Set mode: %02x", value);
mode_ = value;
// bit 7: 1 = use block mode DMA mode (if DMA mode is also enabled)
@@ -102,27 +102,27 @@ void NCR5380::write(const int address, const uint8_t value, bool) {
break;
case 3:
logger.info().append("[3] Set target command: %02x", value);
Logger::info().append("[3] Set target command: %02x", value);
target_command_ = value;
update_control_output();
break;
case 4:
logger.info().append("[4] Set select enabled: %02x", value);
Logger::info().append("[4] Set select enabled: %02x", value);
break;
case 5:
logger.info().append("[5] Start DMA send: %02x", value);
Logger::info().append("[5] Start DMA send: %02x", value);
dma_operation_ = DMAOperation::Send;
break;
case 6:
logger.info().append("[6] Start DMA target receive: %02x", value);
Logger::info().append("[6] Start DMA target receive: %02x", value);
dma_operation_ = DMAOperation::TargetReceive;
break;
case 7:
logger.info().append("[7] Start DMA initiator receive: %02x", value);
Logger::info().append("[7] Start DMA initiator receive: %02x", value);
dma_operation_ = DMAOperation::InitiatorReceive;
break;
}
@@ -146,7 +146,7 @@ void NCR5380::write(const int address, const uint8_t value, bool) {
uint8_t NCR5380::read(const int address, bool) {
switch(address & 7) {
case 0:
logger.info().append("[0] Get current SCSI bus state: %02x", (bus_.state() & 0xff));
Logger::info().append("[0] Get current SCSI bus state: %02x", (bus_.state() & 0xff));
if(dma_request_ && dma_operation_ == DMAOperation::InitiatorReceive) {
return dma_acknowledge();
@@ -154,7 +154,7 @@ uint8_t NCR5380::read(const int address, bool) {
return uint8_t(bus_.state());
case 1:
logger.info().append(
Logger::info().append(
"[1] Initiator command register get: %c%c",
arbitration_in_progress_ ? 'p' : '-',
lost_arbitration_ ? 'l' : '-');
@@ -169,11 +169,11 @@ uint8_t NCR5380::read(const int address, bool) {
(lost_arbitration_ ? 0x20 : 0x00);
case 2:
logger.info().append("[2] Get mode");
Logger::info().append("[2] Get mode");
return mode_;
case 3:
logger.info().append("[3] Get target command");
Logger::info().append("[3] Get target command");
return target_command_;
case 4: {
@@ -187,7 +187,7 @@ uint8_t NCR5380::read(const int address, bool) {
((bus_state & Line::Input) ? 0x04 : 0x00) |
((bus_state & Line::SelectTarget) ? 0x02 : 0x00) |
((bus_state & Line::Parity) ? 0x01 : 0x00);
logger.info().append("[4] Get current bus state: %02x", result);
Logger::info().append("[4] Get current bus state: %02x", result);
return result;
}
@@ -202,16 +202,16 @@ uint8_t NCR5380::read(const int address, bool) {
/* b2 = busy error */
((bus_state & Line::Attention) ? 0x02 : 0x00) |
((bus_state & Line::Acknowledge) ? 0x01 : 0x00);
logger.info().append("[5] Get bus and status: %02x", result);
Logger::info().append("[5] Get bus and status: %02x", result);
return result;
}
case 6:
logger.info().append("[6] Get input data");
Logger::info().append("[6] Get input data");
return 0xff;
case 7:
logger.info().append("[7] Reset parity/interrupt");
Logger::info().append("[7] Reset parity/interrupt");
irq_ = false;
return 0xff;
}
+1 -1
View File
@@ -83,7 +83,7 @@ private:
bool serial_line_did_produce_bit(Serial::Line<true> *line, int bit) final;
Log::Logger<Log::Source::MOS6526> log;
using Logger = Log::Logger<Log::Source::MOS6526>;
};
}
@@ -129,7 +129,7 @@ void MOS6526<BusHandlerT, personality>::write(int address, const uint8_t value)
// Shift control.
case 12:
log.error().append("TODO: write to shift register");
Logger::error().append("TODO: write to shift register");
break;
// Logically unreachable.
@@ -221,8 +221,7 @@ struct MOS6526Storage {
control = v;
if(v&2) {
Log::Logger<Log::Source::MOS6526> log;
log.error().append("UNIMPLEMENTED: PB strobe");
Log::Logger<Log::Source::MOS6526>::error().append("UNIMPLEMENTED: PB strobe");
}
}
+13 -15
View File
@@ -14,9 +14,7 @@
#include "Outputs/Log.hpp"
namespace {
Log::Logger<Log::Source::MFP68901> logger;
using Logger = Log::Logger<Log::Source::MFP68901>;
}
using namespace Motorola::MFP68901;
@@ -65,11 +63,11 @@ uint8_t MFP68901::read(int address) {
case 0x11: case 0x12: return get_timer_data(address - 0xf);
// USART block: TODO.
case 0x13: logger.error().append("Read: sync character generator"); break;
case 0x14: logger.error().append("Read: USART control"); break;
case 0x15: logger.error().append("Read: receiver status"); break;
case 0x16: logger.error().append("Read: transmitter status"); break;
case 0x17: logger.error().append("Read: USART data"); break;
case 0x13: Logger::error().append("Read: sync character generator"); break;
case 0x14: Logger::error().append("Read: USART control"); break;
case 0x15: Logger::error().append("Read: receiver status"); break;
case 0x16: Logger::error().append("Read: transmitter status"); break;
case 0x17: Logger::error().append("Read: USART data"); break;
}
return 0x00;
}
@@ -170,11 +168,11 @@ void MFP68901::write(int address, const uint8_t value) {
break;
// USART block: TODO.
case 0x13: logger.error().append("Write: sync character generator"); break;
case 0x14: logger.error().append("Write: USART control"); break;
case 0x15: logger.error().append("Write: receiver status"); break;
case 0x16: logger.error().append("Write: transmitter status"); break;
case 0x17: logger.error().append("Write: USART data"); break;
case 0x13: Logger::error().append("Write: sync character generator"); break;
case 0x14: Logger::error().append("Write: USART control"); break;
case 0x15: Logger::error().append("Write: receiver status"); break;
case 0x16: Logger::error().append("Write: transmitter status"); break;
case 0x17: Logger::error().append("Write: USART data"); break;
}
update_clocking_observer();
@@ -221,7 +219,7 @@ HalfCycles MFP68901::next_sequence_point() {
// MARK: - Timers
void MFP68901::set_timer_mode(const int timer, const TimerMode mode, const int prescale, const bool reset_timer) {
logger.error().append("Timer %d mode set: %d; prescale: %d", timer, mode, prescale);
Logger::error().append("Timer %d mode set: %d; prescale: %d", timer, mode, prescale);
timers_[timer].mode = mode;
if(reset_timer) {
timers_[timer].prescale_count = 0;
@@ -399,7 +397,7 @@ int MFP68901::acknowledge_interrupt() {
int selected = 0;
while((1 << selected) != mask) ++selected;
// logger.error().append("Interrupt acknowledged: %d", selected);
// Logger::error().append("Interrupt acknowledged: %d", selected);
return (interrupt_vector_ & 0xf0) | uint8_t(selected);
}
+23 -23
View File
@@ -11,7 +11,7 @@
#include "Outputs/Log.hpp"
namespace {
Log::Logger<Log::Source::i8272> logger;
using Logger = Log::Logger<Log::Source::i8272>;
constexpr int ms_to_cycles(const int x) { return x * 8000; }
}
@@ -59,7 +59,7 @@ void i8272::run_for(const Cycles cycles) {
while(steps--) {
// Perform a step.
int direction = (drives_[c].target_head_position < drives_[c].head_position) ? -1 : 1;
logger.info().append(
Logger::info().append(
"Target %d versus believed %d", drives_[c].target_head_position, drives_[c].head_position);
select_drive(c);
get_drive().step(Storage::Disk::HeadPosition(direction));
@@ -324,17 +324,17 @@ void i8272::posit_event(const int event_type) {
// the index hole limit is breached or a sector is found with a cylinder, head, sector and size equal to the
// values in the internal registers.
index_hole_limit_ = 2;
// logger.info().append("Seeking " << PADDEC(0) << cylinder_ << " " << head_ " " << sector_ << " " << size_);
// Logger::info().append("Seeking " << PADDEC(0) << cylinder_ << " " << head_ " " << sector_ << " " << size_);
find_next_sector:
FIND_HEADER();
if(!index_hole_limit_) {
// Two index holes have passed wihout finding the header sought.
// logger.info().append("Not found");
// Logger::info().append("Not found");
status_.set(Status1::NoData);
goto abort;
}
index_hole_count_ = 0;
// logger.info().append("Header");
// Logger::info().append("Header");
READ_HEADER();
if(index_hole_count_) {
// This implies an index hole was sighted within the header. Error out.
@@ -345,7 +345,7 @@ void i8272::posit_event(const int event_type) {
// This implies a CRC error in the header; mark as such but continue.
status_.set(Status1::DataError);
}
// logger.info().append(
// Logger::info().append(
// "Considering %02x %02x %02x %02x [%04x]",
// header_[0], header_[1], header_[2], header_[3], get_crc_generator().get_value());
if(header_[0] != cylinder_ || header_[1] != head_ || header_[2] != sector_ || header_[3] != size_) {
@@ -353,7 +353,7 @@ void i8272::posit_event(const int event_type) {
}
// Branch to whatever is supposed to happen next
// logger.info().append("Proceeding");
// Logger::info().append("Proceeding");
switch(command_.command()) {
default:
case Command::ReadData:
@@ -368,7 +368,7 @@ void i8272::posit_event(const int event_type) {
// Performs the read data or read deleted data command.
read_data:
// logger.info().append("Read [deleted] data [%02x %02x %02x %02x ... %02x %02x]",
// Logger::info().append("Read [deleted] data [%02x %02x %02x %02x ... %02x %02x]",
// command_[2],
// command_[3],
// command_[4],
@@ -458,7 +458,7 @@ void i8272::posit_event(const int event_type) {
goto post_st012chrn;
write_data:
// logger.info().append("Write [deleted] data [%02x %02x %02x %02x ... %02x %02x]",
// Logger::info().append("Write [deleted] data [%02x %02x %02x %02x ... %02x %02x]",
// command_[2],
// command_[3],
// command_[4],
@@ -499,7 +499,7 @@ void i8272::posit_event(const int event_type) {
goto write_loop;
}
logger.info().append("Wrote %d bytes", distance_into_section_);
Logger::info().append("Wrote %d bytes", distance_into_section_);
write_crc();
expects_input_ = false;
WAIT_FOR_EVENT(Event::DataWritten);
@@ -515,7 +515,7 @@ void i8272::posit_event(const int event_type) {
// Performs the read ID command.
read_id:
// Establishes the drive and head being addressed, and whether in double density mode.
// logger.info().append("Read ID [%02x %02x]", command_[0], command_[1]);
// Logger::info().append("Read ID [%02x %02x]", command_[0], command_[1]);
// Sets a maximum index hole limit of 2 then waits either until it finds a header mark or sees too many
// index holes. If a header mark is found, reads in the following bytes that produce a header. Otherwise
@@ -538,7 +538,7 @@ void i8272::posit_event(const int event_type) {
// Performs read track.
read_track:
// logger.info().append("Read track [%02x %02x %02x %02x]"
// Logger::info().append("Read track [%02x %02x %02x %02x]"
// command_[2],
// command_[3],
// command_[4],
@@ -583,7 +583,7 @@ void i8272::posit_event(const int event_type) {
// Performs format [/write] track.
format_track:
logger.info().append("Format track");
Logger::info().append("Format track");
if(get_drive().is_read_only()) {
status_.set(Status1::NotWriteable);
goto abort;
@@ -627,7 +627,7 @@ void i8272::posit_event(const int event_type) {
break;
}
logger.info().append("W: %02x %02x %02x %02x, %04x",
Logger::info().append("W: %02x %02x %02x %02x, %04x",
header_[0], header_[1], header_[2], header_[3], get_crc_generator().get_value());
write_crc();
@@ -660,15 +660,15 @@ void i8272::posit_event(const int event_type) {
goto post_st012chrn;
scan_low:
logger.error().append("Scan low unimplemented!!");
Logger::error().append("Scan low unimplemented!!");
goto wait_for_command;
scan_low_or_equal:
logger.error().append("Scan low or equal unimplemented!!");
Logger::error().append("Scan low or equal unimplemented!!");
goto wait_for_command;
scan_high_or_equal:
logger.error().append("Scan high or equal unimplemented!!");
Logger::error().append("Scan high or equal unimplemented!!");
goto wait_for_command;
// Performs both recalibrate and seek commands. These commands occur asynchronously, so the actual work
@@ -699,11 +699,11 @@ void i8272::posit_event(const int event_type) {
// up in run_for understands to mean 'keep going until track 0 is active').
if(command_.command() != Command::Recalibrate) {
drives_[drive].target_head_position = command_.seek_target();
logger.info().append("Seek to %d", command_.seek_target());
Logger::info().append("Seek to %d", command_.seek_target());
} else {
drives_[drive].target_head_position = -1;
drives_[drive].head_position = 0;
logger.info().append("Recalibrate");
Logger::info().append("Recalibrate");
}
// Check whether any steps are even needed; if not then mark as completed already.
@@ -716,7 +716,7 @@ void i8272::posit_event(const int event_type) {
// Performs sense interrupt status.
sense_interrupt_status:
logger.info().append("Sense interrupt status");
Logger::info().append("Sense interrupt status");
{
// Find the first drive that is in the CompletedSeeking state.
int found_drive = -1;
@@ -744,7 +744,7 @@ void i8272::posit_event(const int event_type) {
// Performs specify.
specify:
// Just store the values, and terminate the command.
logger.info().append("Specify");
Logger::info().append("Specify");
step_rate_time_ = command_.specify_specs().step_rate_time;
head_unload_time_ = command_.specify_specs().head_unload_time;
head_load_time_ = command_.specify_specs().head_load_time;
@@ -755,7 +755,7 @@ void i8272::posit_event(const int event_type) {
goto wait_for_command;
sense_drive_status:
logger.info().append("Sense drive status");
Logger::info().append("Sense drive status");
{
int drive = command_.target().drive;
select_drive(drive);
@@ -795,7 +795,7 @@ void i8272::posit_event(const int event_type) {
// last thing in it will be returned first.
post_result:
// {
// auto line = logger.info();
// auto line = Logger::info();
// line.append("Result to %02x, main %02x", command_[0] & 0x1f, main_status_);
// for(std::size_t c = 0; c < result_stack_.size(); c++) {
// line.append(" %02x", result_stack_[result_stack_.size() - 1 - c]);
+18 -20
View File
@@ -13,9 +13,7 @@
using namespace Zilog::SCC;
namespace {
Log::Logger<Log::Source::SCC> logger;
using Logger = Log::Logger<Log::Source::SCC>;
}
void z8530::reset() {
@@ -54,7 +52,7 @@ std::uint8_t z8530::read(const int address) {
case 2: // Handled non-symmetrically between channels.
if(address & 1) {
logger.error().append("Unimplemented: register 2 status bits");
Logger::error().append("Unimplemented: register 2 status bits");
} else {
result = interrupt_vector_;
@@ -111,11 +109,11 @@ void z8530::write(const int address, const std::uint8_t value) {
case 2: // Interrupt vector register; used only by Channel B.
// So there's only one of these.
interrupt_vector_ = value;
logger.info().append("Interrupt vector set to %d", value);
Logger::info().append("Interrupt vector set to %d", value);
break;
case 9: // Master interrupt and reset register; there is also only one of these.
logger.info().append("Master interrupt and reset register: %02x", value);
Logger::info().append("Master interrupt and reset register: %02x", value);
master_interrupt_control_ = value;
break;
}
@@ -152,7 +150,7 @@ uint8_t z8530::Channel::read(const bool data, const uint8_t pointer) {
if(data) {
return data_;
} else {
logger.info().append("Control read from register %d", pointer);
Logger::info().append("Control read from register %d", pointer);
// Otherwise, this is a control read...
switch(pointer) {
default:
@@ -237,10 +235,10 @@ void z8530::Channel::write(const bool data, const uint8_t pointer, const uint8_t
data_ = value;
return;
} else {
logger.info().append("Control write: %02x to register %d", value, pointer);
Logger::info().append("Control write: %02x to register %d", value, pointer);
switch(pointer) {
default:
logger.info().append("Unrecognised control write: %02x to register %d", value, pointer);
Logger::info().append("Unrecognised control write: %02x to register %d", value, pointer);
break;
case 0x0: // Write register 0 — CRC reset and other functions.
@@ -248,13 +246,13 @@ void z8530::Channel::write(const bool data, const uint8_t pointer, const uint8_t
switch(value >> 6) {
default: /* Do nothing. */ break;
case 1:
logger.error().append("TODO: reset Rx CRC checker.");
Logger::error().append("TODO: reset Rx CRC checker.");
break;
case 2:
logger.error().append("TODO: reset Tx CRC checker.");
Logger::error().append("TODO: reset Tx CRC checker.");
break;
case 3:
logger.error().append("TODO: reset Tx underrun/EOM latch.");
Logger::error().append("TODO: reset Tx underrun/EOM latch.");
break;
}
@@ -262,24 +260,24 @@ void z8530::Channel::write(const bool data, const uint8_t pointer, const uint8_t
switch((value >> 3)&7) {
default: /* Do nothing. */ break;
case 2:
// logger.info().append("reset ext/status interrupts.");
// Logger::info().append("reset ext/status interrupts.");
external_status_interrupt_ = false;
external_interrupt_status_ = 0;
break;
case 3:
logger.error().append("TODO: send abort (SDLC).");
Logger::error().append("TODO: send abort (SDLC).");
break;
case 4:
logger.error().append("TODO: enable interrupt on next Rx character.");
Logger::error().append("TODO: enable interrupt on next Rx character.");
break;
case 5:
logger.error().append("TODO: reset Tx interrupt pending.");
Logger::error().append("TODO: reset Tx interrupt pending.");
break;
case 6:
logger.error().append("TODO: reset error.");
Logger::error().append("TODO: reset error.");
break;
case 7:
logger.error().append("TODO: reset highest IUS.");
Logger::error().append("TODO: reset highest IUS.");
break;
}
break;
@@ -304,7 +302,7 @@ void z8530::Channel::write(const bool data, const uint8_t pointer, const uint8_t
b1 = 1 => transmit buffer empty interrupt is enabled; 0 => it isn't.
b0 = 1 => external interrupt is enabled; 0 => it isn't.
*/
logger.info().append("Interrupt mask: %02x", value);
Logger::info().append("Interrupt mask: %02x", value);
break;
case 0x2: // Write register 2 - interrupt vector.
@@ -319,7 +317,7 @@ void z8530::Channel::write(const bool data, const uint8_t pointer, const uint8_t
case 2: receive_bit_count = 6; break;
case 3: receive_bit_count = 8; break;
}
logger.info().append("Receive bit count: %d", receive_bit_count);
Logger::info().append("Receive bit count: %d", receive_bit_count);
/*
b7,b6:
+5 -5
View File
@@ -23,7 +23,7 @@ namespace {
constexpr unsigned int CRTCyclesPerLine = 1365;
constexpr unsigned int CRTCyclesDivider = 4;
Log::Logger<Log::Source::TMS9918> logger;
using Logger = Log::Logger<Log::Source::TMS9918>;
}
@@ -843,7 +843,7 @@ void Base<personality>::commit_register(int reg, const uint8_t value) {
Storage<personality>::solid_background_ = value & 0x20;
Storage<personality>::sprites_enabled_ = !(value & 0x02);
if(value & 0x01) {
logger.error().append("TODO: Yamaha greyscale");
Logger::error().append("TODO: Yamaha greyscale");
}
// b7: "1 = input on colour bus, enable mouse; 1 = output on colour bus, disable mouse" [documentation clearly in error]
// b6: 1 = enable light pen
@@ -860,7 +860,7 @@ void Base<personality>::commit_register(int reg, const uint8_t value) {
// TODO: on the Yamaha, at least, tie this interrupt overtly to vertical state.
if(value & 0x08) {
logger.error().append("TODO: Yamaha interlace mode");
Logger::error().append("TODO: Yamaha interlace mode");
}
// b7: 1 = 212 lines of pixels; 0 = 192
@@ -924,7 +924,7 @@ void Base<personality>::commit_register(int reg, const uint8_t value) {
case 20:
case 21:
case 22:
// logger.error().append("TODO: Yamaha colour burst selection; %02x", value);
// Logger::error().append("TODO: Yamaha colour burst selection; %02x", value);
// Documentation is "fill with 0s for no colour burst; magic pattern for colour burst"
break;
@@ -1010,7 +1010,7 @@ void Base<personality>::commit_register(int reg, const uint8_t value) {
// Kill the command immediately if it's done in zero operations
// (e.g. a line of length 0).
if(!Storage<personality>::command_ && (value >> 4)) {
logger.error().append("TODO: Yamaha command %02x", value);
Logger::error().append("TODO: Yamaha command %02x", value);
}
// Seed timing information if a command was found.
+18 -18
View File
@@ -24,7 +24,7 @@ namespace {
constexpr int SEL = 1 << 8; /* This is an additional input, not available on a Disk II, with a
confusingly-similar name to SELECT but a distinct purpose. */
Log::Logger<Log::Source::IWM> logger;
using Logger = Log::Logger<Log::Source::IWM>;
}
IWM::IWM(int clock_rate) :
@@ -53,7 +53,7 @@ uint8_t IWM::read(const int address) {
switch(state_ & (Q6 | Q7 | ENABLE)) {
default:
logger.info().append("Invalid read\n");
Logger::info().append("Invalid read\n");
return 0xff;
case 0:
@@ -62,11 +62,11 @@ uint8_t IWM::read(const int address) {
if(data_register_ & 0x80) {
data_register_ = 0;
// logger.info().append("Reading data: %02x", result);
// Logger::info().append("Reading data: %02x", result);
} else {
// logger.info().append("Spurious read?");
// Logger::info().append("Spurious read?");
}
// logger.info().append("Reading data register: %02x", result);
// Logger::info().append("Reading data register: %02x", result);
return result;
}
@@ -99,7 +99,7 @@ uint8_t IWM::read(const int address) {
bit 6: 1 = write state (0 = underrun has occurred; 1 = no underrun so far).
bit 7: 1 = write data buffer ready for data (1 = ready; 0 = busy).
*/
// logger.info().append("Reading write handshake: %02x", 0x3f | write_handshake_);
// Logger::info().append("Reading write handshake: %02x", 0x3f | write_handshake_);
return 0x3f | write_handshake_;
}
@@ -130,9 +130,9 @@ void IWM::write(const int address, const uint8_t input) {
// TEMPORARY. To test for the unimplemented mode.
if(input&0x2) {
logger.info().append("Switched to asynchronous mode");
Logger::info().append("Switched to asynchronous mode");
} else {
logger.info().append("Switched to synchronous mode");
Logger::info().append("Switched to synchronous mode");
}
switch(mode_ & 0x18) {
@@ -141,8 +141,8 @@ void IWM::write(const int address, const uint8_t input) {
case 0x10: bit_length_ = Cycles(32); break; // slow mode, 8Mhz
case 0x18: bit_length_ = Cycles(16); break; // fast mode, 8Mhz
}
logger.info().append("Mode is now %02x", mode_);
logger.info().append("New bit length is %d", bit_length_.as<int>());
Logger::info().append("Mode is now %02x", mode_);
Logger::info().append("New bit length is %d", bit_length_.as<int>());
break;
case Q7|Q6|ENABLE: // Write data register.
@@ -256,7 +256,7 @@ void IWM::run_for(const Cycles cycles) {
drives_[active_drive_]->run_for(Cycles(1));
++cycles_since_shift_;
if(cycles_since_shift_ == bit_length_ + error_margin) {
// logger.info().append("Shifting 0 at %d ", cycles_since_shift_.as<int>());
// Logger::info().append("Shifting 0 at %d ", cycles_since_shift_.as<int>());
propose_shift(0);
}
}
@@ -290,11 +290,11 @@ void IWM::run_for(const Cycles cycles) {
if(!(write_handshake_ & 0x80)) {
shift_register_ = next_output_;
output_bits_remaining_ = 8;
// logger.info().append("Next byte: %02x", shift_register_);
// Logger::info().append("Next byte: %02x", shift_register_);
} else {
write_handshake_ &= ~0x40;
if(drives_[active_drive_]) drives_[active_drive_]->end_writing();
logger.info().append("Overrun; done.");
Logger::info().append("Overrun; done.");
output_bits_remaining_ = 1;
}
@@ -350,7 +350,7 @@ void IWM::select_shift_mode() {
shift_register_ = next_output_;
write_handshake_ |= 0x80 | 0x40;
output_bits_remaining_ = 8;
logger.info().append("Seeding output with %02x", shift_register_);
Logger::info().append("Seeding output with %02x", shift_register_);
}
}
@@ -364,7 +364,7 @@ void IWM::process_event(const Storage::Disk::Drive::Event &event) {
switch(event.type) {
case Storage::Disk::Track::Event::IndexHole: return;
case Storage::Disk::Track::Event::FluxTransition:
// logger.info().append("Shifting 1 at %d", cycles_since_shift_.as<int>());
// Logger::info().append("Shifting 1 at %d", cycles_since_shift_.as<int>());
propose_shift(1);
break;
}
@@ -373,8 +373,8 @@ void IWM::process_event(const Storage::Disk::Drive::Event &event) {
void IWM::propose_shift(const uint8_t bit) {
// TODO: synchronous mode.
// logger.info().append("Shifting at %d", cycles_since_shift_.as<int>());
// logger.info().append("Shifting input");
// Logger::info().append("Shifting at %d", cycles_since_shift_.as<int>());
// Logger::info().append("Shifting input");
// See above for text from the IWM patent, column 7, around line 35 onwards.
// The error_margin here implements the 'before' part of that contract.
@@ -389,7 +389,7 @@ void IWM::propose_shift(const uint8_t bit) {
shift_register_ = uint8_t((shift_register_ << 1) | bit);
if(shift_register_ & 0x80) {
// if(data_register_ & 0x80) logger.info().append("Byte missed");
// if(data_register_ & 0x80) Logger::info().append("Byte missed");
data_register_ = shift_register_;
shift_register_ = 0;
}
+6 -8
View File
@@ -13,9 +13,7 @@
using namespace I2C;
namespace {
Log::Logger<Log::Source::I2C> logger;
using Logger = Log::Logger<Log::Source::I2C>;
}
void Bus::set_data(const bool pulled) {
@@ -52,7 +50,7 @@ void Bus::set_clock_data(const bool clock_pulled, const bool data_pulled) {
if(peripheral_bits_) {
// Trailing edge of clock => bit has been consumed.
if(!prior_clock && clock_) {
logger.info().append("<< %d", (peripheral_response_ >> 7) & 1);
Logger::info().append("<< %d", (peripheral_response_ >> 7) & 1);
--peripheral_bits_;
peripheral_response_ <<= 1;
@@ -68,10 +66,10 @@ void Bus::set_clock_data(const bool clock_pulled, const bool data_pulled) {
// A data transition outside of a clock cycle implies a start or stop.
in_bit_ = false;
if(data_) {
logger.info().append("S");
Logger::info().append("S");
signal(Event::Start);
} else {
logger.info().append("W");
Logger::info().append("W");
signal(Event::Stop);
}
} else if(clock_ != prior_clock) {
@@ -85,10 +83,10 @@ void Bus::set_clock_data(const bool clock_pulled, const bool data_pulled) {
in_bit_ = false;
if(data_) {
logger.info().append("0");
Logger::info().append("0");
signal(Event::Zero);
} else {
logger.info().append("1");
Logger::info().append("1");
signal(Event::One);
}
}
+11 -11
View File
@@ -18,8 +18,8 @@
using namespace InstructionSet::M50740;
namespace {
constexpr int port_remap[] = {0, 1, 2, 0, 3};
Log::Logger<Log::Source::M50740> logger;
constexpr int port_remap[] = {0, 1, 2, 0, 3};
using Logger = Log::Logger<Log::Source::M50740>;
}
Executor::Executor(PortHandler &port_handler) : port_handler_(port_handler) {
@@ -82,13 +82,13 @@ uint8_t Executor::read(uint16_t address) {
port_handler_.run_ports_for(cycles_since_port_handler_.flush<Cycles>());
switch(address) {
default:
logger.error().append("Unrecognised read from %02x", address);
Logger::error().append("Unrecognised read from %02x", address);
return 0xff;
// "Port R"; sixteen four-bit ports
case 0xd0: case 0xd1: case 0xd2: case 0xd3: case 0xd4: case 0xd5: case 0xd6: case 0xd7:
case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf:
logger.error().append("Unimplemented Port R read from %04x", address);
Logger::error().append("Unimplemented Port R read from %04x", address);
return 0x00;
// Ports P0P3.
@@ -133,7 +133,7 @@ void Executor::write(uint16_t address, const uint8_t value) {
// ROM 'writes' are almost as easy (albeit unexpected).
if(address >= 0x100) {
logger.info().append("Attempted ROM write of %02x to %04x", value, address);
Logger::info().append("Attempted ROM write of %02x to %04x", value, address);
return;
}
@@ -142,13 +142,13 @@ void Executor::write(uint16_t address, const uint8_t value) {
switch(address) {
default:
logger.error().append("Unrecognised write of %02x to %04x", value, address);
Logger::error().append("Unrecognised write of %02x to %04x", value, address);
break;
// "Port R"; sixteen four-bit ports
case 0xd0: case 0xd1: case 0xd2: case 0xd3: case 0xd4: case 0xd5: case 0xd6: case 0xd7:
case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf:
logger.error().append("Unimplemented Port R write of %02x to %04x", value, address);
Logger::error().append("Unimplemented Port R write of %02x to %04x", value, address);
break;
// Ports P0P3.
@@ -792,7 +792,7 @@ template <Operation operation> void Executor::perform(uint8_t *operand [[maybe_u
*/
default:
logger.error().append("Unimplemented operation: %d", operation);
Logger::error().append("Unimplemented operation: %d", operation);
assert(false);
}
}
@@ -836,13 +836,13 @@ inline void Executor::subtract_duration(const int duration) {
}
} break;
case 0x04:
logger.error().append("TODO: Timer X; Pulse output mode");
Logger::error().append("TODO: Timer X; Pulse output mode");
break;
case 0x08:
logger.error().append("TODO: Timer X; Event counter mode");
Logger::error().append("TODO: Timer X; Event counter mode");
break;
case 0x0c:
logger.error().append("TODO: Timer X; Pulse width measurement mode");
Logger::error().append("TODO: Timer X; Pulse width measurement mode");
break;
}
}
+1 -1
View File
@@ -52,7 +52,7 @@ class ConcreteMachine:
public Configurable::Device
{
private:
Log::Logger<Log::Source::Archimedes> logger;
using Logger = Log::Logger<Log::Source::Archimedes>;
// This fictitious clock rate just means '24 MIPS, please'; it's divided elsewhere.
static constexpr int ClockRate = 24'000'000;
+3 -3
View File
@@ -28,7 +28,7 @@ struct CMOSRAM: public I2C::Peripheral {
std::optional<uint8_t> read() override {
if(address_ < 16) {
logger.error().append("TODO: read at %d", address_);
Logger::error().append("TODO: read at %d", address_);
}
const uint8_t result = ram_[address_];
@@ -44,7 +44,7 @@ struct CMOSRAM: public I2C::Peripheral {
}
if(address_ < 16) {
logger.error().append("TODO: write at %d", address_);
Logger::error().append("TODO: write at %d", address_);
return true;
}
@@ -79,7 +79,7 @@ private:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
};
Log::Logger<Log::Source::CMOSRTC> logger;
using Logger = Log::Logger<Log::Source::CMOSRTC>;
};
}
@@ -187,7 +187,7 @@ struct InputOutputController: public ClockingHint::Observer {
switch(target.bank) {
default:
logger.error().append("Unrecognised IOC read from %08x i.e. bank %d / type %d", address, target.bank, target.type);
Logger::error().append("Unrecognised IOC read from %08x i.e. bank %d / type %d", address, target.bank, target.type);
destination = IntT(~0);
break;
@@ -195,7 +195,7 @@ struct InputOutputController: public ClockingHint::Observer {
case 0:
switch(target.offset) {
default:
logger.error().append("Unrecognised IOC bank 0 read; offset %02x", target.offset);
Logger::error().append("Unrecognised IOC bank 0 read; offset %02x", target.offset);
break;
case 0x00: {
@@ -205,67 +205,67 @@ struct InputOutputController: public ClockingHint::Observer {
value &= ~(floppy_.ready() ? 0x00 : 0x04);
value &= ~(video_.flyback_active() ? 0x00 : 0x80); // i.e. high during flyback.
set_byte(value);
// logger.error().append("IOC control read: C:%d D:%d", !(value & 2), !(value & 1));
// Logger::error().append("IOC control read: C:%d D:%d", !(value & 2), !(value & 1));
} break;
case 0x04:
set_byte(serial_.input(IOCParty));
irq_b_.clear(IRQB::KeyboardReceiveFull);
observer_.update_interrupts();
// logger.error().append("IOC keyboard receive: %02x", value);
// Logger::error().append("IOC keyboard receive: %02x", value);
break;
// IRQ A.
case 0x10:
set_byte(irq_a_.status);
// logger.error().append("IRQ A status is %02x", value);
// Logger::error().append("IRQ A status is %02x", value);
break;
case 0x14:
set_byte(irq_a_.request());
// logger.error().append("IRQ A request is %02x", value);
// Logger::error().append("IRQ A request is %02x", value);
break;
case 0x18:
set_byte(irq_a_.mask);
// logger.error().append("IRQ A mask is %02x", value);
// Logger::error().append("IRQ A mask is %02x", value);
break;
// IRQ B.
case 0x20:
set_byte(irq_b_.status);
// logger.error().append("IRQ B status is %02x", value);
// Logger::error().append("IRQ B status is %02x", value);
break;
case 0x24:
set_byte(irq_b_.request());
// logger.error().append("IRQ B request is %02x", value);
// Logger::error().append("IRQ B request is %02x", value);
break;
case 0x28:
set_byte(irq_b_.mask);
// logger.error().append("IRQ B mask is %02x", value);
// Logger::error().append("IRQ B mask is %02x", value);
break;
// FIQ.
case 0x30:
set_byte(fiq_.status);
// logger.error().append("FIQ status is %02x", fiq_.status);
// Logger::error().append("FIQ status is %02x", fiq_.status);
break;
case 0x34:
set_byte(fiq_.request());
// logger.error().append("FIQ request is %02x", fiq_.request());
// Logger::error().append("FIQ request is %02x", fiq_.request());
break;
case 0x38:
set_byte(fiq_.mask);
// logger.error().append("FIQ mask is %02x", fiq_.mask);
// Logger::error().append("FIQ mask is %02x", fiq_.mask);
break;
// Counters.
case 0x40: case 0x50: case 0x60: case 0x70:
set_byte(counters_[(target.offset >> 4) - 0x4].output & 0xff);
// logger.error().append("%02x: Counter %d low is %02x", target, (target >> 4) - 0x4, value);
// Logger::error().append("%02x: Counter %d low is %02x", target, (target >> 4) - 0x4, value);
break;
case 0x44: case 0x54: case 0x64: case 0x74:
set_byte(counters_[(target.offset >> 4) - 0x4].output >> 8);
// logger.error().append("%02x: Counter %d high is %02x", target, (target >> 4) - 0x4, value);
// Logger::error().append("%02x: Counter %d high is %02x", target, (target >> 4) - 0x4, value);
break;
}
break;
@@ -273,7 +273,7 @@ struct InputOutputController: public ClockingHint::Observer {
// Bank 1: the floppy disc controller.
case 1:
set_byte(floppy_.read(target.offset >> 2));
// logger.error().append("Floppy read; offset %02x", target.offset);
// Logger::error().append("Floppy read; offset %02x", target.offset);
break;
}
@@ -302,14 +302,14 @@ struct InputOutputController: public ClockingHint::Observer {
switch(target.bank) {
default:
logger.error().append("Unrecognised IOC write of %02x to %08x i.e. bank %d / type %d", bus_value, address, target.bank, target.type);
Logger::error().append("Unrecognised IOC write of %02x to %08x i.e. bank %d / type %d", bus_value, address, target.bank, target.type);
break;
// Bank 0: internal registers.
case 0:
switch(target.offset) {
default:
logger.error().append("Unrecognised IOC bank 0 write; %02x to offset %02x", bus_value, target.offset);
Logger::error().append("Unrecognised IOC bank 0 write; %02x to offset %02x", bus_value, target.offset);
break;
case 0x00:
@@ -345,15 +345,15 @@ struct InputOutputController: public ClockingHint::Observer {
// Interrupts.
case 0x18:
irq_a_.mask = byte(bus_value);
// logger.error().append("IRQ A mask set to %02x", byte(bus_value));
// Logger::error().append("IRQ A mask set to %02x", byte(bus_value));
break;
case 0x28:
irq_b_.mask = byte(bus_value);
// logger.error().append("IRQ B mask set to %02x", byte(bus_value));
// Logger::error().append("IRQ B mask set to %02x", byte(bus_value));
break;
case 0x38:
fiq_.mask = byte(bus_value);
// logger.error().append("FIQ mask set to %02x", byte(bus_value));
// Logger::error().append("FIQ mask set to %02x", byte(bus_value));
break;
// Counters.
@@ -381,7 +381,7 @@ struct InputOutputController: public ClockingHint::Observer {
// Bank 1: the floppy disc controller.
case 1:
// logger.error().append("Floppy write; %02x to offset %02x", bus_value, target.offset);
// Logger::error().append("Floppy write; %02x to offset %02x", bus_value, target.offset);
floppy_.write(target.offset >> 2, byte(bus_value));
// set_byte(floppy_.read(target.offset >> 2));
break;
@@ -390,17 +390,17 @@ struct InputOutputController: public ClockingHint::Observer {
case 5:
switch(target.type) {
default:
logger.error().append("Unrecognised IOC bank 5 type %d write; %02x to offset %02x", target.type, bus_value, target.offset);
Logger::error().append("Unrecognised IOC bank 5 type %d write; %02x to offset %02x", target.type, bus_value, target.offset);
break;
case Address::Type::Fast:
switch(target.offset) {
default:
logger.error().append("Unrecognised IOC fast bank 5 write; %02x to offset %02x", bus_value, target.offset);
Logger::error().append("Unrecognised IOC fast bank 5 write; %02x to offset %02x", bus_value, target.offset);
break;
case 0x00:
logger.error().append("TODO: printer data write; %02x", byte(bus_value));
Logger::error().append("TODO: printer data write; %02x", byte(bus_value));
break;
case 0x18: {
@@ -419,7 +419,7 @@ struct InputOutputController: public ClockingHint::Observer {
floppy_.set_is_double_density(!(value & 0x2));
if(value & 0x08) floppy_.reset();
// logger.error().append("TODO: latch B write; %02x", byte(bus_value));
// Logger::error().append("TODO: latch B write; %02x", byte(bus_value));
} break;
case 0x40: {
@@ -444,7 +444,7 @@ struct InputOutputController: public ClockingHint::Observer {
// b2/b3: sync polarity [b3 = V polarity, b2 = H?]
// b0/b1: VIDC master clock; 00 = 24Mhz, 01 = 25.175Mhz; 10 = 36Mhz; 11 = reserved.
logger.error().append("TODO: latch C write; %02x", byte(bus_value));
Logger::error().append("TODO: latch C write; %02x", byte(bus_value));
break;
}
break;
@@ -453,23 +453,23 @@ struct InputOutputController: public ClockingHint::Observer {
}
// case 0x327'0000 & AddressMask: // Bank 7
// logger.error().append("TODO: exteded external podule space");
// Logger::error().append("TODO: exteded external podule space");
// return true;
//
// case 0x336'0000 & AddressMask:
// logger.error().append("TODO: podule interrupt request");
// Logger::error().append("TODO: podule interrupt request");
// return true;
//
// case 0x336'0004 & AddressMask:
// logger.error().append("TODO: podule interrupt mask");
// Logger::error().append("TODO: podule interrupt mask");
// return true;
//
// case 0x33a'0000 & AddressMask:
// logger.error().append("TODO: 6854 / econet write");
// Logger::error().append("TODO: 6854 / econet write");
// return true;
//
// case 0x33b'0000 & AddressMask:
// logger.error().append("TODO: 6551 / serial line write");
// Logger::error().append("TODO: 6551 / serial line write");
// return true;
return true;
}
@@ -509,7 +509,7 @@ struct InputOutputController: public ClockingHint::Observer {
}
private:
Log::Logger<Log::Source::ARMIOC> logger;
using Logger = Log::Logger<Log::Source::ARMIOC>;
InterruptObserverT &observer_;
Activity::Observer *activity_observer_ = nullptr;
static inline const std::string FloppyActivityLED = "Drive";
+18 -18
View File
@@ -79,7 +79,7 @@ struct Keyboard {
states_[key] = is_pressed;
if(!scan_keyboard_) {
logger_.info().append("Ignored key event as key scanning disabled");
Logger::info().append("Ignored key event as key scanning disabled");
return;
}
@@ -112,7 +112,7 @@ struct Keyboard {
// A reset command is always accepted, usurping any other state.
if(input == HRST) {
logger_.info().append("HRST; resetting");
Logger::info().append("HRST; resetting");
state_ = State::ExpectingRAK1;
event_queue_.clear();
serial_.output(KeyboardParty, HRST);
@@ -122,7 +122,7 @@ struct Keyboard {
switch(state_) {
case State::ExpectingACK:
if(input != NACK && input != SMAK && input != MACK && input != SACK) {
logger_.error().append("No ack; requesting reset");
Logger::error().append("No ack; requesting reset");
reset();
break;
}
@@ -133,15 +133,15 @@ struct Keyboard {
switch(input) {
case RQID: // Post keyboard ID.
serial_.output(KeyboardParty, 0x81); // Declare this to be a UK keyboard.
logger_.info().append("RQID; responded with 0x81");
Logger::info().append("RQID; responded with 0x81");
break;
case PRST: // "1-byte command, does nothing."
logger_.info().append("PRST; ignored");
Logger::info().append("PRST; ignored");
break;
case RQMP:
logger_.error().append("RQMP; TODO: respond something other than 0, 0");
Logger::error().append("RQMP; TODO: respond something other than 0, 0");
enqueue(0, 0);
break;
@@ -154,19 +154,19 @@ struct Keyboard {
needs_state_check_ = true;
}
scan_mouse_ = input & 2;
logger_.info().append("ACK; keyboard:%d mouse:%d", scan_keyboard_, scan_mouse_);
Logger::info().append("ACK; keyboard:%d mouse:%d", scan_keyboard_, scan_mouse_);
} break;
default:
if((input & 0b1111'0000) == 0b0100'0000) {
// RQPD; request to echo the low nibble.
serial_.output(KeyboardParty, 0b1110'0000 | (input & 0b1111));
logger_.info().append("RQPD; echoing %x", input & 0b1111);
Logger::info().append("RQPD; echoing %x", input & 0b1111);
} else if(!(input & 0b1111'1000)) {
// LEDS: should set LED outputs.
logger_.error().append("TODO: set LEDs %d%d%d", static_cast<bool>(input&4), static_cast<bool>(input&2), static_cast<bool>(input&1));
Logger::error().append("TODO: set LEDs %d%d%d", static_cast<bool>(input&4), static_cast<bool>(input&2), static_cast<bool>(input&1));
} else {
logger_.info().append("Ignoring unrecognised command %02x received in idle state", input);
Logger::info().append("Ignoring unrecognised command %02x received in idle state", input);
}
break;
}
@@ -174,33 +174,33 @@ struct Keyboard {
case State::ExpectingRAK1:
if(input != RAK1) {
logger_.info().append("Didn't get RAK1; resetting");
Logger::info().append("Didn't get RAK1; resetting");
reset();
break;
}
logger_.info().append("Got RAK1; echoing");
Logger::info().append("Got RAK1; echoing");
serial_.output(KeyboardParty, input);
state_ = State::ExpectingRAK2;
break;
case State::ExpectingRAK2:
if(input != RAK2) {
logger_.info().append("Didn't get RAK2; resetting");
Logger::info().append("Didn't get RAK2; resetting");
reset();
break;
}
logger_.info().append("Got RAK2; echoing");
Logger::info().append("Got RAK2; echoing");
serial_.output(KeyboardParty, input);
state_ = State::ExpectingACK;
break;
case State::ExpectingBACK:
if(input != BACK) {
logger_.info().append("Didn't get BACK; resetting");
Logger::info().append("Didn't get BACK; resetting");
reset();
break;
}
logger_.info().append("Got BACK; posting next byte");
Logger::info().append("Got BACK; posting next byte");
dequeue_next();
state_ = State::ExpectingACK;
break;
@@ -250,7 +250,7 @@ struct Keyboard {
private:
HalfDuplexSerial &serial_;
Log::Logger<Log::Source::Keyboard> logger_;
using Logger = Log::Logger<Log::Source::Keyboard>;
std::bitset<Key::Max> states_;
std::bitset<Key::Max> posted_states_;
@@ -287,7 +287,7 @@ private:
enqueue_key_event(row(key), column(key), is_pressed);
}
void enqueue_key_event(uint8_t row, uint8_t column, bool is_pressed) {
logger_.info().append("Posting row %d, column %d is now %s", row, column, is_pressed ? "pressed" : "released");
Logger::info().append("Posting row %d, column %d is now %s", row, column, is_pressed ? "pressed" : "released");
const uint8_t prefix = is_pressed ? 0b1100'0000 : 0b1101'0000;
enqueue(static_cast<uint8_t>(prefix | row), static_cast<uint8_t>(prefix | column));
}
@@ -142,7 +142,7 @@ struct MemoryController {
break;
}
logger.info().append("MEMC Control: %08x -> OS:%d sound:%d video:%d refresh:%d high:%d low:%d size:%d", address, os_mode_, sound_dma_enable_, video_dma_enable_, dynamic_ram_refresh_, high_rom_access_time_, low_rom_access_time_, page_size_);
Logger::info().append("MEMC Control: %08x -> OS:%d sound:%d video:%d refresh:%d high:%d low:%d size:%d", address, os_mode_, sound_dma_enable_, video_dma_enable_, dynamic_ram_refresh_, high_rom_access_time_, low_rom_access_time_, page_size_);
map_dirty_ = true;
break;
}
@@ -193,7 +193,7 @@ struct MemoryController {
break;
case ReadZone::LowROM:
// logger.error().append("TODO: Low ROM read from %08x", address);
// Logger::error().append("TODO: Low ROM read from %08x", address);
source = IntT(~0);
break;
@@ -238,7 +238,7 @@ struct MemoryController {
}
private:
Log::Logger<Log::Source::ARMIOC> logger;
using Logger = Log::Logger<Log::Source::ARMIOC>;
enum class ReadZone {
LogicallyMappedRAM,
+2 -2
View File
@@ -122,7 +122,7 @@ struct Video {
break;
default:
logger.error().append("TODO: unrecognised VIDC write of %08x", value);
Logger::error().append("TODO: unrecognised VIDC write of %08x", value);
break;
}
}
@@ -269,7 +269,7 @@ struct Video {
}
private:
Log::Logger<Log::Source::ARMIOC> logger;
using Logger = Log::Logger<Log::Source::ARMIOC>;
InterruptObserverT &interrupt_observer_;
ClockRateObserverT &clock_rate_observer_;
SoundT &sound_;
+4 -4
View File
@@ -33,7 +33,7 @@ namespace {
constexpr int PALClockRate = 7'093'790;
//constexpr int NTSCClockRate = 7'159'090;
Log::Logger<Log::Source::Amiga> logger;
using Logger = Log::Logger<Log::Source::Amiga>;
}
@@ -95,7 +95,7 @@ public:
// Check for assertion of reset.
if(cycle.operation & CPU::MC68000::Operation::Reset) {
memory_.reset();
logger.info().append("Reset; PC is around %08x", mc68000_.get_state().registers.program_counter);
Logger::info().append("Reset; PC is around %08x", mc68000_.get_state().registers.program_counter);
}
// Autovector interrupts.
@@ -142,7 +142,7 @@ public:
if(select_b) chipset_.cia_b.write(reg, cycle.value8_high());
}
// logger.info().append("CIA %d %s %d of %04x", ((address >> 12) & 3)^3, operation & Microcycle::Read ? "read" : "write", reg & 0xf, cycle.value16());
// Logger::info().append("CIA %d %s %d of %04x", ((address >> 12) & 3)^3, operation & Microcycle::Read ? "read" : "write", reg & 0xf, cycle.value16());
} else if(address >= 0xdf'f000 && address <= 0xdf'f1be) {
chipset_.perform(cycle);
} else if(address >= 0xe8'0000 && address < 0xe9'0000) {
@@ -160,7 +160,7 @@ public:
// Log only for the region that is definitely not just ROM this machine doesn't have.
if(address < 0xf0'0000) {
logger.error().append("Unmapped %s %06x of %04x", cycle.operation & CPU::MC68000::Operation::Read ? "read from " : "write to ", (*cycle.address)&0xffffff, cycle.value16());
Logger::error().append("Unmapped %s %06x of %04x", cycle.operation & CPU::MC68000::Operation::Read ? "read from " : "write to ", (*cycle.address)&0xffffff, cycle.value16());
}
}
}
+10 -10
View File
@@ -17,7 +17,7 @@ using namespace Amiga;
namespace {
Log::Logger<Log::Source::AmigaBlitter> logger;
using Logger = Log::Logger<Log::Source::AmigaBlitter>;
/// @returns Either the final carry flag or the output nibble when using fill mode given that it either @c is_exclusive fill mode, or isn't;
/// and the specified initial @c carry and input @c nibble.
@@ -126,18 +126,18 @@ void Blitter<record_bus>::set_control(int index, uint16_t value) {
sequencer_.set_control(value >> 8);
}
shifts_[index] = value >> 12;
logger.info().append("Set control %d to %04x", index, value);
Logger::info().append("Set control %d to %04x", index, value);
}
template <bool record_bus>
void Blitter<record_bus>::set_first_word_mask(uint16_t value) {
logger.info().append("Set first word mask: %04x", value);
Logger::info().append("Set first word mask: %04x", value);
a_mask_[0] = value;
}
template <bool record_bus>
void Blitter<record_bus>::set_last_word_mask(uint16_t value) {
logger.info().append("Set last word mask: %04x", value);
Logger::info().append("Set last word mask: %04x", value);
a_mask_[1] = value;
}
@@ -149,7 +149,7 @@ void Blitter<record_bus>::set_size(uint16_t value) {
if(!width_) width_ = 0x40;
height_ = value >> 6;
if(!height_) height_ = 1024;
logger.info().append("Set size to %d, %d", width_, height_);
Logger::info().append("Set size to %d, %d", width_, height_);
// Current assumption: writing this register informs the
// blitter that it should treat itself as about to start a new line.
@@ -157,24 +157,24 @@ void Blitter<record_bus>::set_size(uint16_t value) {
template <bool record_bus>
void Blitter<record_bus>::set_minterms(uint16_t value) {
logger.info().append("Set minterms: %02x", value & 0xff);
Logger::info().append("Set minterms: %02x", value & 0xff);
minterms_ = value & 0xff;
}
//template <bool record_bus>
//void Blitter<record_bus>::set_vertical_size([[maybe_unused]] uint16_t value) {
// logger.info().append("Set vertical size %04x", value);
// Logger::info().append("Set vertical size %04x", value);
// // TODO. This is ECS only, I think. Ditto set_horizontal_size.
//}
//
//template <bool record_bus>
//void Blitter<record_bus>::set_horizontal_size([[maybe_unused]] uint16_t value) {
// logger.info().append("Set horizontal size %04x", value);
// Logger::info().append("Set horizontal size %04x", value);
//}
template <bool record_bus>
void Blitter<record_bus>::set_data(int channel, uint16_t value) {
logger.info().append("Set data %d to %04x", channel, value);
Logger::info().append("Set data %d to %04x", channel, value);
// Ugh, backed myself into a corner. TODO: clean.
switch(channel) {
@@ -189,7 +189,7 @@ template <bool record_bus>
uint16_t Blitter<record_bus>::get_status() {
const uint16_t result =
(not_zero_flag_ ? 0x0000 : 0x2000) | (height_ ? 0x4000 : 0x0000);
logger.info().append("Returned status of %04x", result);
Logger::info().append("Returned status of %04x", result);
return result;
}
+19 -19
View File
@@ -15,7 +15,7 @@
#include <tuple>
namespace {
Log::Logger<Log::Source::AmigaChipset> logger;
using Logger = Log::Logger<Log::Source::AmigaChipset>;
}
using namespace Amiga;
@@ -868,16 +868,16 @@ void Chipset::write(uint32_t address, uint16_t value, bool allow_conversion) {
break;
case 0x02a: // VPOSW
logger.error().append("TODO: write vertical position high %04x", value);
Logger::error().append("TODO: write vertical position high %04x", value);
break;
case 0x02c: // VHPOSW
logger.error().append("TODO: write vertical position low %04x", value);
Logger::error().append("TODO: write vertical position low %04x", value);
is_long_field_ = value & 0x8000;
break;
// Joystick/mouse input.
case 0x034: // POTGO
// logger.error().append("TODO: pot port start");
// Logger::error().append("TODO: pot port start");
break;
// Disk DMA and control.
@@ -886,11 +886,11 @@ void Chipset::write(uint32_t address, uint16_t value, bool allow_conversion) {
case 0x024: disk_.set_length(value); break; // DSKLEN
case 0x026: // DSKDAT
logger.error().append("TODO: disk DMA; %04x to %04x", value, address);
Logger::error().append("TODO: disk DMA; %04x to %04x", value, address);
break;
case 0x09e: // ADKCON
logger.info().append("Write disk control");
Logger::info().append("Write disk control");
ApplySetClear(paula_disk_control_, 0x7fff);
disk_controller_.set_control(paula_disk_control_);
@@ -904,7 +904,7 @@ void Chipset::write(uint32_t address, uint16_t value, bool allow_conversion) {
// Refresh.
case 0x028: // REFPTR
logger.info().append("TODO (maybe): refresh; %04x to %08x", value, address);
Logger::info().append("TODO (maybe): refresh; %04x to %08x", value, address);
break;
// Serial port.
@@ -943,7 +943,7 @@ void Chipset::write(uint32_t address, uint16_t value, bool allow_conversion) {
break;
case 0x092: // DDFSTRT
if(fetch_window_[0] != value) {
logger.info().append("Fetch window start set to %d", value);
Logger::info().append("Fetch window start set to %d", value);
}
fetch_window_[0] = value & 0xfe;
break;
@@ -951,7 +951,7 @@ void Chipset::write(uint32_t address, uint16_t value, bool allow_conversion) {
// TODO: something in my interpretation of ddfstart and ddfstop
// means a + 8 is needed below for high-res displays. Investigate.
if(fetch_window_[1] != value) {
logger.info().append("Fetch window stop set to %d", fetch_window_[1]);
Logger::info().append("Fetch window stop set to %d", fetch_window_[1]);
}
fetch_window_[1] = value & 0xfe;
break;
@@ -988,7 +988,7 @@ void Chipset::write(uint32_t address, uint16_t value, bool allow_conversion) {
break;
case 0x106: // BPLCON3 (ECS)
logger.error().append("TODO: Bitplane control; %04x to %08x", value, address);
Logger::error().append("TODO: Bitplane control; %04x to %08x", value, address);
break;
case 0x108: bitplanes_.set_modulo<0>(value); break; // BPL1MOD
@@ -1000,7 +1000,7 @@ void Chipset::write(uint32_t address, uint16_t value, bool allow_conversion) {
case 0x116:
case 0x118:
case 0x11a:
logger.error().append("TODO: Bitplane data; %04x to %08x", value, address);
Logger::error().append("TODO: Bitplane data; %04x to %08x", value, address);
break;
// Blitter.
@@ -1055,7 +1055,7 @@ void Chipset::write(uint32_t address, uint16_t value, bool allow_conversion) {
case 0x088: copper_.reload<0>(); break;
case 0x08a: copper_.reload<1>(); break;
case 0x08c:
logger.error().append("TODO: coprocessor instruction fetch identity %04x", value);
Logger::error().append("TODO: coprocessor instruction fetch identity %04x", value);
break;
// Sprites.
@@ -1143,15 +1143,15 @@ uint16_t Chipset::read(uint32_t address, bool allow_conversion) {
case 0x00c: return joystick(0).get_position(); // JOY1DAT
case 0x016: // POTGOR / POTINP
// logger.error().append("TODO: pot port read");
// Logger::error().append("TODO: pot port read");
return 0xff00;
// Disk DMA and control.
case 0x010: // ADKCONR
logger.info().append("Read disk control");
Logger::info().append("Read disk control");
return paula_disk_control_;
case 0x01a: // DSKBYTR
logger.error().append("TODO: disk status");
Logger::error().append("TODO: disk status");
assert(false); // Not yet implemented.
return 0xffff;
@@ -1193,7 +1193,7 @@ Chipset::CIAAHandler::CIAAHandler(MemoryMap &map, DiskController &controller, Mo
void Chipset::CIAAHandler::set_port_output(MOS::MOS6526::Port port, uint8_t value) {
if(port) {
// CIA A, Port B: Parallel port output.
logger.info().append("TODO: parallel output %02x", value);
Logger::info().append("TODO: parallel output %02x", value);
} else {
// CIA A, Port A:
//
@@ -1215,7 +1215,7 @@ void Chipset::CIAAHandler::set_port_output(MOS::MOS6526::Port port, uint8_t valu
uint8_t Chipset::CIAAHandler::get_port_input(MOS::MOS6526::Port port) {
if(port) {
logger.info().append("TODO: parallel input?");
Logger::info().append("TODO: parallel input?");
} else {
// Use the mouse as FIR0, the joystick as FIR1.
return
@@ -1255,12 +1255,12 @@ void Chipset::CIABHandler::set_port_output(MOS::MOS6526::Port port, uint8_t valu
// b2: SEL
// b1: POUT
// b0: BUSY
logger.error().append("TODO: DTR/RTS/etc: %02x", value);
Logger::error().append("TODO: DTR/RTS/etc: %02x", value);
}
}
uint8_t Chipset::CIABHandler::get_port_input(MOS::MOS6526::Port) {
logger.error().append("Unexpected: input for CIA B");
Logger::error().append("Unexpected: input for CIA B");
return 0xff;
}
+5 -5
View File
@@ -26,7 +26,7 @@ bool satisfies_raster(uint16_t position, uint16_t blitter_status, uint16_t *inst
return (position & mask) >= (instruction[0] & mask);
}
Log::Logger<Log::Source::AmigaCopper> logger;
using Logger = Log::Logger<Log::Source::AmigaCopper>;
}
@@ -82,7 +82,7 @@ bool Copper::advance_dma(uint16_t position, uint16_t blitter_status) {
case State::Waiting:
if(satisfies_raster(position, blitter_status, instruction_)) {
logger.info().append("Unblocked waiting for %04x at %04x with mask %04x", instruction_[0], position, instruction_[1] & 0x7ffe);
Logger::info().append("Unblocked waiting for %04x at %04x with mask %04x", instruction_[0], position, instruction_[1] & 0x7ffe);
state_ = State::FetchFirstWord;
}
return false;
@@ -91,7 +91,7 @@ bool Copper::advance_dma(uint16_t position, uint16_t blitter_status) {
instruction_[0] = ram_[address_ & ram_mask_];
++address_;
state_ = State::FetchSecondWord;
logger.info().append("First word fetch at %04x", position);
Logger::info().append("First word fetch at %04x", position);
break;
case State::FetchSecondWord: {
@@ -102,7 +102,7 @@ bool Copper::advance_dma(uint16_t position, uint16_t blitter_status) {
// Read in the second instruction word.
instruction_[1] = ram_[address_ & ram_mask_];
++address_;
logger.info().append("Second word fetch at %04x", position);
Logger::info().append("Second word fetch at %04x", position);
// Check for a MOVE.
if(!(instruction_[0] & 1)) {
@@ -110,7 +110,7 @@ bool Copper::advance_dma(uint16_t position, uint16_t blitter_status) {
// Stop if this move would be a privilege violation.
instruction_[0] &= 0x1fe;
if((instruction_[0] < 0x10) || (instruction_[0] < 0x20 && !(control_&1))) {
logger.info().append("Invalid MOVE to %04x; stopping", instruction_[0]);
Logger::info().append("Invalid MOVE to %04x; stopping", instruction_[0]);
state_ = State::Stopped;
break;
}
+7 -7
View File
@@ -11,7 +11,7 @@
#include "Outputs/Log.hpp"
namespace {
Log::Logger<Log::Source::AmigaDisk> logger;
using Logger = Log::Logger<Log::Source::AmigaDisk>;
}
using namespace Amiga;
@@ -45,7 +45,7 @@ void Chipset::DiskDMA::set_length(uint16_t value) {
buffer_read_ = buffer_write_ = 0;
if(dma_enable_) {
logger.info().append("Disk DMA %s of %d to %08x", write_ ? "write" : "read", length_, pointer_[0]);
Logger::info().append("Disk DMA %s of %d to %08x", write_ ? "write" : "read", length_, pointer_[0]);
}
state_ = sync_with_word_ ? State::WaitingForSync : State::Reading;
@@ -109,7 +109,7 @@ void Chipset::DiskController::process_input_bit(int value) {
}
void Chipset::DiskController::set_sync_word(uint16_t value) {
logger.info().append("Set disk sync word to %04x", value);
Logger::info().append("Set disk sync word to %04x", value);
sync_word_ = value;
}
@@ -127,7 +127,7 @@ void Chipset::DiskController::set_control(uint16_t control) {
bit_length.clock_rate = (control & 0x100) ? 500000 : 250000;
set_expected_bit_length(bit_length);
logger.info().append("%s sync with word; bit length is %s", sync_with_word_ ? "Will" : "Won't", (control & 0x100) ? "short" : "long");
Logger::info().append("%s sync with word; bit length is %s", sync_with_word_ ? "Will" : "Won't", (control & 0x100) ? "short" : "long");
}
void Chipset::DiskController::process_index_hole() {
@@ -181,7 +181,7 @@ void Chipset::DiskController::set_mtr_sel_side_dir_step(uint8_t value) {
// ID and definitely latch the new motor state.
if(!is_selected) {
drive_ids_[c] <<= 1;
logger.info().append("Shifted drive ID shift register for drive %d to %08x", c, drive_ids_[c]);
Logger::info().append("Shifted drive ID shift register for drive %d to %08x", c, drive_ids_[c]);
} else {
// Motor transition on -> off => reload register.
if(!motor_on && drive.get_motor_on()) {
@@ -190,7 +190,7 @@ void Chipset::DiskController::set_mtr_sel_side_dir_step(uint8_t value) {
// 0x5555'5555 = 5.25" drive;
// 0x0000'0000 = no drive.
drive_ids_[c] = 0xffff'ffff;
logger.info().append("Reloaded drive ID shift register for drive %d", c);
Logger::info().append("Reloaded drive ID shift register for drive %d", c);
}
// Also latch the new motor state.
@@ -203,7 +203,7 @@ void Chipset::DiskController::set_mtr_sel_side_dir_step(uint8_t value) {
// Possibly step.
if(did_step && is_selected) {
logger.info().append("Stepped drive %d by %d", c, direction.as_int());
Logger::info().append("Stepped drive %d by %d", c, direction.as_int());
drive.step(direction);
}
}
+2 -2
View File
@@ -13,7 +13,7 @@
using namespace Apple::ADB;
namespace {
[[maybe_unused]] Log::Logger<Log::Source::ADBDevice> logger;
using Logger = Log::Logger<Log::Source::ADBDevice>;
}
ReactiveDevice::ReactiveDevice(Apple::ADB::Bus &bus, uint8_t adb_device_id) :
@@ -128,7 +128,7 @@ void ReactiveDevice::adb_bus_did_observe_event(Bus::Event event, uint8_t value)
phase_ = Phase::AwaitingAttention;
command_ = decode_command(value);
// logger.info().append("%d", command_);
// Logger::info().append("%d", command_);
// If this command doesn't apply here, but a service request is requested,
// post a service request.
+3 -3
View File
@@ -125,13 +125,13 @@ void SCSICard::perform_bus_operation(Select select, bool is_read, uint16_t addre
case 0xb:
if(!is_read) {
logger_.error().append("TODO: NCR reset");
Logger::error().append("TODO: NCR reset");
}
break;
case 0xd:
if(!is_read) {
logger_.error().append("TODO: Enable PDMA");
Logger::error().append("TODO: Enable PDMA");
}
break;
@@ -143,7 +143,7 @@ void SCSICard::perform_bus_operation(Select select, bool is_read, uint16_t addre
break;
default:
logger_.error().append("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;
+1 -1
View File
@@ -49,7 +49,7 @@ private:
SCSI::Bus scsi_bus_;
NCR::NCR5380::NCR5380 ncr5380_;
SCSI::Target::Target<SCSI::DirectAccessDevice> storage_;
Log::Logger<Log::Source::AppleIISCSICard> logger_;
using Logger = Log::Logger<Log::Source::AppleIISCSICard>;
};
}
+2 -2
View File
@@ -39,7 +39,7 @@ enum class MicrocontrollerFlags: uint8_t {
CommandRegisterFull = 0x40,
};
Log::Logger<Log::Source::ADBGLU> logger;
using Logger = Log::Logger<Log::Source::ADBGLU>;
}
@@ -247,7 +247,7 @@ void GLU::set_port_output(int port, uint8_t value) {
case 3:
if(modifier_state_ != (value & 0x30)) {
modifier_state_ = value & 0x30;
logger.info().append("Modifier state: %02x", modifier_state_);
Logger::info().append("Modifier state: %02x", modifier_state_);
}
// Output is inverted respective to input; the microcontroller
+2 -2
View File
@@ -50,7 +50,7 @@ namespace {
constexpr int CLOCK_RATE = 7833600;
constexpr auto KEYBOARD_CLOCK_RATE = HalfCycles(CLOCK_RATE / 100000);
Log::Logger<Log::Source::Macintosh> logger;
using Logger = Log::Logger<Log::Source::Macintosh>;
// Former default PRAM:
//
@@ -725,7 +725,7 @@ private:
if(port == Port::B && line == Line::Two) {
keyboard_.set_input(value);
}
else logger.error().append("Unhandled 6522 control line output: %c%d", port ? 'B' : 'A', int(line));
else Logger::error().append("Unhandled 6522 control line output: %c%d", port ? 'B' : 'A', int(line));
}
void run_for(HalfCycles duration) {
+2 -2
View File
@@ -36,7 +36,7 @@
#include "Analyser/Static/AtariST/Target.hpp"
namespace {
Log::Logger<Log::Source::AtariST> logger;
using Logger = Log::Logger<Log::Source::AtariST>;
}
namespace Atari {
@@ -188,7 +188,7 @@ public:
// Check for assertion of reset.
if(cycle.operation & CPU::MC68000::Operation::Reset) {
logger.error().append("Unhandled Reset");
Logger::error().append("Unhandled Reset");
}
// A null cycle leaves nothing else to do.
+2 -2
View File
@@ -16,7 +16,7 @@ using namespace Atari::ST;
namespace {
[[maybe_unused]] Log::Logger<Log::Source::AtariSTDMAController> logger;
using Logger = Log::Logger<Log::Source::AtariSTDMAController>;
enum Control: uint16_t {
Direction = 0x100,
@@ -122,7 +122,7 @@ void DMAController::write(int address, uint16_t value) {
}
void DMAController::set_floppy_drive_selection(bool drive1, bool drive2, bool side2) {
// logger.info().append("Selected: %s%s%s", drive1 ? "1" : "-", drive2 ? "2" : "-", side2 ? "s" : "-");
// Logger::info().append("Selected: %s%s%s", drive1 ? "1" : "-", drive2 ? "2" : "-", side2 ? "s" : "-");
fdc_.set_floppy_drive_selection(drive1, drive2, side2);
}
+8 -8
View File
@@ -13,7 +13,7 @@
#include <algorithm>
namespace {
Log::Logger<Log::Source::IntelligentKeyboard> logger;
using Logger = Log::Logger<Log::Source::IntelligentKeyboard>;
}
using namespace Atari::ST;
@@ -160,7 +160,7 @@ void IntelligentKeyboard::dispatch_command(uint8_t command) {
// If not, exit. If so, perform and drop out of the switch.
switch(command_sequence_.front()) {
default:
logger.error().append("Unrecognised IKBD command %02x", command);
Logger::error().append("Unrecognised IKBD command %02x", command);
break;
case 0x80:
@@ -263,11 +263,11 @@ void IntelligentKeyboard::reset() {
}
void IntelligentKeyboard::resume() {
logger.error().append("Unimplemented: resume");
Logger::error().append("Unimplemented: resume");
}
void IntelligentKeyboard::pause() {
logger.error().append("Unimplemented: pause");
Logger::error().append("Unimplemented: pause");
}
void IntelligentKeyboard::disable_mouse() {
@@ -290,7 +290,7 @@ void IntelligentKeyboard::set_mouse_position(uint16_t x, uint16_t y) {
}
void IntelligentKeyboard::set_mouse_keycode_reporting(uint8_t, uint8_t) {
logger.error().append("Unimplemented: set mouse keycode reporting");
Logger::error().append("Unimplemented: set mouse keycode reporting");
}
void IntelligentKeyboard::set_mouse_threshold(uint8_t x, uint8_t y) {
@@ -312,7 +312,7 @@ void IntelligentKeyboard::set_mouse_y_upward() {
}
void IntelligentKeyboard::set_mouse_button_actions(uint8_t) {
logger.error().append("Unimplemented: set mouse button actions");
Logger::error().append("Unimplemented: set mouse button actions");
}
void IntelligentKeyboard::interrogate_mouse_position() {
@@ -502,9 +502,9 @@ void IntelligentKeyboard::interrogate_joysticks() {
}
void IntelligentKeyboard::set_joystick_monitoring_mode(uint8_t) {
logger.error().append("Unimplemented: joystick monitoring mode");
Logger::error().append("Unimplemented: joystick monitoring mode");
}
void IntelligentKeyboard::set_joystick_fire_button_monitoring_mode() {
logger.error().append("Unimplemented: joystick fire button monitoring mode");
Logger::error().append("Unimplemented: joystick fire button monitoring mode");
}
+7 -8
View File
@@ -40,8 +40,7 @@ using namespace Commodore;
using namespace Commodore::Plus4;
namespace {
Log::Logger<Log::Source::Plus4> logger;
using Logger = Log::Logger<Log::Source::Plus4>;
class Joystick: public Inputs::ConcreteJoystick {
public:
@@ -382,12 +381,12 @@ public:
// map_.write(0xb7) = 0x03;
// map_.write(0xf8) = header->type_descriptor();
//// hold_tape_ = true;
// logger.info().append("Found header");
// Logger::info().append("Found header");
// } else {
// // no header found, so pretend this hack never interceded
// tape_player_->serialiser()->set_offset(tape_position);
//// hold_tape_ = false;
// logger.info().append("Didn't find header");
// Logger::info().append("Didn't find header");
// }
//
// // Clear status and the verify flags.
@@ -432,7 +431,7 @@ public:
break;
default:
logger.info().append("TODO: read @ %04x", address);
Logger::info().append("TODO: read @ %04x", address);
break;
}
} else {
@@ -448,7 +447,7 @@ public:
} break;
default:
logger.info().append("TODO: write of %02x @ %04x", *value, address);
Logger::info().append("TODO: write of %02x @ %04x", *value, address);
break;
}
}
@@ -520,7 +519,7 @@ public:
case 0xff3f: *value = 0; break;
default:
logger.info().append("TODO: TED read at %04x", address);
Logger::info().append("TODO: TED read at %04x", address);
is_hit = false;
}
} else {
@@ -614,7 +613,7 @@ public:
case 0xff3f: page_cpu_ram(); break;
default:
logger.info().append("TODO: TED write at %04x", address);
Logger::info().append("TODO: TED write at %04x", address);
is_hit = false;
}
}
+5 -5
View File
@@ -38,7 +38,7 @@
#include <cstdint>
namespace {
Log::Logger<Log::Source::Vic20> logger;
using Logger = Log::Logger<Log::Source::Vic20>;
}
namespace Commodore::Vic20 {
@@ -539,12 +539,12 @@ public:
const uint16_t tape_buffer_pointer = uint16_t(ram_[0xb2]) | uint16_t(ram_[0xb3] << 8);
header->serialise(&ram_[tape_buffer_pointer], 0x8000 - tape_buffer_pointer);
hold_tape_ = true;
logger.info().append("Found header");
Logger::info().append("Found header");
} else {
// no header found, so pretend this hack never interceded
tape_->serialiser()->set_offset(tape_position);
hold_tape_ = false;
logger.info().append("Didn't find header");
Logger::info().append("Didn't find header");
}
// clear status and the verify flag
@@ -585,11 +585,11 @@ public:
m6502_.set_value_of(CPU::MOS6502::Register::ProgramCounter, 0xfccf);
*value = 0xea; // i.e. NOP implied
hold_tape_ = true;
logger.info().append("Found data");
Logger::info().append("Found data");
} else {
tape_->serialiser()->set_offset(tape_position);
hold_tape_ = false;
logger.info().append("Didn't find data");
Logger::info().append("Didn't find data");
}
}
}
+5 -5
View File
@@ -24,7 +24,7 @@
#include "Processors/Z80/Z80.hpp"
namespace {
Log::Logger<Log::Source::Enterprise> logger;
using Logger = Log::Logger<Log::Source::Enterprise>;
}
namespace Enterprise {
@@ -365,7 +365,7 @@ public:
case PartialMachineCycle::Input:
switch(address & 0xff) {
default:
logger.error().append("Unhandled input from %02x", address & 0xff);
Logger::error().append("Unhandled input from %02x", address & 0xff);
*cycle.value = 0xff;
break;
@@ -430,7 +430,7 @@ public:
case PartialMachineCycle::Output:
switch(address & 0xff) {
default:
logger.error().append("Unhandled output: %02x to %02x", *cycle.value, address & 0xff);
Logger::error().append("Unhandled output: %02x to %02x", *cycle.value, address & 0xff);
break;
case 0x10: case 0x11: case 0x12: case 0x13:
@@ -529,12 +529,12 @@ public:
break;
case 0xb6:
// Just 8 bits of printer data.
logger.info().append("TODO: printer output: %02x", *cycle.value);
Logger::info().append("TODO: printer output: %02x", *cycle.value);
break;
case 0xb7:
// b0 = serial data out
// b1 = serial status out
logger.info().append("TODO: serial output: %02x", *cycle.value);
Logger::info().append("TODO: serial output: %02x", *cycle.value);
break;
}
break;
+3 -3
View File
@@ -50,7 +50,7 @@
#include <algorithm>
namespace {
Log::Logger<Log::Source::MSX> logger;
using Logger = Log::Logger<Log::Source::MSX>;
}
namespace MSX {
@@ -878,14 +878,14 @@ private:
// b0-b3: keyboard line
machine_.set_keyboard_line(value & 0xf);
} break;
default: logger.error().append("Unrecognised: MSX set 8255 output port %d to value %02x", port, value); break;
default: Logger::error().append("Unrecognised: MSX set 8255 output port %d to value %02x", port, value); break;
}
}
uint8_t get_value(int port) {
if(port == 1) {
return machine_.read_keyboard();
} else logger.error().append("MSX attempted to read from 8255 port %d");
} else Logger::error().append("MSX attempted to read from 8255 port %d");
return 0xff;
}
+7 -7
View File
@@ -33,7 +33,7 @@
namespace {
constexpr int audio_divider = 1;
Log::Logger<Log::Source::MasterSystem> logger;
using Logger = Log::Logger<Log::Source::MasterSystem>;
}
namespace Sega {
@@ -260,17 +260,17 @@ public:
}
if(write_pointers_[address >> 10]) write_pointers_[address >> 10][address & 1023] = *cycle.value;
// else logger.info().append("Ignored write to ROM");
// else Logger::info().append("Ignored write to ROM");
break;
case CPU::Z80::PartialMachineCycle::Input:
switch(address & 0xc1) {
case 0x00:
logger.error().append("TODO: [input] memory control");
Logger::error().append("TODO: [input] memory control");
*cycle.value = 0xff;
break;
case 0x01:
logger.error().append("TODO: [input] I/O port control");
Logger::error().append("TODO: [input] I/O port control");
*cycle.value = 0xff;
break;
case 0x40:
@@ -310,7 +310,7 @@ public:
} break;
default:
logger.error().append("[input] Clearly some sort of typo");
Logger::error().append("[input] Clearly some sort of typo");
break;
}
break;
@@ -320,7 +320,7 @@ public:
case 0x00: // i.e. even ports less than 0x40.
if constexpr (is_master_system(model)) {
// TODO: Obey the RAM enable.
logger.info().append("Memory control: %02x", memory_control_);
Logger::info().append("Memory control: %02x", memory_control_);
memory_control_ = *cycle.value;
page_cartridge();
}
@@ -362,7 +362,7 @@ public:
break;
default:
logger.error().append("[output] Clearly some sort of typo");
Logger::error().append("[output] Clearly some sort of typo");
break;
}
break;
+2 -2
View File
@@ -43,7 +43,7 @@ public:
void set_a20_enabled(const bool enabled) {
// Assumed: this'll be something to set on Memory.
log_.info().append("A20 line is now: %d", enabled);
Logger::info().append("A20 line is now: %d", enabled);
linear_memory_.set_a20_enabled(enabled);
}
@@ -65,7 +65,7 @@ private:
SegmentedMemory<processor_model(model), LinearMemory<processor_model(model)>> &segmented_memory_;
LinearMemory<processor_model(model)> &linear_memory_;
Log::Logger<Log::Source::PCCompatible> log_;
using Logger = Log::Logger<Log::Source::PCCompatible>;
Mode mode_ = Mode::Real;
};
+2 -2
View File
@@ -254,7 +254,7 @@ public:
pages_[page_for_index(index)] = value;
if(index == 0x00) {
log_.info().append("%02x", value);
Logger::info().append("%02x", value);
// if(value == 0x3c) {
// ++count;
@@ -274,7 +274,7 @@ public:
private:
uint8_t pages_[16]{};
mutable Log::Logger<Log::Source::PCPOST> log_;
using Logger = Log::Logger<Log::Source::PCPOST>;
static constexpr int page_for_index(const int index) {
switch(index) {
+17 -17
View File
@@ -40,7 +40,7 @@ public:
}
void set_digital_output(const uint8_t control) {
log_.info().append("Digital output: %02x", control);
Logger::info().append("Digital output: %02x", control);
// b7, b6, b5, b4: enable motor for drive 4, 3, 2, 1;
// b3: 1 => enable DMA; 0 => disable;
@@ -72,24 +72,24 @@ public:
}
void set_data_rate(const uint8_t control) {
log_.info().append("Data rate: %02x", control);
Logger::info().append("Data rate: %02x", control);
}
uint8_t status() const {
const auto result = status_.main();
log_.info().append("Status: %02x", result);
Logger::info().append("Status: %02x", result);
return result;
}
void write(const uint8_t value) {
// log_.info().append("03f5 <- %02x", value);
// Logger::info().append("03f5 <- %02x", value);
decoder_.push_back(value);
if(decoder_.has_command()) {
using Command = Intel::i8272::Command;
switch(decoder_.command()) {
default:
log_.error().append("TODO: implement FDC command %02x", uint8_t(decoder_.command()));
Logger::error().append("TODO: implement FDC command %02x", uint8_t(decoder_.command()));
// Unimplemented:
//
@@ -105,7 +105,7 @@ public:
case Command::WriteDeletedData:
case Command::WriteData: {
auto &drive = drives_[decoder_.target().drive];
log_.info().append(
Logger::info().append(
"Write %sdata to drive %d / head %d / track %d of head %d / track %d / sector %d",
decoder_.command() == Command::WriteDeletedData ? "deleted " : "",
decoder_.target().drive,
@@ -138,7 +138,7 @@ public:
case Command::ReadDeletedData:
case Command::ReadData: {
auto &drive = drives_[decoder_.target().drive];
log_.info().append(
Logger::info().append(
"Read %sdata from drive %d / head %d / track %d of head %d / track %d / sector %d",
decoder_.command() == Command::ReadDeletedData ? "deleted " : "",
decoder_.target().drive,
@@ -203,7 +203,7 @@ public:
case Command::ReadID: {
auto &drive = drives_[decoder_.target().drive];
const auto target = decoder_.target();
log_.info().append(
Logger::info().append(
"Read ID from drive %d / head %d / track %",
target.drive,
target.head,
@@ -242,7 +242,7 @@ public:
case Command::Seek: {
auto &drive = drives_[decoder_.target().drive];
drive.track = decoder_.command() == Command::Seek ? decoder_.seek_target() : 0;
log_.info().append(
Logger::info().append(
"%s to %d",
decoder_.command() == Command::Seek ? "Seek" : "Recalibrate",
drive.track
@@ -267,7 +267,7 @@ public:
}
auto &drive = drives_[last_seeking_drive_];
log_.info().append(
Logger::info().append(
"Sense interrupt status; picked drive %d with interrupt status %d",
last_seeking_drive_,
drive.raised_interrupt
@@ -293,12 +293,12 @@ public:
}
} break;
case Command::Specify:
log_.info().append("Specify");
Logger::info().append("Specify");
specify_specs_ = decoder_.specify_specs();
break;
case Command::SenseDriveStatus: {
const auto &drive = drives_[decoder_.target().drive];
log_.info().append(
Logger::info().append(
"Sense drive status: drive %d / head %d; track 0 is %d, ready is %d",
decoder_.target().drive,
decoder_.target().head,
@@ -314,7 +314,7 @@ public:
} break;
case Command::Invalid:
log_.info().append("Invalid command");
Logger::info().append("Invalid command");
results_.serialise_none();
break;
}
@@ -339,11 +339,11 @@ public:
status_.set(MainStatus::DataIsToProcessor, false);
status_.set(MainStatus::CommandInProgress, false);
}
log_.info().append("Result read: %02x", result);
Logger::info().append("Result read: %02x", result);
return result;
}
log_.info().append("Result read: 80 [default]");
Logger::info().append("Result read: 80 [default]");
return 0x80;
}
@@ -367,10 +367,10 @@ public:
}
private:
mutable Log::Logger<Log::Source::Floppy> log_;
using Logger = Log::Logger<Log::Source::Floppy>;
void reset() {
log_.info().append("{Reset}");
Logger::info().append("{Reset}");
decoder_.clear();
status_.reset();
+21 -21
View File
@@ -20,73 +20,73 @@ public:
// TODO: probably all these belong directly on a drive; IDE = integrated drive electronics; the following
// are all functions owned by the drive, not the controller.
void set_data(const uint16_t data) {
log_.info().append("Set data: %04x", data);
Logger::info().append("Set data: %04x", data);
}
uint16_t data() const {
log_.info().append("Read data");
Logger::info().append("Read data");
return 0xff;
}
void set_write_precompensation(const uint8_t precompensation) {
log_.info().append("Set write precompensation: %02x", precompensation);
Logger::info().append("Set write precompensation: %02x", precompensation);
}
uint8_t error() const {
log_.info().append("Read error");
Logger::info().append("Read error");
return 0;
}
void set_sector_count(const uint8_t count) {
log_.info().append("Write sector count: %02x", count);
Logger::info().append("Write sector count: %02x", count);
sector_count_ = count;
}
uint8_t sector_count() const {
log_.info().append("Read sector count: %02x", sector_count_);
Logger::info().append("Read sector count: %02x", sector_count_);
return sector_count_;
}
void set_sector_number(const uint8_t number) {
log_.info().append("Write sector number: %02x", number);
Logger::info().append("Write sector number: %02x", number);
sector_number_ = number;
}
uint8_t sector_number() const {
log_.info().append("Read sector number: %02x", sector_number_);
Logger::info().append("Read sector number: %02x", sector_number_);
return sector_number_;
}
void set_cylinder_low(const uint8_t part) {
log_.info().append("Write cylinder low: %02x", part);
Logger::info().append("Write cylinder low: %02x", part);
cylinder_ = (cylinder_ & 0xff00) | part;
}
uint8_t cylinder_low() const {
log_.info().append("Read cylinder low: %02x", uint8_t(cylinder_));
Logger::info().append("Read cylinder low: %02x", uint8_t(cylinder_));
return uint8_t(cylinder_);
}
void set_cylinder_high(const uint8_t part) {
log_.info().append("Write cylinder high: %02x", part);
Logger::info().append("Write cylinder high: %02x", part);
cylinder_ = uint16_t((cylinder_ & 0x00ff) | (part << 8));
}
uint8_t cylinder_high() const {
log_.info().append("Read cylinder high: %02x", uint8_t(cylinder_ >> 8));
Logger::info().append("Read cylinder high: %02x", uint8_t(cylinder_ >> 8));
return uint8_t(cylinder_ >> 8);
}
void set_drive_head(const uint8_t drive_head) {
log_.info().append("Write drive/head: %02x", drive_head);
Logger::info().append("Write drive/head: %02x", drive_head);
drive_head_ = drive_head;
}
uint8_t drive_head() const {
log_.info().append("Read drive/head: %02x", drive_head_);
Logger::info().append("Read drive/head: %02x", drive_head_);
return drive_head_;
}
void set_command(const uint8_t command) {
log_.info().append("Command: %02x", command);
Logger::info().append("Command: %02x", command);
}
uint8_t status() {
log_.info().append("Read status");
Logger::info().append("Read status");
return 0x40; // i.e. drive ready.
}
@@ -94,20 +94,20 @@ public:
// Controller interface.
//
void set_controller_data(const uint8_t data) {
log_.info().append("Write controller data: %02x", data);
Logger::info().append("Write controller data: %02x", data);
controller_data_ = data;
}
uint8_t controller_data() const {
log_.info().append("Read controller data: %02x", controller_data_);
Logger::info().append("Read controller data: %02x", controller_data_);
return controller_data_;
}
void set_controller_status(const uint8_t status) {
log_.info().append("Write controller status: %02x", status);
Logger::info().append("Write controller status: %02x", status);
controller_status_ = status;
}
uint8_t controller_status() const {
log_.info().append("Read controller status: %02x", controller_status_);
Logger::info().append("Read controller status: %02x", controller_status_);
return controller_status_;
}
@@ -120,7 +120,7 @@ private:
uint8_t controller_data_;
uint8_t controller_status_;
mutable Log::Logger<Log::Source::IDE> log_;
using Logger = Log::Logger<Log::Source::IDE>;
};
}
+16 -17
View File
@@ -182,7 +182,7 @@ public:
const bool output_advanced = output_.run_for(cycles.as<int>());
const bool keyboard_advanced = keyboard_.run_for(cycles.as<int>());
if(output_advanced || keyboard_advanced) {
log_.info().append("Advancing output");
Logger::info().append("Advancing output");
check_irqs();
}
@@ -207,11 +207,11 @@ public:
void write(const uint16_t port, const uint8_t value) {
switch(port) {
default:
log_.error().append("Unimplemented AT keyboard write: %04x to %04x", value, port);
Logger::error().append("Unimplemented AT keyboard write: %04x to %04x", value, port);
break;
case 0x0060:
log_.info().append("Keyboard parameter set to %02x", value);
Logger::info().append("Keyboard parameter set to %02x", value);
phase_ = Phase::Data;
input_ = value;
has_input_ = true;
@@ -219,7 +219,7 @@ public:
break;
case 0x0061:
// log_.info().append("Port 61: %02x", value);
// Logger::info().append("Port 61: %02x", value);
// TODO:
// b7: 1 = reset IRQ 0
// b3: enable channel check
@@ -228,7 +228,7 @@ public:
break;
case 0x0064:
log_.info().append("Command byte: %02x", value);
Logger::info().append("Command byte: %02x", value);
command_ = Command(value);
has_command_ = true;
has_input_ = false;
@@ -241,7 +241,7 @@ public:
uint8_t read(const uint16_t port) {
switch(port) {
default:
log_.error().append("Unimplemented AT keyboard read from %04x", port);
Logger::error().append("Unimplemented AT keyboard read from %04x", port);
break;
case 0x0060: {
@@ -250,7 +250,7 @@ public:
keyboard_.output().restart_delay();
check_irqs();
}
log_.info().append("Read from keyboard controller of %02x", last_output_);
Logger::info().append("Read from keyboard controller of %02x", last_output_);
return last_output_;
}
@@ -278,7 +278,7 @@ public:
(is_tested_ ? 0x04 : 0x00) |
(has_input_ ? 0x02 : 0x00) |
(has_output() ? 0x01 : 0x00);
log_.info().append("Reading status: %02x", status);
Logger::info().append("Reading status: %02x", status);
return status;
}
}
@@ -333,7 +333,7 @@ private:
}
void transmit(const uint8_t value) {
log_.info().append("Enquing %02x", value);
Logger::info().append("Enquing %02x", value);
output_.append({value});
check_irqs();
}
@@ -348,7 +348,7 @@ private:
// No command => input only, which is a direct-to-device communication.
if(!has_command_) {
log_.info().append("Device command: %02x", input_);
Logger::info().append("Device command: %02x", input_);
control_ &= ~Control::InhibitKeyboard;
keyboard_.perform(input_);
// TODO: mouse?
@@ -364,21 +364,21 @@ private:
return;
}
log_.info().append("Performing: %02x", command_).append_if(has_input_, " / %02x", input_);
Logger::info().append("Performing: %02x", command_).append_if(has_input_, " / %02x", input_);
// Consume command and parameter, and execute.
has_command_ = false;
if(requires_parameter(command_)) has_input_ = false;
if(command_ >= Command::ResetBlockBegin) {
log_.info().append("Should reset: %x", command_ & 0x0f);
Logger::info().append("Should reset: %x", command_ & 0x0f);
if(!(command_ & 1)) {
cpu_control_->reset();
}
} else switch(command_) {
default:
log_.info().append("Unimplemented keyboard controller command: %02x", command_);
Logger::info().append("Unimplemented keyboard controller command: %02x", command_);
break;
case Command::WriteCommandByte:
@@ -428,7 +428,7 @@ private:
}
}
Log::Logger<Log::Source::Keyboard> log_;
using Logger = Log::Logger<Log::Source::Keyboard>;
PICs<model> &pics_;
Speaker &speaker_;
@@ -478,7 +478,7 @@ private:
switch(command) {
default:
log_.error().append("Unimplemented keyboard command: %02x", command);
Logger::error().append("Unimplemented keyboard command: %02x", command);
return;
// case 0xed:
@@ -510,7 +510,6 @@ private:
}
private:
Log::Logger<Log::Source::Keyboard> log_;
ByteQueue<50> output_;
} keyboard_;
@@ -534,7 +533,7 @@ private:
new_irq1 = control_ & Control::AllowKeyboardInterrupts;
}
pics_.pic[0].template apply_edge<1>(new_irq1);
log_.info().append("IRQ1: %d", new_irq1);
Logger::info().append("IRQ1: %d", new_irq1);
}
};
+10 -10
View File
@@ -58,7 +58,7 @@ bool should_log = false;
namespace PCCompatible {
namespace {
Log::Logger<Log::Source::PCCompatible> log;
using Logger = Log::Logger<Log::Source::PCCompatible>;
}
using Target = Analyser::Static::PCCompatible::Target;
@@ -247,7 +247,7 @@ private:
if(wilfully_unimplemented(port)) {
return;
}
log.error().append("Unhandled out: %02x to %04x", value, port);
Logger::error().append("Unhandled out: %02x to %04x", value, port);
};
template <typename IntT>
@@ -300,7 +300,7 @@ private:
case 0x0071: rtc_.write<1>(value); break;
case 0x00f1:
log.error().append("TODO: coprocessor reset");
Logger::error().append("TODO: coprocessor reset");
break;
case 0x0000: dma_.controllers[0].template write<0x0>(value); break;
@@ -343,7 +343,7 @@ private:
case 0x00a0:
if constexpr (is_xt(model)) {
// On the XT the NMI can be masked by setting bit 7 on I/O port 0xA0.
log.error().append("TODO: NMIs %s", (value & 0x80) ? "masked" : "unmasked");
Logger::error().append("TODO: NMIs %s", (value & 0x80) ? "masked" : "unmasked");
} else {
pics_.pic[1].template write<0>(value);
}
@@ -407,7 +407,7 @@ private:
case 0x03f4:
case 0x03f7:
fdc_.set_data_rate(value);
log.error().append("TODO: FDC (or IDE?) write of %02x at %04x", value, port);
Logger::error().append("TODO: FDC (or IDE?) write of %02x at %04x", value, port);
break;
case 0x03f5:
fdc_.write(value);
@@ -443,7 +443,7 @@ private:
if(wilfully_unimplemented(port)) {
return;
}
log.error().append("Unhandled in: %04x", port);
Logger::error().append("Unhandled in: %04x", port);
};
bool require_at(const uint16_t port) {
@@ -646,7 +646,7 @@ public:
halted_ = true;
}
void wait() {
log.error().append("WAIT ????");
Logger::error().append("WAIT ????");
}
void repeat_last() {
@@ -912,7 +912,7 @@ public:
InstructionSet::x86::fault(Exception::interrupt(interrupt_id), context_);
if(should_log) {
log.info().append("Taking interrupt vector %d", interrupt_id);
Logger::info().append("Taking interrupt vector %d", interrupt_id);
}
}
@@ -956,7 +956,7 @@ public:
// should_log = (decoded_ip_ >= 0x21d0 && decoded_ip_ < 0x221c);
if(should_log) {
log.info().append(
Logger::info().append(
"%04x %s \t\t[ds:6Bh]:%02x",
decoded_ip_,
to_string(decoded_, InstructionSet::x86::Model::i80286).c_str(),
@@ -978,7 +978,7 @@ public:
}
if(decoded_.second.operation() == InstructionSet::x86::Operation::Invalid) {
log.error().append("Invalid operation");
Logger::error().append("Invalid operation");
}
// Execute it.
+7 -7
View File
@@ -15,7 +15,7 @@ namespace PCCompatible {
// Cf. https://helppc.netcore2k.net/hardware/pic
class PIC {
using Log = Log::Logger<Log::Source::PIC>;
using Logger = Log::Logger<Log::Source::PIC>;
public:
template <int address>
void write(const uint8_t value) {
@@ -44,7 +44,7 @@ public:
}
} else {
mask_ = value;
Log::info().append("Mask set to %02x; requests now %02x", mask_, requests_);
Logger::info().append("Mask set to %02x; requests now %02x", mask_, requests_);
}
} else {
if(value & 0x10) {
@@ -63,7 +63,7 @@ public:
four_byte_vectors_ = value & 4;
level_triggered_ = value & 8;
Log::info().append("Level triggered: %d", level_triggered_);
Logger::info().append("Level triggered: %d", level_triggered_);
} else if(value & 0x08) {
//
// Operation Control Word 3.
@@ -83,7 +83,7 @@ public:
// b2, b1, b0: interrupt level to acknowledge.
switch(value >> 5) {
default:
Log::error().append("PIC: TODO EOI type %d\n", value >> 5);
Logger::error().append("PIC: TODO EOI type %d\n", value >> 5);
[[fallthrough]];
case 0b010: // No-op.
break;
@@ -115,7 +115,7 @@ public:
return mask_;
}
Log::error().append("Reading address 0");
Logger::error().append("Reading address 0");
return requests_;
}
@@ -146,7 +146,7 @@ public:
// requests_ |= (levels_ ^ old_levels) & new_bit;
// }
Log::info().append("%d to %d => requests now %02x", input, final_level, requests_);
Logger::info().append("%d to %d => requests now %02x", input, final_level, requests_);
}
bool pending() const {
@@ -166,7 +166,7 @@ public:
eoi_target_ = id;
awaiting_eoi_ = !auto_eoi_;
requests_ &= ~in_service_;
Log::info().append("Implicitly acknowledging: %d; requests now: %02x", id, requests_);
Logger::info().append("Implicitly acknowledging: %d; requests now: %02x", id, requests_);
return uint8_t(vector_base_ + id);
}
+2
View File
@@ -260,6 +260,8 @@ struct LogLine<source, false> {
template <Source source>
class Logger {
public:
Logger() = delete;
static constexpr bool InfoEnabled = enabled_level(source) == EnabledLevel::ErrorsAndInfo;
static constexpr bool ErrorsEnabled = enabled_level(source) >= EnabledLevel::Errors;
+2 -4
View File
@@ -10,9 +10,7 @@
#include "Outputs/Log.hpp"
namespace {
Log::Logger<Log::Source::PCMTrack> logger;
using Logger = Log::Logger<Log::Source::PCMTrack>;
}
using namespace Storage::Disk;
@@ -66,7 +64,7 @@ PCMTrack *PCMTrack::resampled_clone(Track *original, size_t bits_per_track) {
return pcm_original->resampled_clone(bits_per_track);
}
logger.error().append("NOT IMPLEMENTED: resampling non-PCMTracks");
Logger::error().append("NOT IMPLEMENTED: resampling non-PCMTracks");
return nullptr;
}
@@ -14,9 +14,7 @@
using namespace SCSI;
namespace {
Log::Logger<Log::Source::DirectAccessDevice> logger;
using Logger = Log::Logger<Log::Source::DirectAccessDevice>;
}
void DirectAccessDevice::set_storage(const std::shared_ptr<Storage::MassStorage::MassStorageDevice> &device) {
@@ -27,7 +25,7 @@ bool DirectAccessDevice::read(const Target::CommandState &state, Target::Respond
if(!device_) return false;
const auto specs = state.read_write_specs();
logger.info().append("Read: %d from %d", specs.number_of_blocks, specs.address);
Logger::info().append("Read: %d from %d", specs.number_of_blocks, specs.address);
std::vector<uint8_t> output = device_->get_block(specs.address);
for(uint32_t offset = 1; offset < specs.number_of_blocks; ++offset) {
@@ -46,7 +44,7 @@ bool DirectAccessDevice::write(const Target::CommandState &state, Target::Respon
if(!device_) return false;
const auto specs = state.read_write_specs();
logger.info().append("Write: %d to %d", specs.number_of_blocks, specs.address);
Logger::info().append("Write: %d to %d", specs.number_of_blocks, specs.address);
responder.receive_data(
device_->get_block_size() * specs.number_of_blocks,
+1 -1
View File
@@ -363,7 +363,7 @@ public:
private:
Executor executor_;
Log::Logger<Log::Source::SCSI> log_;
using Logger = Log::Logger<Log::Source::SCSI>;
// Bus::Observer.
void scsi_bus_did_change(Bus &, BusState, double) final;
@@ -181,7 +181,7 @@ constexpr uint8_t G5(const uint8_t opcode) { return 0xa0 | opcode; }
template <typename Executor> bool Target<Executor>::dispatch_command() {
CommandState arguments(command_, data_);
log_.info().append("---Command %02x---", command_[0]);
Logger::info().append("---Command %02x---", command_[0]);
switch(command_[0]) {
default: return false;
@@ -276,5 +276,5 @@ template <typename Executor> void Target<Executor>::end_command() {
bus_state_ = DefaultBusState;
set_device_output(bus_state_);
log_.info().append("---Done---");
Logger::info().append("---Done---");
}
+2 -4
View File
@@ -19,12 +19,10 @@
using namespace Storage::State;
namespace {
constexpr uint32_t block(const char *str) {
return uint32_t(str[0] | (str[1] << 8) | (str[2] << 16) | (str[3] << 24));
}
Log::Logger<Log::Source::SZX> logger;
using Logger = Log::Logger<Log::Source::SZX>;
}
std::unique_ptr<Analyser::Static::Target> SZX::load(const std::string &file_name) {
@@ -80,7 +78,7 @@ std::unique_ptr<Analyser::Static::Target> SZX::load(const std::string &file_name
switch(blockID) {
default:
logger.info().append("Unhandled block %c%c%c%c", char(blockID), char(blockID >> 8), char(blockID >> 16), char(blockID >> 24));
Logger::info().append("Unhandled block %c%c%c%c", char(blockID), char(blockID >> 8), char(blockID >> 16), char(blockID >> 24));
break;
// ZXSTZ80REGS
+2 -4
View File
@@ -14,11 +14,9 @@
using namespace Storage::Tape;
namespace {
constexpr unsigned int StandardTZXClock = 3500000;
constexpr unsigned int TZXClockMSMultiplier = 3500;
Log::Logger<Log::Source::TZX> logger;
using Logger = Log::Logger<Log::Source::TZX>;
}
TZX::TZX(const std::string &file_name) : file_name_(file_name) {
@@ -100,7 +98,7 @@ void TZX::Serialiser::push_next_pulses() {
default:
// In TZX each chunk has a different way of stating or implying its length,
// so there is no route past an unimplemented chunk.
logger.error().append("Unknown TZX chunk: %04x", chunk_id);
Logger::error().append("Unknown TZX chunk: %04x", chunk_id);
set_is_at_end(true);
return;
}
+2 -2
View File
@@ -15,7 +15,7 @@
#include "Outputs/Log.hpp"
namespace {
Log::Logger<Log::Source::TapeUEF> logger;
using Logger = Log::Logger<Log::Source::TapeUEF>;
}
using namespace Storage::Tape;
@@ -197,7 +197,7 @@ void UEF::Serialiser::push_next_pulses() {
break;
default:
logger.info().append("Skipping chunk of type %04x", next_chunk->id);
Logger::info().append("Skipping chunk of type %04x", next_chunk->id);
break;
}
}