예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public Board(C64Interfaces.IVideoOutput video, C64Interfaces.IFile kernel, C64Interfaces.IFile basic, C64Interfaces.IFile charGen)
        {
            _systemCpu = new CPU.MOS6510((ushort)Map.CpuIOAddress, (ushort)Map.CpuIOSize, _memoryMaps[_currentMap], 1);
            _systemClock.OpFactory = _systemCpu.OpFactory;

            _systemCpu.Port.IOPort.OnPortOut += new IO.IOPort.PortOutDelegate(CpuPort_OnMemoryMapChanged);

            _systemCias = new IO.CIA[]
            {
                new IO.CIA((ushort)Map.Cia1RegistersAddress, (ushort)Map.Cia1RegistersSize, _systemCpu.IRQ, 0x00, 0x00),
                new IO.CIA((ushort)Map.Cia2RegistersAddress, (ushort)Map.Cia2RegistersSize, _systemCpu.IRQ, 0x3f, 0x06)
            };

            _systemVic = new Video.VIC((ushort)Map.VicRegistersAddress, (ushort)Map.VicRegistersSize, (ushort)Map.ColorRamAddress, (ushort)Map.ColorRamSize,
                _systemCpu.IRQ, video);

            _systemSid = new Audio.SID((ushort)Map.SidRegistersAddress, (ushort)Map.SidRegistersSize);

            _systemCias[1].PortA.OnPortOut += new IO.IOPort.PortOutDelegate(Cia1_PortA_OnPortOut);

            _serial = new IO.SerialPort();
            _sDataConn = new IO.SerialPort.BusLineConnection(_serial.DataLine);
            _sClockConn = new IO.SerialPort.BusLineConnection(_serial.ClockLine);

            _serial.ClockLine.OnLineChanged += new IO.SerialPort.LineChangedDelegate(ClockLine_OnLineChanged);
            _serial.DataLine.OnLineChanged += new IO.SerialPort.LineChangedDelegate(DataLine_OnLineChanged);

            _systemRam = new Memory.RAM(0, 0x10000);

            _kernelRom = new Memory.ROM((ushort)Map.KernelRomAddress, (ushort)Map.KernelRomSize, kernel);
            _basicRom = new Memory.ROM((ushort)Map.BasicRomAddress, (ushort)Map.BasicRomSize, basic);
            _charRom = new Memory.ROM((ushort)Map.CharRomAddress, (ushort)Map.CharRomSize, charGen);

            _charRomVic1 = new Memory.ROM((ushort)Map.CharRomAddress_Vic1, (ushort)Map.CharRomSize, charGen);
            _charRomVic2 = new Memory.ROM((ushort)Map.CharRomAddress_Vic2, (ushort)Map.CharRomSize, charGen);

            for (int i = 0; i < _memoryMaps.Length; i++)
            {
                _memoryMaps[i].Map(_systemRam, true);
                _memoryMaps[i].Map(_systemCpu.Port, true);

                if ((i & 2) != 0)
                {
                    _memoryMaps[i].Map(_kernelRom, Memory.MemoryMapEntry.AccessType.Read, true);

                    if ((i & 1) != 0)
                        _memoryMaps[i].Map(_basicRom, Memory.MemoryMapEntry.AccessType.Read, true);
                }

                if ((i & 3) != 0)
                {
                    if ((i & 4) != 0)
                    {
                        _memoryMaps[i].Map(_systemVic, true);
                        _memoryMaps[i].Map(_systemSid, true);
                        _memoryMaps[i].Map(_systemVic.ColorRam, true);
                        _memoryMaps[i].Map(_systemCias[0], true);
                        _memoryMaps[i].Map(_systemCias[1], true);
                    }
                    else
                        _memoryMaps[i].Map(_charRom, Memory.MemoryMapEntry.AccessType.Read, true);
                }
            }

            _systemVic.Memory.Map(_systemRam, true);
            _systemVic.Memory.Map(_charRomVic1, Memory.MemoryMapEntry.AccessType.Read, true);
            _systemVic.Memory.Map(_charRomVic2, Memory.MemoryMapEntry.AccessType.Read, true);

            _systemClock.QueueOpsStart(_systemVic.RasterLine.CreateOps(), 0);
            _systemCpu.Restart(_systemClock, 1);
            _systemClock.QueueOpsStart(_systemCias[0].CreateOps(), 2);
            _systemClock.QueueOpsStart(_systemCias[1].CreateOps(), 3);

            _systemClock.OnTimeSlice += new Clock.Clock.PhaseEndDelegate(_systemCias[0].IncrementTod);
            _systemClock.OnTimeSlice += new Clock.Clock.PhaseEndDelegate(_systemCias[1].IncrementTod);

            _systemClock.OnTimeSlice += new Clock.Clock.PhaseEndDelegate(_checkPendingStateOperations_OnTimeSlice);
        }
