public BusPeripheralsHooksPythonEngine(SystemBus sysbus, IBusPeripheral peripheral, string readScript = null, string writeScript = null)
        {
            Peripheral  = peripheral;
            Sysbus      = sysbus;
            ReadScript  = readScript;
            WriteScript = writeScript;

            InnerInit();

            if (WriteScript != null)
            {
                WriteHook = new Func <uint, long, uint>((valueToWrite, offset) =>
                {
                    Scope.SetVariable("value", valueToWrite);
                    Scope.SetVariable("offset", offset);
                    WriteSource.Value.Execute(Scope);
                    return((uint)Scope.GetVariable("value"));
                });
            }

            if (ReadScript != null)
            {
                ReadHook = new Func <uint, long, uint>((readValue, offset) =>
                {
                    Scope.SetVariable("value", readValue);
                    Scope.SetVariable("offset", offset);
                    ReadSource.Value.Execute(Scope);
                    return((uint)Scope.GetVariable("value"));
                });
            }
        }
Пример #2
0
 protected DmaBufferDescriptor(SystemBus bus, uint address, bool isExtendedModeEnabled)
 {
     Bus = bus;
     DescriptorAddress     = address;
     IsExtendedModeEnabled = isExtendedModeEnabled;
     SizeInBytes           = InitWords();
 }
