Ejemplo n.º 1
0
        private void InitMedia(byte[] rom)
        {
            switch (C64FormatFinder.GetFormat(rom))
            {
            case C64Format.D64:
                var d64 = D64.Read(rom);
                if (d64 != null)
                {
                    _board.DiskDrive.InsertMedia(d64);
                }
                break;

            case C64Format.G64:
                var g64 = G64.Read(rom);
                if (g64 != null)
                {
                    _board.DiskDrive.InsertMedia(g64);
                }
                break;

            case C64Format.CRT:
                var cart = CartridgeDevice.Load(rom);
                if (cart != null)
                {
                    _board.CartPort.Connect(cart);
                }
                break;

            case C64Format.TAP:
                var tape = Tape.Load(rom);
                if (tape != null)
                {
                    _board.TapeDrive.Insert(tape);
                }
                break;

            case C64Format.Unknown:
                var prgDisk = new DiskBuilder
                {
                    Entries = new List <DiskBuilder.Entry>
                    {
                        new DiskBuilder.Entry
                        {
                            Closed       = true,
                            Data         = rom,
                            Locked       = false,
                            Name         = "PRG",
                            RecordLength = 0,
                            Type         = DiskBuilder.FileType.Program
                        }
                    }
                }.Build();
                if (prgDisk != null)
                {
                    _board.DiskDrive.InsertMedia(prgDisk);
                }
                break;
            }
        }
Ejemplo n.º 2
0
        private void InitMedia()
        {
            switch (_inputFileInfo.Extension.ToUpper())
            {
            case @".D64":
                var d64 = D64.Read(_inputFileInfo.Data);
                if (d64 != null)
                {
                    _board.DiskDrive.InsertMedia(d64);
                }
                break;

            case @".G64":
                var g64 = G64.Read(_inputFileInfo.Data);
                if (g64 != null)
                {
                    _board.DiskDrive.InsertMedia(g64);
                }
                break;

            case @".CRT":
                var cart = CartridgeDevice.Load(_inputFileInfo.Data);
                if (cart != null)
                {
                    _board.CartPort.Connect(cart);
                }
                break;

            case @".TAP":
                var tape = Tape.Load(_inputFileInfo.Data);
                if (tape != null)
                {
                    _board.TapeDrive.Insert(tape);
                }
                break;

            case @".PRG":
                if (_inputFileInfo.Data.Length > 2)
                {
                    _loadPrg = true;
                }
                break;
            }
        }