1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-28 22:29:36 +00:00

Threw in the second VIA as a currently clearly incorrect thing.

This commit is contained in:
Thomas Harte 2016-07-05 22:22:09 -04:00
parent 602e7f01c7
commit 8819711bc8
3 changed files with 17 additions and 1 deletions

View File

@ -1,4 +1,4 @@
//
//
// 6522.hpp
// Clock Signal
//

View File

@ -18,6 +18,8 @@ Machine::Machine()
_serialPort->set_serial_port_via(_serialPortVIA);
_serialPortVIA->set_serial_port(_serialPort);
_serialPortVIA->set_delegate(this);
_driveVIA.set_delegate(this);
}
void Machine::set_serial_bus(std::shared_ptr<::Commodore::Serial::Bus> serial_bus)
@ -47,8 +49,16 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
else
_serialPortVIA->set_register(address, *value);
}
else if(address >= 0x1c00 && address <= 0x1c0f)
{
if(isReadOperation(operation))
*value = _driveVIA.get_register(address);
else
_driveVIA.set_register(address, *value);
}
_serialPortVIA->run_for_half_cycles(2);
_driveVIA.run_for_half_cycles(2);
return 1;
}

View File

@ -66,6 +66,11 @@ class SerialPortVIA: public MOS::MOS6522<SerialPortVIA>, public MOS::MOS6522IRQD
std::weak_ptr<::Commodore::Serial::Port> _serialPort;
};
class DriveVIA: public MOS::MOS6522<SerialPortVIA>, public MOS::MOS6522IRQDelegate {
public:
using MOS6522IRQDelegate::set_interrupt_status;
};
class SerialPort : public ::Commodore::Serial::Port {
public:
void set_input(::Commodore::Serial::Line line, bool value) {
@ -101,6 +106,7 @@ class Machine:
std::shared_ptr<SerialPortVIA> _serialPortVIA;
std::shared_ptr<SerialPort> _serialPort;
DriveVIA _driveVIA;
};
}