public CBM1541(C64Interfaces.IFile kernel, IO.SerialPort serial) { _driveCpu = new CPU.MOS6502(_memory, 0); _driveClock.OpFactory = _driveCpu.OpFactory; _driveVias = new VIA[2] { new VIA((ushort)Map.Via1RegistersAddress, (ushort)Map.Via1RegistersSize, _driveCpu.IRQ), new VIA((ushort)Map.Via2RegistersAddress, (ushort)Map.Via2RegistersSize, _driveCpu.IRQ) }; _drive = new DiskDrive.Drive(_driveVias[1]); _drive.OnDataReady += new DiskDrive.Drive.DateReadyDelegate(drive_OnDataReady); _ram = new Memory.RAM((ushort)Map.RamAddress, (ushort)Map.RamSize); _rom = new Memory.ROM((ushort)Map.RomAddress, (ushort)Map.RomSize, kernel); _rom.Patch(IDLE_TRAP_ADDRES, IDLE_TRAP_OPCODE); for (int i = 0; i < PATCH_MAP.Length; i++) { _rom.Patch(PATCH_MAP[i], NOP_OPCODE); } _memory.Map(_ram, true); _memory.Map(_driveVias[0], true); _memory.Map(_driveVias[1], true); _memory.Map(_rom, Memory.MemoryMapEntry.AccessType.Read, true); _serial = serial; _sAtnaConn = new IO.SerialPort.BusLineConnection(_serial.DataLine); _sDataConn = new IO.SerialPort.BusLineConnection(_serial.DataLine); _sClockConn = new IO.SerialPort.BusLineConnection(_serial.ClockLine); _serial.OnAtnLineChanged += new IO.SerialPort.LineChangedDelegate(serial_OnAtnLineChanged); _serial.ClockLine.OnLineChanged += new IO.SerialPort.LineChangedDelegate(ClockLine_OnLineChanged); _serial.DataLine.OnLineChanged += new IO.SerialPort.LineChangedDelegate(DataLine_OnLineChanged); _driveVias[0].PortB.OnPortOut += new IO.IOPort.PortOutDelegate(PortB_OnPortOut); _driveCpu.Restart(_driveClock, 0); _driveClock.QueueOpsStart(_driveVias[0].CreateOps(), 1); _driveClock.QueueOpsStart(_driveVias[1].CreateOps(), 2); _driveClock.QueueOpsStart(_drive.CreateOps(), 3); }
public CBM1541(C64Interfaces.IFile kernel, IO.SerialPort serial) { _driveCpu = new CPU.MOS6502(_memory, 0); _driveClock.OpFactory = _driveCpu.OpFactory; _driveVias = new VIA[2] { new VIA((ushort)Map.Via1RegistersAddress, (ushort)Map.Via1RegistersSize, _driveCpu.IRQ), new VIA((ushort)Map.Via2RegistersAddress, (ushort)Map.Via2RegistersSize, _driveCpu.IRQ) }; _drive = new DiskDrive.Drive(_driveVias[1]); _drive.OnDataReady += new DiskDrive.Drive.DateReadyDelegate(drive_OnDataReady); _ram = new Memory.RAM((ushort)Map.RamAddress, (ushort)Map.RamSize); _rom = new Memory.ROM((ushort)Map.RomAddress, (ushort)Map.RomSize, kernel); _rom.Patch(IDLE_TRAP_ADDRES, IDLE_TRAP_OPCODE); for (int i = 0; i < PATCH_MAP.Length; i++) _rom.Patch(PATCH_MAP[i], NOP_OPCODE); _memory.Map(_ram, true); _memory.Map(_driveVias[0], true); _memory.Map(_driveVias[1], true); _memory.Map(_rom, Memory.MemoryMapEntry.AccessType.Read, true); _serial = serial; _sAtnaConn = new IO.SerialPort.BusLineConnection(_serial.DataLine); _sDataConn = new IO.SerialPort.BusLineConnection(_serial.DataLine); _sClockConn = new IO.SerialPort.BusLineConnection(_serial.ClockLine); _serial.OnAtnLineChanged += new IO.SerialPort.LineChangedDelegate(serial_OnAtnLineChanged); _serial.ClockLine.OnLineChanged += new IO.SerialPort.LineChangedDelegate(ClockLine_OnLineChanged); _serial.DataLine.OnLineChanged += new IO.SerialPort.LineChangedDelegate(DataLine_OnLineChanged); _driveVias[0].PortB.OnPortOut += new IO.IOPort.PortOutDelegate(PortB_OnPortOut); _driveCpu.Restart(_driveClock, 0); _driveClock.QueueOpsStart(_driveVias[0].CreateOps(), 1); _driveClock.QueueOpsStart(_driveVias[1].CreateOps(), 2); _driveClock.QueueOpsStart(_drive.CreateOps(), 3); }