public Drive1541(int clockNum, int clockDen) { DriveRom = new Chip23128(); _cpu = new MOS6502X <CpuLink>(new CpuLink(this)) { NMI = false }; _ram = new int[0x800]; Via0 = Chip6522.Create(ViaReadClock, ViaReadData, ViaReadAtn, 8); Via1 = Chip6522.Create(ReadVia1PrA, ReadVia1PrB); _cpuClockNum = clockNum; _driveCpuClockNum = clockDen * 16000000; // 16mhz }
public Drive1541(int clockNum, int clockDen) { DriveRom = new Chip23128(); _cpu = new MOS6502X { ReadMemory = CpuRead, WriteMemory = CpuWrite, DummyReadMemory = CpuRead, PeekMemory = CpuPeek, NMI = false }; _ram = new int[0x800]; Via0 = Chip6522.Create(ViaReadClock, ViaReadData, ViaReadAtn, 8); Via1 = Chip6522.Create(ReadVia1PrA, ReadVia1PrB); _cpuClockNum = clockNum; _driveCpuClockNum = clockDen * 16000000; // 16mhz }
public Motherboard(C64 c64, C64.VicType initRegion, C64.BorderType borderType, C64.SidType sidType, C64.TapeDriveType tapeDriveType, C64.DiskDriveType diskDriveType) { // note: roms need to be added on their own externally _c64 = c64; int clockNum, clockDen; switch (initRegion) { case C64.VicType.Pal: clockNum = 17734475; clockDen = 18; break; case C64.VicType.Ntsc: clockNum = 14318181; clockDen = 14; break; case C64.VicType.NtscOld: clockNum = 11250000; clockDen = 11; break; case C64.VicType.Drean: clockNum = 14328225; clockDen = 14; break; default: throw new System.Exception(); } CartPort = new CartridgePort(); Cassette = new CassettePort(); ColorRam = new Chip2114(); Cpu = new Chip6510(); Pla = new Chip90611401(); Ram = new Chip4864(); Serial = new SerialPort(); switch (sidType) { case C64.SidType.OldR2: Sid = Chip6581R2.Create(44100, clockNum, clockDen); break; case C64.SidType.OldR3: Sid = Chip6581R3.Create(44100, clockNum, clockDen); break; case C64.SidType.OldR4AR: Sid = Chip6581R4AR.Create(44100, clockNum, clockDen); break; case C64.SidType.NewR5: Sid = Chip8580R5.Create(44100, clockNum, clockDen); break; } switch (initRegion) { case C64.VicType.Ntsc: Vic = Chip6567R8.Create(borderType); Cia0 = Chip6526.Create(C64.CiaType.Ntsc, Input_ReadKeyboard, Input_ReadJoysticks); Cia1 = Chip6526.Create(C64.CiaType.Ntsc, Cia1_ReadPortA); break; case C64.VicType.Pal: Vic = Chip6569.Create(borderType); Cia0 = Chip6526.Create(C64.CiaType.Pal, Input_ReadKeyboard, Input_ReadJoysticks); Cia1 = Chip6526.Create(C64.CiaType.Pal, Cia1_ReadPortA); break; case C64.VicType.NtscOld: Vic = Chip6567R56A.Create(borderType); Cia0 = Chip6526.Create(C64.CiaType.NtscRevA, Input_ReadKeyboard, Input_ReadJoysticks); Cia1 = Chip6526.Create(C64.CiaType.NtscRevA, Cia1_ReadPortA); break; case C64.VicType.Drean: Vic = Chip6572.Create(borderType); Cia0 = Chip6526.Create(C64.CiaType.Pal, Input_ReadKeyboard, Input_ReadJoysticks); Cia1 = Chip6526.Create(C64.CiaType.Pal, Cia1_ReadPortA); break; } User = new UserPort(); ClockNumerator = clockNum; ClockDenominator = clockDen; // Initialize disk drive switch (diskDriveType) { case C64.DiskDriveType.Commodore1541: case C64.DiskDriveType.Commodore1541II: DiskDrive = new Drive1541(ClockNumerator, ClockDenominator); Serial.Connect(DiskDrive); break; } // Initialize tape drive switch (tapeDriveType) { case C64.TapeDriveType.Commodore1530: TapeDrive = new TapeDrive(); Cassette.Connect(TapeDrive); break; } BasicRom = new Chip23128(); CharRom = new Chip23128(); KernalRom = new Chip23128(); }