static void _Main(string[] args)
        {
            var deviceWasConnected = false;

            usb = new UsbHost(new CH376UsbHostHardware(UsbServiceProvider.GetCH376Ports("90.173.150.35", 1288)));

            do
            {
                var devInfo = usb.GetConnectedDeviceInfo(1);
                if (devInfo != null && !deviceWasConnected)
                {
                    deviceWasConnected = true;
                    Console.WriteLine("Connected!");
                    PrintDeviceInfo(1);
                    PrintFddInfo(usb, 1);
                }
                else if (devInfo == null && deviceWasConnected)
                {
                    deviceWasConnected = false;
                    Console.WriteLine("Disconnected...");
                }

                Thread.Sleep(100);
                usb.UpdateDeviceConnectionStatus();
            } while (!Console.KeyAvailable);
        }
        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();
        }
Beispiel #3
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;
 }
Beispiel #4
0
        static void _Main(string[] args)
        {
            var hw = new CH376UsbHostHardware(UsbServiceProvider.GetCH376Ports());

            hw.HardwareReset();
            var diskName = hw.InitDisk();

            if (diskName[0] == '*')
            {
                Console.WriteLine(diskName);
                return;
            }
            else
            {
                Console.WriteLine("Storage device detected: " + diskName);
            }

            dynamic diskTypeAndCapacity = hw.GetDiskTypeAndCapacity();

            Console.WriteLine($"Total size: {diskTypeAndCapacity.totalSizeMb} MB");
            Console.WriteLine($"Free size:  {diskTypeAndCapacity.freeSizeMb} MB");
            Console.WriteLine($"Filesystem: {diskTypeAndCapacity.filesystem}");
            Console.WriteLine();

            string[] files;
            hw.InitFilesystem();
            files = hw.EnumerateFiles("/");
            if (files.Length == 0)
            {
                Console.WriteLine("*** No files found");
            }
            else
            {
                Console.WriteLine("Files found:");
                foreach (var name in files)
                {
                    Console.WriteLine(name);
                }

                Console.WriteLine();
            }

            Console.WriteLine("Files found in DSK:");
            files = hw.EnumerateFiles("/DSK");
            foreach (var name in files)
            {
                Console.WriteLine(name);
            }

            Console.WriteLine("Writing file... " + hw.WriteFileContents("NBASICX.TXT", longString));
            Console.WriteLine();

            Console.WriteLine();
            if (!hw.ChangeDir("/DSK"))
            {
                Console.WriteLine("*** Can't change to dir DSK");
            }
            else
            {
                Console.WriteLine("Contents of DSK/NBASIC.TXT:");
                Console.Write(hw.ReadFileContents("NBASIC.TXT"));
            }

            Console.ReadKey();
            return;

            /////

            var deviceWasConnected = false;

            usb = new UsbHost(new CH376UsbHostHardware(UsbServiceProvider.GetCH376Ports("90.173.150.35", 1288)));

            do
            {
                var devInfo = usb.GetConnectedDeviceInfo(1);
                if (devInfo != null && !deviceWasConnected)
                {
                    deviceWasConnected = true;
                    Console.WriteLine("Connected!");
                    PrintDeviceInfo(1);
                    PrintFddInfo(usb, 1);
                }
                else if (devInfo == null && deviceWasConnected)
                {
                    deviceWasConnected = false;
                    Console.WriteLine("Disconnected...");
                }

                Thread.Sleep(100);
                usb.UpdateDeviceConnectionStatus();
            } while (!Console.KeyAvailable);
        }