1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-30 07:55:01 +00:00

Added further comments.

This commit is contained in:
Thomas Harte 2016-07-10 08:01:16 -04:00
parent d8334edf4a
commit 824d9ea92b

View File

@ -13,19 +13,22 @@ using namespace Commodore::C1540;
Machine::Machine() Machine::Machine()
{ {
// create a serial port and a VIA to run it
_serialPortVIA.reset(new SerialPortVIA); _serialPortVIA.reset(new SerialPortVIA);
_serialPort.reset(new SerialPort); _serialPort.reset(new SerialPort);
// attach the serial port to its VIA and vice versa
_serialPort->set_serial_port_via(_serialPortVIA); _serialPort->set_serial_port_via(_serialPortVIA);
_serialPortVIA->set_serial_port(_serialPort); _serialPortVIA->set_serial_port(_serialPort);
// set this instance as the delegate to receive interrupt requests from both VIAs
_serialPortVIA->set_delegate(this); _serialPortVIA->set_delegate(this);
_driveVIA.set_delegate(this); _driveVIA.set_delegate(this);
} }
void Machine::set_serial_bus(std::shared_ptr<::Commodore::Serial::Bus> serial_bus) void Machine::set_serial_bus(std::shared_ptr<::Commodore::Serial::Bus> serial_bus)
{ {
_serialPort->set_serial_bus(serial_bus); Commodore::Serial::AttachPortAndBus(_serialPort, serial_bus);
serial_bus->add_port(_serialPort);
} }
unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value) unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value)
@ -42,6 +45,14 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
} }
if(log) printf("[%c %04x] ", isReadOperation(operation) ? 'r' : 'w', address);*/ if(log) printf("[%c %04x] ", isReadOperation(operation) ? 'r' : 'w', address);*/
/*
Memory map (given that I'm unsure yet on any potential mirroring):
0x00000x07ff RAM
0x18000x180f the serial-port VIA
0x1c000x1c0f the drive VIA
0xc0000xffff ROM
*/
if(address < 0x800) if(address < 0x800)
{ {
if(isReadOperation(operation)) if(isReadOperation(operation))
@ -84,5 +95,6 @@ void Machine::set_rom(const uint8_t *rom)
void Machine::mos6522_did_change_interrupt_status(void *mos6522) void Machine::mos6522_did_change_interrupt_status(void *mos6522)
{ {
// both VIAs are connected to the IRQ line
set_irq_line(_serialPortVIA->get_interrupt_line() || _driveVIA.get_interrupt_line()); set_irq_line(_serialPortVIA->get_interrupt_line() || _driveVIA.get_interrupt_line());
} }