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:
parent
602e7f01c7
commit
8819711bc8
@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// 6522.hpp
|
||||
// Clock Signal
|
||||
//
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user