예제 #4
0
        public Board(C64Interfaces.IVideoOutput video, C64Interfaces.IFile kernel, C64Interfaces.IFile basic, C64Interfaces.IFile charGen)
        {
            _systemCpu             = new CPU.MOS6510((ushort)Map.CpuIOAddress, (ushort)Map.CpuIOSize, _memoryMaps[_currentMap], 1);
            _systemClock.OpFactory = _systemCpu.OpFactory;

            _systemCpu.Port.IOPort.OnPortOut += new IO.IOPort.PortOutDelegate(CpuPort_OnMemoryMapChanged);

            _systemCias = new IO.CIA[]
            {
                new IO.CIA((ushort)Map.Cia1RegistersAddress, (ushort)Map.Cia1RegistersSize, _systemCpu.IRQ, 0x00, 0x00),
                new IO.CIA((ushort)Map.Cia2RegistersAddress, (ushort)Map.Cia2RegistersSize, _systemCpu.IRQ, 0x3f, 0x06)
            };

            _systemVic = new Video.VIC((ushort)Map.VicRegistersAddress, (ushort)Map.VicRegistersSize, (ushort)Map.ColorRamAddress, (ushort)Map.ColorRamSize,
                                       _systemCpu.IRQ, video);

            _systemSid = new Audio.SID((ushort)Map.SidRegistersAddress, (ushort)Map.SidRegistersSize);

            _systemCias[1].PortA.OnPortOut += new IO.IOPort.PortOutDelegate(Cia1_PortA_OnPortOut);

            _serial     = new IO.SerialPort();
            _sDataConn  = new IO.SerialPort.BusLineConnection(_serial.DataLine);
            _sClockConn = new IO.SerialPort.BusLineConnection(_serial.ClockLine);

            _serial.ClockLine.OnLineChanged += new IO.SerialPort.LineChangedDelegate(ClockLine_OnLineChanged);
            _serial.DataLine.OnLineChanged  += new IO.SerialPort.LineChangedDelegate(DataLine_OnLineChanged);

            _systemRam = new Memory.RAM(0, 0x10000);

            _kernelRom = new Memory.ROM((ushort)Map.KernelRomAddress, (ushort)Map.KernelRomSize, kernel);
            _basicRom  = new Memory.ROM((ushort)Map.BasicRomAddress, (ushort)Map.BasicRomSize, basic);
            _charRom   = new Memory.ROM((ushort)Map.CharRomAddress, (ushort)Map.CharRomSize, charGen);

            _charRomVic1 = new Memory.ROM((ushort)Map.CharRomAddress_Vic1, (ushort)Map.CharRomSize, charGen);
            _charRomVic2 = new Memory.ROM((ushort)Map.CharRomAddress_Vic2, (ushort)Map.CharRomSize, charGen);

            for (int i = 0; i < _memoryMaps.Length; i++)
            {
                _memoryMaps[i].Map(_systemRam, true);
                _memoryMaps[i].Map(_systemCpu.Port, true);

                if ((i & 2) != 0)
                {
                    _memoryMaps[i].Map(_kernelRom, Memory.MemoryMapEntry.AccessType.Read, true);

                    if ((i & 1) != 0)
                    {
                        _memoryMaps[i].Map(_basicRom, Memory.MemoryMapEntry.AccessType.Read, true);
                    }
                }

                if ((i & 3) != 0)
                {
                    if ((i & 4) != 0)
                    {
                        _memoryMaps[i].Map(_systemVic, true);
                        _memoryMaps[i].Map(_systemSid, true);
                        _memoryMaps[i].Map(_systemVic.ColorRam, true);
                        _memoryMaps[i].Map(_systemCias[0], true);
                        _memoryMaps[i].Map(_systemCias[1], true);
                    }
                    else
                    {
                        _memoryMaps[i].Map(_charRom, Memory.MemoryMapEntry.AccessType.Read, true);
                    }
                }
            }

            _systemVic.Memory.Map(_systemRam, true);
            _systemVic.Memory.Map(_charRomVic1, Memory.MemoryMapEntry.AccessType.Read, true);
            _systemVic.Memory.Map(_charRomVic2, Memory.MemoryMapEntry.AccessType.Read, true);

            _systemClock.QueueOpsStart(_systemVic.RasterLine.CreateOps(), 0);
            _systemCpu.Restart(_systemClock, 1);
            _systemClock.QueueOpsStart(_systemCias[0].CreateOps(), 2);
            _systemClock.QueueOpsStart(_systemCias[1].CreateOps(), 3);

            _systemClock.OnTimeSlice += new Clock.Clock.PhaseEndDelegate(_systemCias[0].IncrementTod);
            _systemClock.OnTimeSlice += new Clock.Clock.PhaseEndDelegate(_systemCias[1].IncrementTod);

            _systemClock.OnTimeSlice += new Clock.Clock.PhaseEndDelegate(_checkPendingStateOperations_OnTimeSlice);
        }