Ejemplo n.º 1
0
        public Motherboard(C64 c64, C64.VicType initRegion)
        {
            // note: roms need to be added on their own externally
            _c64 = c64;
            int clockNum, clockDen, mainsFrq;

            switch (initRegion)
            {
            case C64.VicType.PAL:
                clockNum = 17734475;
                clockDen = 18;
                mainsFrq = 50;
                break;

            case C64.VicType.NTSC:
            case C64.VicType.NTSC_OLD:
                clockNum = 11250000;
                clockDen = 11;
                mainsFrq = 60;
                break;

            case C64.VicType.DREAN:
                clockNum = 14328225;
                clockDen = 14;
                mainsFrq = 50;
                break;

            default:
                throw new System.Exception();
            }
            cartPort = new CartridgePort();
            cassPort = new CassettePortDevice();
            cia0     = new MOS6526(clockNum, clockDen * mainsFrq);
            cia1     = new MOS6526(clockNum, clockDen * mainsFrq);
            colorRam = new Chip2114();
            cpu      = new MOS6510();
            pla      = new MOSPLA();
            ram      = new Chip4864();
            serPort  = new SerialPort();
            sid      = MOS6581.Create(44100, clockNum, clockDen);
            switch (initRegion)
            {
            case C64.VicType.NTSC: vic = MOS6567R8.Create(); break;

            case C64.VicType.PAL: vic = MOS6569.Create(); break;

            case C64.VicType.NTSC_OLD: vic = MOS6567R56A.Create(); break;

            case C64.VicType.DREAN: vic = MOS6572.Create(); break;
            }
            userPort = new UserPortDevice();
        }
Ejemplo n.º 2
0
        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();
        }