Esempio n. 1
0
        private FileSystemPlugin(PluginContext context, IDictionary <string, object> pluginConfig)
        {
            var defaultConfig = new Dictionary <string, object>
            {
                { "integratedDirectory", "$MyDocuments$/NestorMSX/FileSystem" },
                { "volumeLabel", "NestorMSX" }
            };

            defaultConfig.MergeInto(pluginConfig);

            basePath = pluginConfig.GetValue <string>("integratedDirectory")
                       .Replace("/", "\\")
                       .AsAbsolutePath();
            volumeLabel        = pluginConfig.GetValue <string>("volumeLabel");
            currentFullDir     = basePath;
            currentRelativeDir = "";

            this.cpu                    = context.Cpu;
            this.regs                   = cpu.Registers;
            this.slotsSystem            = context.SlotsSystem;
            this.mem                    = this.slotsSystem;
            cpu.BeforeInstructionFetch += CpuOnBeforeInstructionFetch;

            hookedMethods = new Dictionary <int, Action>
            {
                { 0x4020, ALLOC },
                { 0x4023, FFIRST },
                { 0x4026, FNEXT },
                { 0x4029, CHDIR },
                { 0x402C, GETCD },
                { 0x402F, GETVOL }
            };
        }
        public RookieDriveFddPlugin(PluginContext context, IDictionary <string, object> pluginConfig)
        {
            kernelRoutines = new Dictionary <ushort, Action>
            {
                { 0x4010, DSKIO },
                { 0x4013, () => DSKCHG_GETDPB(true) },
                { 0x4016, () => DSKCHG_GETDPB(false) },
                { 0x4019, CHOICE },
                { 0x401C, DSKFMT },
                { 0x401F, MTOFF }
            };

            addressOfCallInihrd = pluginConfig.GetValueOrDefault <ushort>("addressOfCallInihrd", 0x176F);
            addressOfCallDrives = pluginConfig.GetValueOrDefault <ushort>("addressOfCallDrives", 0x1850);

            this.slotNumber     = new SlotNumber(pluginConfig.GetValue <byte>("NestorMSX.slotNumber"));
            this.kernelFilePath = pluginConfig.GetMachineFilePath(pluginConfig.GetValueOrDefault("kernelFile", "MsxDosKernel.rom"));

            this.z80    = context.Cpu;
            this.memory = context.SlotsSystem;

            z80.BeforeInstructionFetch += (sender, args) => BeforeZ80InstructionFetch(z80.Registers.PC);

            this.kernelContents = File.ReadAllBytes(kernelFilePath);
            ValidateKernelFileContents(kernelContents);

            host = new UsbHost(new CH376UsbHostHardware(UsbServiceProvider.GetCH376Ports()));
            UpdateCbiInstance();
        }
Esempio n. 3
0
 public RookieDrivePortsPlugin(PluginContext context, IDictionary <string, object> pluginConfig)
 {
     context.Cpu.MemoryAccess += Cpu_MemoryAccess;
     chPorts = new CH376PortsViaNoobtocol((string)pluginConfig["serialPortNumber"]);
     cpu     = context.Cpu;
     slots   = context.SlotsSystem;
     context.Cpu.BeforeInstructionFetch += Cpu_BeforeInstructionFetch;
     ParseSymbols(@"C:\code\fun\RookieDrive\msx\.sym");
     addressesToLog = symbolsToLog.ToDictionary(s => symbolsByName[s], s => s);
     //cpu.BeforeInstructionExecution += Cpu_BeforeInstructionExecution;
 }
Esempio n. 4
0
 public RookieDrivePortsPlugin(PluginContext context, IDictionary <string, object> pluginConfig)
 {
     context.Cpu.MemoryAccess += Cpu_MemoryAccess;
     chPorts = UsbServiceProvider.GetCH376Ports();
     cpu     = context.Cpu;
     slots   = context.SlotsSystem;
     context.Cpu.BeforeInstructionFetch += Cpu_BeforeInstructionFetch;
     ParseSymbols(@"C:\code\fun\RookieDrive\msx\.sym");
     addressesToLog = symbolsToLog.ToDictionary(s => symbolsByName[s], s => s);
     //cpu.BeforeInstructionExecution += Cpu_BeforeInstructionExecution;
 }
Esempio n. 5
0
        private TcpipUnapiPlugin(PluginContext context, IDictionary <string, object> pluginConfig)
        {
            slotNumber = new SlotNumber((byte)pluginConfig["NestorMSX.slotNumber"]);
            cpu        = context.Cpu;
            slots      = context.SlotsSystem;
            cpu.BeforeInstructionFetch += Cpu_BeforeInstructionFetch;

            bool hasIp(NetworkInterface iface, string ip)
            {
                return(iface.GetIPProperties().UnicastAddresses.Any(a => a.Address.ToString() == ip));
            }

            bool hasIpv4Address(NetworkInterface iface)
            {
                return(iface.GetIPProperties().UnicastAddresses.Any(a => IsIPv4(a.Address)));
            }

            var ipAddress         = pluginConfig.GetValueOrDefault("ipAddress", "");
            var networkInterfaces = NetworkInterface.GetAllNetworkInterfaces()
                                    .Where(i => i.Supports(NetworkInterfaceComponent.IPv4));

            if (ipAddress == "")
            {
                networkInterface =
                    networkInterfaces.FirstOrDefault(i => hasIpv4Address(i) && i.NetworkInterfaceType != NetworkInterfaceType.Loopback)
                    ?? networkInterfaces.FirstOrDefault(i => hasIpv4Address(i));
                ipInfo = networkInterface?.GetIPProperties().UnicastAddresses.First(a => IsIPv4(a.Address));
            }
            else
            {
                networkInterface = networkInterfaces.FirstOrDefault(i => hasIp(i, ipAddress));
                ipInfo           = networkInterface?.GetIPProperties().UnicastAddresses.First(a => a.Address.ToString() == ipAddress);
            }

            if (networkInterface == null)
            {
                throw new Exception(ipAddress == "" ?
                                    "No IPv4 network interfaces available" :
                                    $"There is no network interface with the IP address {ipAddress}");
            }

            dnsServersAvailable = networkInterface.GetIPProperties().DnsAddresses.Any();
            mtu = (short)Math.Min(32767, networkInterface.GetIPProperties().GetIPv4Properties().Mtu);

            InitRoutinesArray();
        }