Skip to content

Commit

Permalink
Merge pull request #1450 from TomHarte/LatestWarnings
Browse files Browse the repository at this point in the history
Resolve GCC ubuntu-latest build warnings.
  • Loading branch information
TomHarte authored Jan 9, 2025
2 parents 58ef91a + 56f10a9 commit 79c89af
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Analyser/Static/Commodore/StaticAnalyser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ std::optional<BASICAnalysis> analyse(const File &file) {
}

uint16_t line_address = file.starting_address;
int previous_line_number = -1;
// int previous_line_number = -1;

const auto byte = [&](uint16_t address) {
return file.data[address - file.starting_address];
Expand Down Expand Up @@ -115,7 +115,7 @@ std::optional<BASICAnalysis> analyse(const File &file) {
}

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;
const auto next = [&]() -> uint8_t {
Expand Down Expand Up @@ -153,7 +153,7 @@ std::optional<BASICAnalysis> analyse(const File &file) {
break;
}

previous_line_number = line_number;
// previous_line_number = line_number;
line_address = next_line_address;
}

Expand Down
20 changes: 11 additions & 9 deletions Machines/Commodore/1540/Implementation/C1540.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ ROM::Request Machine::rom_request(Personality personality) {
MachineBase::MachineBase(Personality personality, const ROM::Map &roms) :
Storage::Disk::Controller(1000000),
m6502_(*this),
serial_port_VIA_port_handler_(serial_port_VIA_),
drive_VIA_(drive_VIA_port_handler_),
serial_port_VIA_(serial_port_VIA_port_handler_) {
// 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_);

// Set this instance as the delegate to receive interrupt requests from both VIAs.
Expand Down Expand Up @@ -163,8 +162,6 @@ void MachineBase::drive_via_did_set_data_density(void *, const int density) {

// MARK: - SerialPortVIA

SerialPortVIA::SerialPortVIA(MOS::MOS6522::MOS6522<SerialPortVIA> &via) : via_(via) {}

uint8_t SerialPortVIA::get_port_input(MOS::MOS6522::Port port) {
if(port) return port_b_;
return 0xff;
Expand All @@ -180,15 +177,19 @@ 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) {
default: break;
case ::Commodore::Serial::Line::Data: port_b_ = (port_b_ & ~0x01) | (value ? 0x00 : 0x01); break;
case ::Commodore::Serial::Line::Clock: port_b_ = (port_b_ & ~0x04) | (value ? 0x00 : 0x04); break;
case ::Commodore::Serial::Line::Attention:
attention_level_input_ = !value;
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();
break;
}
Expand Down Expand Up @@ -274,9 +275,10 @@ void DriveVIA::set_activity_observer(Activity::Observer *observer) {
// MARK: - SerialPort

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) {
serial_port_VIA_ = &serialPortVIA;
void SerialPort::connect(SerialPortVIA &serial_port_via, MOS::MOS6522::MOS6522<SerialPortVIA> &via) {
serial_port_via_ = &serial_port_via;
via_ = &via;
}
12 changes: 5 additions & 7 deletions Machines/Commodore/1540/Implementation/C1540Base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,14 @@ namespace Commodore::C1540 {
*/
class SerialPortVIA: public MOS::MOS6522::IRQDelegatePortHandler {
public:
SerialPortVIA(MOS::MOS6522::MOS6522<SerialPortVIA> &via);

uint8_t get_port_input(MOS::MOS6522::Port);

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 &);

private:
MOS::MOS6522::MOS6522<SerialPortVIA> &via_;
uint8_t port_b_ = 0x0;
Commodore::Serial::Port *serial_port_ = nullptr;
bool attention_acknowledge_level_ = false;
Expand Down Expand Up @@ -111,11 +108,12 @@ class DriveVIA: public MOS::MOS6522::IRQDelegatePortHandler {
*/
class SerialPort : public ::Commodore::Serial::Port {
public:
void set_input(Commodore::Serial::Line, Commodore::Serial::LineLevel);
void set_serial_port_via(SerialPortVIA &);
void set_input(Commodore::Serial::Line, Commodore::Serial::LineLevel) override;
void connect(SerialPortVIA &, MOS::MOS6522::MOS6522<SerialPortVIA>&);

private:
SerialPortVIA *serial_port_VIA_ = nullptr;
SerialPortVIA *serial_port_via_ = nullptr;
MOS::MOS6522::MOS6522<SerialPortVIA> *via_ = nullptr;
};

class MachineBase:
Expand Down
1 change: 1 addition & 0 deletions Storage/Tape/Formats/CommodoreTAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ CommodoreTAP::Serialiser::Serialiser(const std::string &file_name) :
current_pulse_.length.clock_rate = static_cast<unsigned int>(
[&] {
switch(platform_) {
default:
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::C16: return video_ == VideoStandard::PAL ? 886'722 : 894'886;
Expand Down

0 comments on commit 79c89af

Please sign in to comment.