Пример #3
0
        public CPU_6502(IClock clock, SystemBus bus) : base(clock)
        {
            this.bus = bus ?? throw new ArgumentNullException(nameof(bus));

            resetOp        = new Op(Reset, IMP, false);
            interruptOp    = new Op(Interrupt, IMP, false);
            interruptNMIOp = new Op(InterruptNMI, IMP, false);

            opCodes = new[]
            {
                new Op(BRK, IMP, false), new Op(ORA, IZX, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(ORA, ZP0, false), new Op(ASL, ZP0, false), new Op(X, IMP, false), new Op(PHP, IMP, false), new Op(ORA, IMM, false), new Op(ASL, ACC, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(ORA, ABS, false), new Op(ASL, ABS, false), new Op(X, IMP, false),
                new Op(BPL, REL, false), new Op(ORA, IZY, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(ORA, ZPX, false), new Op(ASL, ZPX, false), new Op(X, IMP, false), new Op(CLC, IMP, false), new Op(ORA, ABY, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(ORA, ABX, false), new Op(ASL, ABX, true), new Op(X, IMP, false),
                new Op(JSR, ABS, false), new Op(AND, IZX, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(BIT, ZP0, false), new Op(AND, ZP0, false), new Op(ROL, ZP0, false), new Op(X, IMP, false), new Op(PLP, IMP, false), new Op(AND, IMM, false), new Op(ROL, ACC, false), new Op(X, IMP, false), new Op(BIT, ABS, false), new Op(AND, ABS, false), new Op(ROL, ABS, false), new Op(X, IMP, false),
                new Op(BMI, REL, false), new Op(AND, IZY, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(AND, ZPX, false), new Op(ROL, ZPX, false), new Op(X, IMP, false), new Op(SEC, IMP, false), new Op(AND, ABY, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(AND, ABX, false), new Op(ROL, ABX, true), new Op(X, IMP, false),
                new Op(RTI, IMP, false), new Op(EOR, IZX, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(EOR, ZP0, false), new Op(LSR, ZP0, false), new Op(X, IMP, false), new Op(PHA, IMP, false), new Op(EOR, IMM, false), new Op(LSR, ACC, false), new Op(X, IMP, false), new Op(JMP, ABS, false), new Op(EOR, ABS, false), new Op(LSR, ABS, false), new Op(X, IMP, false),
                new Op(BVC, REL, false), new Op(EOR, IZY, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(EOR, ZPX, false), new Op(LSR, ZPX, false), new Op(X, IMP, false), new Op(CLI, IMP, false), new Op(EOR, ABY, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(EOR, ABX, false), new Op(LSR, ABX, true), new Op(X, IMP, false),
                new Op(RTS, IMP, false), new Op(ADC, IZX, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(ADC, ZP0, false), new Op(ROR, ZP0, false), new Op(X, IMP, false), new Op(PLA, IMP, false), new Op(ADC, IMM, false), new Op(ROR, ACC, false), new Op(X, IMP, false), new Op(JMP, IND, false), new Op(ADC, ABS, false), new Op(ROR, ABS, false), new Op(X, IMP, false),
                new Op(BVS, REL, false), new Op(ADC, IZY, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(ADC, ZPX, false), new Op(ROR, ZPX, false), new Op(X, IMP, false), new Op(SEI, IMP, false), new Op(ADC, ABY, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(ADC, ABX, false), new Op(ROR, ABX, true), new Op(X, IMP, false),
                new Op(X, IMP, false), new Op(STA, IZX, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(STY, ZP0, false), new Op(STA, ZP0, false), new Op(STX, ZP0, false), new Op(X, IMP, false), new Op(DEY, IMP, false), new Op(X, IMP, false), new Op(TXA, IMP, false), new Op(X, IMP, false), new Op(STY, ABS, false), new Op(STA, ABS, false), new Op(STX, ABS, false), new Op(X, IMP, false),
                new Op(BCC, REL, false), new Op(STA, IZY, true), new Op(X, IMP, false), new Op(X, IMP, false), new Op(STY, ZPX, false), new Op(STA, ZPX, false), new Op(STX, ZPY, false), new Op(X, IMP, false), new Op(TYA, IMP, false), new Op(STA, ABY, true), new Op(TXS, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(STA, ABX, true), new Op(X, IMP, false), new Op(X, IMP, false),
                new Op(LDY, IMM, false), new Op(LDA, IZX, false), new Op(LDX, IMM, false), new Op(X, IMP, false), new Op(LDY, ZP0, false), new Op(LDA, ZP0, false), new Op(LDX, ZP0, false), new Op(X, IMP, false), new Op(TAY, IMP, false), new Op(LDA, IMM, false), new Op(TAX, IMP, false), new Op(X, IMP, false), new Op(LDY, ABS, false), new Op(LDA, ABS, false), new Op(LDX, ABS, false), new Op(X, IMP, false),
                new Op(BCS, REL, false), new Op(LDA, IZY, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(LDY, ZPX, false), new Op(LDA, ZPX, false), new Op(LDX, ZPY, false), new Op(X, IMP, false), new Op(CLV, IMP, false), new Op(LDA, ABY, false), new Op(TSX, IMP, false), new Op(X, IMP, false), new Op(LDY, ABX, false), new Op(LDA, ABX, false), new Op(LDX, ABY, false), new Op(X, IMP, false),
                new Op(CPY, IMM, false), new Op(CMP, IZX, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(CPY, ZP0, false), new Op(CMP, ZP0, false), new Op(DEC, ZP0, false), new Op(X, IMP, false), new Op(INY, IMP, false), new Op(CMP, IMM, false), new Op(DEX, IMP, false), new Op(X, IMP, false), new Op(CPY, ABS, false), new Op(CMP, ABS, false), new Op(DEC, ABS, false), new Op(X, IMP, false),
                new Op(BNE, REL, false), new Op(CMP, IZY, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(CMP, ZPX, false), new Op(DEC, ZPX, false), new Op(X, IMP, false), new Op(CLD, IMP, false), new Op(CMP, ABY, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(CMP, ABX, false), new Op(DEC, ABX, true), new Op(X, IMP, false),
                new Op(CPX, IMM, false), new Op(SBC, IZX, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(CPX, ZP0, false), new Op(SBC, ZP0, false), new Op(INC, ZP0, false), new Op(X, IMP, false), new Op(INX, IMP, false), new Op(SBC, IMM, false), new Op(NOP, IMP, false), new Op(X, IMP, false), new Op(CPX, ABS, false), new Op(SBC, ABS, false), new Op(INC, ABS, false), new Op(X, IMP, false),
                new Op(BEQ, REL, false), new Op(SBC, IZY, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(SBC, ZPX, false), new Op(INC, ZPX, false), new Op(X, IMP, false), new Op(SED, IMP, false), new Op(SBC, ABY, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(X, IMP, false), new Op(SBC, ABX, false), new Op(INC, ABX, true), new Op(X, IMP, false)
            };

            StartOp(opCodes[0xEA]); // NOP
        }
        public BusPeripheralsHooksPythonEngine(SystemBus sysbus, IBusPeripheral peripheral, string readScript = null, string writeScript = null)
        {       
            Peripheral = peripheral;
            Sysbus = sysbus;
            ReadScript = readScript;
            WriteScript = writeScript;

            InnerInit();

            if (WriteScript != null)
            {
                WriteHook = new Func<uint, long, uint>((valueToWrite, offset) =>
                    {
                        Scope.SetVariable("value", valueToWrite);
                        Scope.SetVariable("offset", offset);
                        WriteSource.Value.Execute(Scope);
                        return (uint)Scope.GetVariable("value");
                    });
            }

            if (ReadScript != null)
            {
                ReadHook = new Func<uint, long, uint>((readValue, offset) =>
                    {
                        Scope.SetVariable("value", readValue);
                        Scope.SetVariable("offset", offset);
                        ReadSource.Value.Execute(Scope);
                        return (uint)Scope.GetVariable("value");
                    });
            }
        }
Пример #5
0
 internal PeripheralCollection(SystemBus sysbus)
 {
     this.sysbus = sysbus;
     blocks = new Block[0];
     shortBlocks = new Dictionary<long, Block>();
     sync = new object();
     InvalidateLastBlock();
 }
            protected DmaBufferDescriptor(SystemBus bus, uint address)
            {
                this.bus    = bus;
                BaseAddress = address;

                words = new uint[2];
                Invalidate();
            }
Пример #7
0
 public DmaBufferDescriptorsQueue(SystemBus bus, uint baseAddress, Func <SystemBus, uint, T> creator)
 {
     this.bus         = bus;
     this.creator     = creator;
     this.baseAddress = baseAddress;
     descriptors      = new List <T>();
     GoToNextDescriptor();
 }
Пример #8
0
        public static void SetHookBeforePeripheralWrite(this SystemBus sysbus, IBusPeripheral peripheral, string pythonScript, Range?subrange = null)
        {
            var runner = new BusPeripheralsHooksPythonEngine(sysbus, peripheral, null, pythonScript);

            sysbus.SetHookBeforePeripheralWrite <uint>(peripheral, runner.WriteHook, subrange);
            sysbus.SetHookBeforePeripheralWrite <ushort>(peripheral, (valueToWrite, offset) => (ushort)runner.WriteHook(valueToWrite, offset), subrange);
            sysbus.SetHookBeforePeripheralWrite <byte>(peripheral, (valueToWrite, offset) => (byte)runner.WriteHook(valueToWrite, offset), subrange);
        }
Пример #9
0
        public static void SetHookAfterPeripheralRead(this SystemBus sysbus, IBusPeripheral peripheral, string pythonScript, Range?subrange = null)
        {
            var runner = new BusPeripheralsHooksPythonEngine(sysbus, peripheral, pythonScript);

            sysbus.SetHookAfterPeripheralRead <uint>(peripheral, runner.ReadHook, subrange);
            sysbus.SetHookAfterPeripheralRead <ushort>(peripheral, (readValue, offset) => (ushort)runner.ReadHook(readValue, offset), subrange);
            sysbus.SetHookAfterPeripheralRead <byte>(peripheral, (readValue, offset) => (byte)runner.ReadHook(readValue, offset), subrange);
        }
Пример #10
0
 public ActorSystem()
 {
     //root = new Actor(new State(), "root");
     root       = Actor.Create(new State(), "root");
     registry   = new Registry(root);
     systemBus  = new SystemBus();
     messageBus = new MessageBus();
     dispatcher = new Dispatcher(systemBus, messageBus, registry);
 }
        public static void LoadAtags(this SystemBus bus, String bootargs, uint memorySize, uint beginAddress)
        {
            var atags = Misc.CreateAtags(bootargs, memorySize);
            //Fill ATAGs
            var addr = beginAddress;

            foreach (var elem in atags)
            {
                bus.WriteDoubleWord(addr, elem);
                addr += 4;
            }
        }
        public WatchpointHookPythonEngine(SystemBus sysbus, string script)
        {
            this.sysbus = sysbus;
            this.script = script;

            InnerInit();
            Hook = (address, width) =>
            {
                Scope.SetVariable("address", address);
                Scope.SetVariable("width", width);
                source.Value.Execute(Scope);
            };
        }
Пример #13
0
        public WatchpointHookPythonEngine(SystemBus sysbus, string script)
        {
            this.sysbus = sysbus;
            this.script = script;

            InnerInit();
            Hook = (address, width) =>
            {
                Scope.SetVariable("address", address);
                Scope.SetVariable("width", width);
                source.Value.Execute(Scope);
            };
        }
Пример #14
0
        public PPU(IClock clock, SystemBus bus) : base(clock)
        {
            this.bus = bus;

            nameTable[0] = new byte[1024];
            nameTable[1] = new byte[1024];

            Size = new Size(256, 240);

            displayedBuffer        = new RgbColor[Size.Width * Size.Height];
            notDisplayedBuffer     = new RgbColor[Size.Width * Size.Height];
            patternTableDisplay[0] = new PatternTableDisp(this, 0);
            patternTableDisplay[1] = new PatternTableDisp(this, 1);

            renderFrame = RenderFrame(false).GetEnumerator();
        }
Пример #15
0
        public WatchpointHookPythonEngine(SystemBus sysbus, string script)
        {
            this.sysbus = sysbus;
            this.script = script;

            InnerInit();
            Hook = (cpu, address, width, value) =>
            {
                Scope.SetVariable("cpu", cpu);
                Scope.SetVariable("address", address);
                Scope.SetVariable("width", width);
                Scope.SetVariable("value", value);
                Execute(code, error =>
                {
                    this.sysbus.Log(LogLevel.Error, "Python runtime error: {0}", error);
                });
            };
        }
Пример #16
0
        public Machine()
        {
            LocalTimeSource             = new SlaveTimeSource(this);
            LocalTimeSource.TimePassed += HandleTimeProgress;

            collectionSync        = new object();
            pausingSync           = new object();
            disposedSync          = new object();
            clockSource           = new BaseClockSource();
            localNames            = new Dictionary <IPeripheral, string>();
            PeripheralsGroups     = new PeripheralsGroupsManager(this);
            ownLifes              = new HashSet <IHasOwnLife>();
            pausedState           = new PausedState(this);
            SystemBus             = new SystemBus(this);
            registeredPeripherals = new MultiTree <IPeripheral, IRegistrationPoint>(SystemBus);
            userStateHook         = delegate
            {
            };
            userState = string.Empty;
            SetLocalName(SystemBus, SystemBusName);
        }
Пример #17
0
        public BusPeripheralsHooksPythonEngine(SystemBus sysbus, IBusPeripheral peripheral, string readScript = null, string writeScript = null)
        {
            Peripheral  = peripheral;
            Sysbus      = sysbus;
            ReadScript  = readScript;
            WriteScript = writeScript;

            InnerInit();

            if (WriteScript != null)
            {
                WriteHook = new Func <uint, long, uint>((valueToWrite, offset) =>
                {
                    Scope.SetVariable("value", valueToWrite);
                    Scope.SetVariable("offset", offset);
                    Execute(writeCode, error =>
                    {
                        Sysbus.Log(LogLevel.Error, "Python runtime error: {0}", error);
                    });
                    return((uint)Scope.GetVariable("value"));
                });
            }

            if (ReadScript != null)
            {
                ReadHook = new Func <uint, long, uint>((readValue, offset) =>
                {
                    Scope.SetVariable("value", readValue);
                    Scope.SetVariable("offset", offset);
                    Execute(readCode, error =>
                    {
                        Sysbus.Log(LogLevel.Error, "Python runtime error: {0}", error);
                    });
                    return((uint)Scope.GetVariable("value"));
                });
            }
        }
Пример #18
0
        public NES()
        {
            //clock = new SystemClock(200000);
            clock = new SystemClock(5369318); // 1/4 speed of real system, but emulate-able
            //clock = new SystemClock(21477272); // True speed

            bus = new SystemBus(0xFFFF);
            RAM ram = new RAM(2048);

            ppu            = new PPU(clock, bus);
            cpu            = new CPU_2A03(new ClockDivider(clock, 3), bus); // 3x slower than PPU
            apu            = new APU(new ClockDivider(clock, 6));           // 6x slower than PPU
            controllers[0] = new Controller(0x4016);
            controllers[1] = new Controller(0x4017);

            bus.AddComponent(ram, new BusAddressRange(0x0000, 0x1FFF));
            bus.AddComponent(ppu, new BusAddressRange(0x2000, 0x3FFF));
            bus.AddComponent(apu, new BusAddressRange(0x4000, 0x4013));
            bus.AddComponent(cpu, new BusAddressRange(0x4014, 0x4014));
            bus.AddComponent(apu, new BusAddressRange(0x4015, 0x4015));
            bus.AddComponent((Controller)controllers[0], new BusAddressRange(0x4016, 0x4016));
            bus.AddComponent((Controller)controllers[1], new BusAddressRange(0x4017, 0x4017));
            bus.AddComponent(apu, new BusAddressRange(0x4017, 0x4017));
        }
Пример #19
0
 public Descriptor(SystemBus sysbus)
 {
     this.sysbus = sysbus;
 }
Пример #20
0
 public void SetSysbusAndMachine(SystemBus bus)
 {
     Scope.SetVariable("sysbus", bus);
     Scope.SetVariable("machine", bus.Machine);
 }
Пример #21
0
 public SysbusWriter(SystemBus bus, ulong startAddress, int length) : base(bus, startAddress, length)
 {
 }
Пример #22
0
 protected SysbusReaderWriterBase(SystemBus bus, ulong startAddress, int length)
 {
     this.bus       = bus;
     currentAddress = startAddress;
     bytesLeft      = length;
 }
Пример #23
0
 public receiveDescriptor(SystemBus sysbus)
 {
     sbus = sysbus;
 }
Пример #24
0
 public transmitDescriptor(SystemBus sysbus)
 {
     sbus = sysbus;
 }
Пример #25
0
 public Descriptor(SystemBus sysbus)
 {
     this.sysbus = sysbus;
 }
Пример #26
0
        public Cartridge(string filePath, SystemBus bus)
        {
            using (BinaryReader reader = new BinaryReader(new FileStream(filePath, FileMode.Open)))
            {
                if (reader.BaseStream.Length < 16)
                {
                    return;
                }

                byte[] header = reader.ReadBytes(16);
                if (header[0] != 'N' || header[1] != 'E' || header[2] != 'S' || header[3] != 0x1A)
                {
                    return;
                }

                byte   mapperId = (byte)((header[7] & 0xF0) | (header[6] >> 4));
                byte   chrBankCount;
                ushort prgBankCount;
                if ((header[7] & 0x0C) != 0x08)
                {
                    // v1 format
                    prgBankCount = header[4];
                    chrBankCount = header[5];
                    info         = (InfoFlags)(header[6] & 0x0F);
                    timing       = (Timing)(header[9] & 0x01);
                }
                else
                {
                    // v2 format
                    prgBankCount = (ushort)(((header[9] & 0x0F) << 8) | header[4]);
                    chrBankCount = header[5];
                    info         = (InfoFlags)(header[6] & 0x0F);
                    timing       = (Timing)(header[12] & 0x03);
                }

                if (timing != Timing.NTSC)
                {
                    Console.WriteLine("WARNING: Loaded non-NTSC ROM");
                }

                //if (info.HasFlag(InfoFlags.Trainer))
                //{
                //    trainerData = new byte[512];
                //    reader.Read(trainerData, 0, trainerData.Length);
                //}

                int prgSize = prgBankCount * Utils.Kilo16;
                prgData = new byte[prgSize];
                int countRead = reader.Read(prgData, 0, prgSize);
                Debug.Assert(countRead == prgSize);

                int chrSize = chrBankCount * Utils.Kilo8;
                chrData   = new byte[chrSize];
                countRead = reader.Read(chrData, 0, chrSize);
                Debug.Assert(countRead == chrSize);

                if (chrSize == 0)
                {
                    chrData = new byte[Utils.Kilo8]; // Cartridge has RAM?
                }
                MirrorMode cartMirrorMode = info.HasFlag(InfoFlags.Mirroring) ? MirrorMode.Vertical : MirrorMode.Horizontal;
                if (mapperId == 0)
                {
                    // Fix some simple incorrect mapping IDs
                    if (chrBankCount > 1)
                    {
                        mapperId = 3;
                    }
                    else if (prgBankCount > 2)
                    {
                        mapperId = 2;
                    }
                }

                switch (mapperId)
                {
                case 0: mapper = new Mapper000(prgBankCount, chrBankCount, cartMirrorMode); break;

                case 1: mapper = new Mapper001(prgBankCount, chrBankCount, cartMirrorMode, info); break;

                case 2: mapper = new Mapper002(prgBankCount, chrBankCount, cartMirrorMode); break;

                case 3: mapper = new Mapper003(prgBankCount, chrBankCount, cartMirrorMode); break;

                case 4: mapper = new Mapper004(prgBankCount, chrBankCount, cartMirrorMode, bus); break;

                default:
                    throw new NotImplementedException("Mapper " + mapperId + " is not implemented");
                }
            }
        }
Пример #27
0
        public static void AddWatchpointHook(this SystemBus sysbus, long address, Width width, Access access, string pythonScript)
        {
            var engine = new WatchpointHookPythonEngine(sysbus, pythonScript);

            sysbus.AddWatchpointHook(address, width, access, true, engine.Hook);
        }
        public static void LoadFdt(this SystemBus sysbus, string file, long address, string bootargs = null, bool append = true, string excludedNodes = "")
        {
            var fdtBlob = File.ReadAllBytes(file);

            if (bootargs == null)
            {
                sysbus.WriteBytes(fdtBlob, address, true);
                return;
            }
            var fdt        = new FlattenedDeviceTree(fdtBlob);
            var chosenNode = fdt.Root.Subnodes.FirstOrDefault(x => x.Name == "chosen");

            if (chosenNode == null)
            {
                chosenNode = new TreeNode {
                    Name = "chosen"
                };
                fdt.Root.Subnodes.Add(chosenNode);
            }
            var bootargsProperty = chosenNode.Properties.FirstOrDefault(x => x.Name == "bootargs");

            if (bootargsProperty == null)
            {
                bootargsProperty = new Property("bootargs", new byte[] { 0 });
                chosenNode.Properties.Add(bootargsProperty);
            }
            var oldBootargs = bootargsProperty.GetDataAsString();

            if (append)
            {
                bootargs = oldBootargs + bootargs;
            }
            if (oldBootargs != bootargs)
            {
                sysbus.DebugLog("Bootargs altered from '{0}' to '{1}'.", oldBootargs, bootargs);
            }
            bootargsProperty.PutDataAsString(bootargs);

            var excludedNodeNames = excludedNodes.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            byte[] disabledValue = Encoding.ASCII.GetBytes("disabled");
            foreach (var deviceName in excludedNodeNames)
            {
                TreeNode node = fdt.Root.Descendants.FirstOrDefault(x => x.Name == deviceName);
                if (node == null)
                {
                    throw new RecoverableException(String.Format("Device {0} not found.", deviceName));
                }
                else
                {
                    Property statusProperty = node.Properties.FirstOrDefault(x => x.Name == "status");
                    if (statusProperty != null)
                    {
                        node.Properties.Remove(statusProperty);
                    }
                    statusProperty = new Property("status", disabledValue);
                    node.Properties.Add(statusProperty);
                }
            }

            fdtBlob = fdt.GetBinaryBlob();
            sysbus.WriteBytes(fdtBlob, address, true);
        }
 public SysbusReader(SystemBus bus, long startAddress, int length) : base(bus, startAddress, length)
 {
 }
Пример #30
0
 public CPU_2A03(IClock clock, SystemBus bus) : base(clock, bus)
 {
     this.bus = bus;
 }
Пример #31
0
 public transmitDescriptor(SystemBus sysbus)
 {
     sbus = sysbus;
 }
Пример #32
0
 public rxBufferDescriptor(SystemBus sysbus)
 {
     sbus = sysbus;
 }
Пример #33
0
 public RxDescriptor(SystemBus sysbus) : base(sysbus)
 {
 }
Пример #34
0
 public static void Register(this SystemBus sysbus, IBusPeripheral peripheral, Range range)
 {
     sysbus.Register(peripheral, new BusRangeRegistration(range));
 }
 public void SetSysbusAndMachine(SystemBus bus)
 {
     Scope.SetVariable("sysbus", bus);
     Scope.SetVariable(Machine.MachineKeyword, bus.Machine);
 }
Пример #36
0
 public receiveDescriptor(SystemBus sysbus)
 {
     sbus = sysbus;
 }
Пример #37
0
 public SystemConsole()
 {
     bus = new SystemBus();
 }
Пример #38
0
 public DmaRxBufferDescriptor(SystemBus bus, uint address, bool isExtendedModeEnabled) :
     base(bus, address, isExtendedModeEnabled)
 {
 }
Пример #39
0
 public RxDescriptor(SystemBus sysbus) : base(sysbus)
 {
 }