1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-27 00:30:26 +00:00

Merge pull request #1450 from TomHarte/LatestWarnings

Resolve GCC ubuntu-latest build warnings.
This commit is contained in:
Thomas Harte 2025-01-09 16:32:50 -05:00 committed by GitHub
commit 79c89af6ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 19 deletions

View File

@ -87,7 +87,7 @@ std::optional<BASICAnalysis> analyse(const File &file) {
} }
uint16_t line_address = file.starting_address; uint16_t line_address = file.starting_address;
int previous_line_number = -1; // int previous_line_number = -1;
const auto byte = [&](uint16_t address) { const auto byte = [&](uint16_t address) {
return file.data[address - file.starting_address]; return file.data[address - file.starting_address];
@ -115,7 +115,7 @@ std::optional<BASICAnalysis> analyse(const File &file) {
} }
const auto next_line_address = word(line_address); const auto next_line_address = word(line_address);
const auto line_number = word(line_address + 2); // const auto line_number = word(line_address + 2);
uint16_t code = line_address + 4; uint16_t code = line_address + 4;
const auto next = [&]() -> uint8_t { const auto next = [&]() -> uint8_t {
@ -153,7 +153,7 @@ std::optional<BASICAnalysis> analyse(const File &file) {
break; break;
} }
previous_line_number = line_number; // previous_line_number = line_number;
line_address = next_line_address; line_address = next_line_address;
} }

View File

