Esempio n. 1
0
        private void Init(MachineType machineType, BorderType borderType, TapeLoadSpeed tapeLoadSpeed, List <byte[]> files, List <JoystickType> joys)
        {
            _machineType = machineType;

            // setup the emulated model based on the MachineType
            switch (machineType)
            {
            case MachineType.ZXSpectrum16:
                _machine = new ZX16(this, _cpu, borderType, files, joys);
                var _systemRom16 = GetFirmware(0x4000, "48ROM");
                var romData16    = RomData.InitROM(machineType, _systemRom16);
                _machine.InitROM(romData16);
                break;

            case MachineType.ZXSpectrum48:
                _machine = new ZX48(this, _cpu, borderType, files, joys);
                var _systemRom = GetFirmware(0x4000, "48ROM");
                var romData    = RomData.InitROM(machineType, _systemRom);
                _machine.InitROM(romData);
                break;

            case MachineType.ZXSpectrum128:
                _machine = new ZX128(this, _cpu, borderType, files, joys);
                var _systemRom128 = GetFirmware(0x8000, "128ROM");
                var romData128    = RomData.InitROM(machineType, _systemRom128);
                _machine.InitROM(romData128);
                break;

            case MachineType.ZXSpectrum128Plus2:
                _machine = new ZX128Plus2(this, _cpu, borderType, files, joys);
                var _systemRomP2 = GetFirmware(0x8000, "PLUS2ROM");
                var romDataP2    = RomData.InitROM(machineType, _systemRomP2);
                _machine.InitROM(romDataP2);
                break;

            case MachineType.ZXSpectrum128Plus2a:
                _machine = new ZX128Plus2a(this, _cpu, borderType, files, joys);
                var _systemRomP4 = GetFirmware(0x10000, "PLUS2AROM");
                var romDataP4    = RomData.InitROM(machineType, _systemRomP4);
                _machine.InitROM(romDataP4);
                break;

            case MachineType.ZXSpectrum128Plus3:
                _machine = new ZX128Plus3(this, _cpu, borderType, files, joys);
                var _systemRomP3 = GetFirmware(0x10000, "PLUS3ROM");
                var romDataP3    = RomData.InitROM(machineType, _systemRomP3);
                _machine.InitROM(romDataP3);
                //System.Windows.Forms.MessageBox.Show("+3 is not working at all yet :/");
                break;

            case MachineType.Pentagon128:
                _machine = new Pentagon128(this, _cpu, borderType, files, joys);
                var _systemRomPen128 = GetFirmware(0x8000, "PentagonROM");
                var _systemRomTrdos  = GetFirmware(0x4000, "TRDOSROM");
                var conc             = _systemRomPen128.Concat(_systemRomTrdos).ToArray();
                var romDataPen128    = RomData.InitROM(machineType, conc);
                _machine.InitROM(romDataPen128);
                break;
            }
        }
Esempio n. 2
0
        public static RomData InitROM(MachineType machineType, byte[] rom)
        {
            RomData RD = new RomData();

            RD.RomBytes = new byte[rom.Length];
            RD.RomBytes = rom;

            switch (machineType)
            {
            case MachineType.ZXSpectrum48:
                RD.SaveBytesRoutineAddress       = 0x04C2;
                RD.SaveBytesResumeAddress        = 0x0000;
                RD.LoadBytesRoutineAddress       = 0x0808; //0x0556; //0x056C;
                RD.LoadBytesResumeAddress        = 0x05E2;
                RD.LoadBytesInvalidHeaderAddress = 0x05B6;
                break;

            case MachineType.ZXSpectrum128:
                RD.SaveBytesRoutineAddress       = 0x04C2;
                RD.SaveBytesResumeAddress        = 0x0000;
                RD.LoadBytesRoutineAddress       = 0x0808; //0x0556; //0x056C;
                RD.LoadBytesResumeAddress        = 0x05E2;
                RD.LoadBytesInvalidHeaderAddress = 0x05B6;
                break;
            }

            return(RD);
        }
Esempio n. 3
0
 /// <summary>
 /// Sets up the ROM
 /// </summary>
 /// <param name="buffer"></param>
 /// <param name="startAddress"></param>
 public override void InitROM(RomData romData)
 {
     RomData = romData;
     // 128k uses ROM0 and ROM1
     // 128k loader is in ROM0, and fallback 48k rom is in ROM1
     for (int i = 0; i < 0x4000; i++)
     {
         ROM0[i] = RomData.RomBytes[i];
         if (RomData.RomBytes.Length > 0x4000)
         {
             ROM1[i] = RomData.RomBytes[i + 0x4000];
         }
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Sets up the ROM
        /// </summary>
        /// <param name="buffer"></param>
        /// <param name="startAddress"></param>
        public override void InitROM(RomData romData)
        {
            RomData = romData;
            // +3 uses ROM0, ROM1, ROM2 & ROM3

            /*  ROM 0: 128k editor, menu system and self-test program
             *  ROM 1: 128k syntax checker
             *  ROM 2: +3DOS
             *  ROM 3: 48 BASIC
             */
            Stream stream = new MemoryStream(RomData.RomBytes);

            stream.Read(ROM0, 0, 16384);
            stream.Read(ROM1, 0, 16384);
            stream.Read(ROM2, 0, 16384);
            stream.Read(ROM3, 0, 16384);
            stream.Dispose();
        }
Esempio n. 5
0
 /// <summary>
 /// Sets up the ROM
 /// </summary>
 public abstract void InitROM(RomData romData);
Esempio n. 6
0
 /// <summary>
 /// Sets up the ROM
 /// </summary>
 public override void InitROM(RomData romData)
 {
     RomData = romData;
     // for 16/48k machines only ROM0 is used (no paging)
     RomData.RomBytes?.CopyTo(ROM0, 0);
 }