diff --git a/Analyser/Static/Commodore/StaticAnalyser.cpp b/Analyser/Static/Commodore/StaticAnalyser.cpp index 52c3bb73b..066a0c105 100644 --- a/Analyser/Static/Commodore/StaticAnalyser.cpp +++ b/Analyser/Static/Commodore/StaticAnalyser.cpp @@ -209,10 +209,6 @@ Analyser::Static::TargetList Analyser::Static::Commodore::GetTargets( // Inspect discovered files to try to divine machine and memory model. auto vic_memory_model = Target::MemoryModel::Unexpanded; - if(files.size() > 1) { - printf(""); - } - auto it = files.begin(); while(it != files.end()) { const auto &file = *it; diff --git a/Machines/Commodore/1540/Implementation/C1540.cpp b/Machines/Commodore/1540/Implementation/C1540.cpp index ee7038f85..6a1b066c1 100644 --- a/Machines/Commodore/1540/Implementation/C1540.cpp +++ b/Machines/Commodore/1540/Implementation/C1540.cpp @@ -153,11 +153,11 @@ void MachineBase::process_index_hole() {} // MARK: - Drive VIA delegate -void MachineBase::drive_via_did_step_head(void *, int direction) { +void MachineBase::drive_via_did_step_head(void *, const int direction) { get_drive().step(Storage::Disk::HeadPosition(direction, 2)); } -void MachineBase::drive_via_did_set_data_density(void *, int density) { +void MachineBase::drive_via_did_set_data_density(void *, const int density) { set_expected_bit_length(Storage::Encodings::CommodoreGCR::length_of_a_bit_in_time_zone(unsigned(density))); } @@ -240,22 +240,22 @@ void DriveVIA::set_control_line_output(MOS::MOS6522::Port port, MOS::MOS6522::Li void DriveVIA::set_port_output(MOS::MOS6522::Port port, uint8_t value, uint8_t) { if(port) { if(previous_port_b_output_ != value) { - // record drive motor state + // Record drive motor state. drive_motor_ = value&4; - // check for a head step - int step_difference = ((value&3) - (previous_port_b_output_&3))&3; + // Check for a head step. + const int step_difference = ((value&3) - (previous_port_b_output_&3))&3; if(step_difference) { if(delegate_) delegate_->drive_via_did_step_head(this, (step_difference == 1) ? 1 : -1); } - // check for a change in density - int density_difference = (previous_port_b_output_^value) & (3 << 5); + // Check for a change in density. + const int density_difference = (previous_port_b_output_^value) & (3 << 5); if(density_difference && delegate_) { delegate_->drive_via_did_set_data_density(this, (value >> 5)&3); } - // post the LED status + // Post the LED status. if(observer_) observer_->set_led_status("Drive", value&8); previous_port_b_output_ = value; diff --git a/Machines/Commodore/Plus4/Plus4.cpp b/Machines/Commodore/Plus4/Plus4.cpp index 3c5a3b59a..81b9953c8 100644 --- a/Machines/Commodore/Plus4/Plus4.cpp +++ b/Machines/Commodore/Plus4/Plus4.cpp @@ -162,7 +162,7 @@ public: if(has_c1541) { c1541_ = std::make_unique(Commodore::C1540::Personality::C1541, roms); c1541_->set_serial_bus(serial_bus_); - serial_port_.set_bus(serial_bus_); + Commodore::Serial::attach(serial_port_, serial_bus_); } tape_player_ = std::make_unique(clock); @@ -215,29 +215,33 @@ public: *value = io_direction_; } else { const uint8_t all_inputs = - (tape_player_->input() ? 0x00 : 0x10) | + (tape_player_->input() ? 0x10 : 0x00) | (serial_port_.level(Commodore::Serial::Line::Data) ? 0x80 : 0x00) | (serial_port_.level(Commodore::Serial::Line::Clock) ? 0x40 : 0x00); *value = (io_direction_ & io_output_) | ((~io_direction_) & all_inputs); - printf("[%04x] In: %02x\n", m6502_.value_of(CPU::MOS6502::Register::ProgramCounter), *value); +// printf("[%04x] In: %02x\n", m6502_.value_of(CPU::MOS6502::Register::ProgramCounter), *value); +// printf("Input: %02x\n", *value); } } else { if(!address) { io_direction_ = *value; +// printf("Direction: %02x\n", io_direction_); } else { io_output_ = *value; +// printf("'Output': %02x\n", io_output_); } - const auto output = io_output_ & ~io_direction_; - tape_player_->set_motor_control(!(output & 0x08)); + const auto output = io_output_ | ~io_direction_; +// printf("Visible output: %02x\n\n", uint8_t(output)); + tape_player_->set_motor_control(~output & 0x08); serial_port_.set_output( - Commodore::Serial::Line::Data, Commodore::Serial::LineLevel(~output & 0x01)); + Commodore::Serial::Line::Data, Commodore::Serial::LineLevel(output & 0x01)); serial_port_.set_output( - Commodore::Serial::Line::Clock, Commodore::Serial::LineLevel(~output & 0x02)); + Commodore::Serial::Line::Clock, Commodore::Serial::LineLevel(output & 0x02)); serial_port_.set_output( - Commodore::Serial::Line::Attention, Commodore::Serial::LineLevel(~output & 0x04)); + Commodore::Serial::Line::Attention, Commodore::Serial::LineLevel(output & 0x04)); } // printf("%04x: %02x %c\n", address, *value, isReadOperation(operation) ? 'r' : 'w');