@ -33,11 +33,10 @@ ROM::Request Machine::rom_request(Personality personality) {
MachineBase::MachineBase(Personality personality, const ROM::Map &roms) : MachineBase::MachineBase(Personality personality, const ROM::Map &roms) :
Storage::Disk::Controller(1000000), Storage::Disk::Controller(1000000),
m6502_(*this), m6502_(*this),
serial_port_VIA_port_handler_(serial_port_VIA_),
drive_VIA_(drive_VIA_port_handler_), drive_VIA_(drive_VIA_port_handler_),
serial_port_VIA_(serial_port_VIA_port_handler_) { serial_port_VIA_(serial_port_VIA_port_handler_) {
// Attach the serial port to its VIA and vice versa. // Attach the serial port to its VIA and vice versa.
serial_port_.set_serial_port_via(serial_port_VIA_port_handler_); serial_port_.connect(serial_port_VIA_port_handler_, serial_port_VIA_);
serial_port_VIA_port_handler_.set_serial_port(serial_port_); serial_port_VIA_port_handler_.set_serial_port(serial_port_);
// Set this instance as the delegate to receive interrupt requests from both VIAs. // Set this instance as the delegate to receive interrupt requests from both VIAs.
@ -163,8 +162,6 @@ void MachineBase::drive_via_did_set_data_density(void *, const int density) {
// MARK: - SerialPortVIA // MARK: - SerialPortVIA
SerialPortVIA::SerialPortVIA(MOS::MOS6522::MOS6522<SerialPortVIA> &via) : via_(via) {}
uint8_t SerialPortVIA::get_port_input(MOS::MOS6522::Port port) { uint8_t SerialPortVIA::get_port_input(MOS::MOS6522::Port port) {
if(port) return port_b_; if(port) return port_b_;
return 0xff; return 0xff;
@ -180,7 +177,11 @@ void SerialPortVIA::set_port_output(MOS::MOS6522::Port port, uint8_t value, uint
} }
} }
void SerialPortVIA::set_serial_line_state(::Commodore::Serial::Line line, bool value) { void SerialPortVIA::set_serial_line_state(
::Commodore::Serial::Line line,
bool value,
MOS::MOS6522::MOS6522<SerialPortVIA> &via
) {
switch(line) { switch(line) {
default: break; default: break;
case ::Commodore::Serial::Line::Data: port_b_ = (port_b_ & ~0x01) | (value ? 0x00 : 0x01); break; case ::Commodore::Serial::Line::Data: port_b_ = (port_b_ & ~0x01) | (value ? 0x00 : 0x01); break;
@ -188,7 +189,7 @@ void SerialPortVIA::set_serial_line_state(::Commodore::Serial::Line line, bool v
case ::Commodore::Serial::Line::Attention: case ::Commodore::Serial::Line::Attention:
attention_level_input_ = !value; attention_level_input_ = !value;
port_b_ = (port_b_ & ~0x80) | (value ? 0x00 : 0x80); port_b_ = (port_b_ & ~0x80) | (value ? 0x00 : 0x80);
via_.set_control_line_input(MOS::MOS6522::Port::A, MOS::MOS6522::Line::One, !value); via.set_control_line_input(MOS::MOS6522::Port::A, MOS::MOS6522::Line::One, !value);
update_data_line(); update_data_line();
break; break;
} }
@ -274,9 +275,10 @@ void DriveVIA::set_activity_observer(Activity::Observer *observer) {
// MARK: - SerialPort // MARK: - SerialPort
void SerialPort::set_input(Serial::Line line, Serial::LineLevel level) { void SerialPort::set_input(Serial::Line line, Serial::LineLevel level) {
serial_port_VIA_->set_serial_line_state(line, bool(level)); serial_port_via_->set_serial_line_state(line, bool(level), *via_);
} }
void SerialPort::set_serial_port_via(SerialPortVIA &serialPortVIA) { void SerialPort::connect(SerialPortVIA &serial_port_via, MOS::MOS6522::MOS6522<SerialPortVIA> &via) {
serial_port_VIA_ = &serialPortVIA; serial_port_via_ = &serial_port_via;
via_ = &via;
} }

View File

@ -39,17 +39,14 @@ namespace Commodore::C1540 {
*/ */
class SerialPortVIA: public MOS::MOS6522::IRQDelegatePortHandler { class SerialPortVIA: public MOS::MOS6522::IRQDelegatePortHandler {
public: public:
SerialPortVIA(MOS::MOS6522::MOS6522<SerialPortVIA> &via);
uint8_t get_port_input(MOS::MOS6522::Port); uint8_t get_port_input(MOS::MOS6522::Port);
void set_port_output(MOS::MOS6522::Port, uint8_t value, uint8_t mask); void set_port_output(MOS::MOS6522::Port, uint8_t value, uint8_t mask);
void set_serial_line_state(::Commodore::Serial::Line, bool); void set_serial_line_state(::Commodore::Serial::Line, bool, MOS::MOS6522::MOS6522<SerialPortVIA> &);
void set_serial_port(Commodore::Serial::Port &); void set_serial_port(Commodore::Serial::Port &);
private: private:
MOS::MOS6522::MOS6522<SerialPortVIA> &via_;
uint8_t port_b_ = 0x0; uint8_t port_b_ = 0x0;
Commodore::Serial::Port *serial_port_ = nullptr; Commodore::Serial::Port *serial_port_ = nullptr;
bool attention_acknowledge_level_ = false; bool attention_acknowledge_level_ = false;
@ -111,11 +108,12 @@ private:
*/ */
class SerialPort : public ::Commodore::Serial::Port { class SerialPort : public ::Commodore::Serial::Port {
public: public:
void set_input(Commodore::Serial::Line, Commodore::Serial::LineLevel); void set_input(Commodore::Serial::Line, Commodore::Serial::LineLevel) override;
void set_serial_port_via(SerialPortVIA &); void connect(SerialPortVIA &, MOS::MOS6522::MOS6522<SerialPortVIA>&);
private: private:
SerialPortVIA *serial_port_VIA_ = nullptr; SerialPortVIA *serial_port_via_ = nullptr;
MOS::MOS6522::MOS6522<SerialPortVIA> *via_ = nullptr;
}; };
class MachineBase: class MachineBase:

View File

@ -43,6 +43,7 @@ CommodoreTAP::Serialiser::Serialiser(const std::string &file_name) :
current_pulse_.length.clock_rate = static_cast<unsigned int>( current_pulse_.length.clock_rate = static_cast<unsigned int>(
[&] { [&] {
switch(platform_) { switch(platform_) {
default:
case Platform::Vic20: // It empirically seems like Vic-20 waves are counted with C64 timings? case Platform::Vic20: // It empirically seems like Vic-20 waves are counted with C64 timings?
case Platform::C64: return video_ == VideoStandard::PAL ? 985'248 : 1'022'727; case Platform::C64: return video_ == VideoStandard::PAL ? 985'248 : 1'022'727;
case Platform::C16: return video_ == VideoStandard::PAL ? 886'722 : 894'886; case Platform::C16: return video_ == VideoStandard::PAL ? 886'722 : 894'886;