Esempio n. 1
0
        public void Update()
        {
            if (!IsPreconditionMet())
            {
                throw new Exception("Precondition is not met.");
            }

            Items.Clear();

            for (int i = 0; i < global.SelectedUnitCount; i++)
            {
                MemoryMapping memMapping = new MemoryMapping();
                memMapping.Module       = this.MemMapping.Module;
                memMapping.StartAddress = this.MemMapping.StartAddress;
                int[] preOffsets = new int[this.MemMapping.PreOffsets.Length + 1];
                for (int j = 0; j < this.MemMapping.PreOffsets.Length; j++)
                {
                    preOffsets[j] = this.MemMapping.PreOffsets[j];
                }
                preOffsets[this.MemMapping.PreOffsets.Length] = 0;
                memMapping.PreOffsets = preOffsets;
                memMapping.Offset     = i * 4;

                Unit unit = new Unit(global);
                unit.MemMapping = memMapping;

                this.Add(unit);
            }
        }
Esempio n. 2
0
 private void Start()
 {
     if (!MemoryMapping.CreateMemoryMappedFIle())
     {
         Debug.LogWarning("Could not open Memory File.");
     }
 }
Esempio n. 3
0
 public Board(Configuration configuration)
 {
     this.configuration = configuration;
     this.ram           = new Ram(0x10000);
     this.ports         = new InputOutput();
     this.CPU           = new Intel8080(this, this.ports);
     this.disassembler  = new Disassembler(this);
     this.mapping       = new MemoryMapping(this.ram, 0x0000, (ushort)Mask.Sixteen, AccessLevel.ReadWrite);
 }
Esempio n. 4
0
        public Board(Configuration configuration)
        {
            this.configuration = configuration;
            this.ram           = new Ram(0x10000);
            this.CPU           = new M6502(this);
            this.symbols       = new Symbols();
            this.disassembler  = new Disassembler(this, this.CPU, this.symbols);
            this.mapping       = new MemoryMapping(this.ram, 0x0000, (ushort)Mask.Sixteen, AccessLevel.ReadWrite);

            this.oldPC = (ushort)Mask.Sixteen;
        }
Esempio n. 5
0
        public void SetMemory(long address, long initialValue)
        {
            long value = ApplyBitmaskFunction(initialValue);

            Console.WriteLine($"Setting memory at '{address}' from '{initialValue}' to '{value}'");
            if (MemoryMapping.ContainsKey(address))
            {
                MemoryMapping[address] = value;
            }
            else
            {
                MemoryMapping.Add(address, value);
            }
        }
Esempio n. 6
0
        public void CanConstructMapping()
        {
            Device device = new Device(testContext);

            Compiler.PlaidML.Shape s1 = new Compiler.PlaidML.Shape(testContext, PlaidmlDatatype.PLAIDML_DATA_FLOAT64, 4, 8, 8);
            device.CreateBuffer(s1);
            Assert.Single(device.Buffers);
            DeviceBuffer buffer = device.Buffers[0];

            Assert.Equal(8UL * 8 * 4 * 8, buffer.SizeInBytes);
            MemoryMapping m    = new MemoryMapping(buffer);
            Span <long>   span = m.GetSpan <long>();

            Assert.Equal((int)s1.ElementCount, span.Length);
        }
Esempio n. 7
0
    private void LateUpdate()
    {
        float[] floatArray;
        FetchParameters(out floatArray);

        if (MemoryMapping.IsMemFileOpen && DataChanged())
        {
            Buffer.BlockCopy(m_CameraParametersCurrent, 0, m_CameraParametersCache, 0, m_CameraParametersCurrent.Length * sizeof(float));

            byte[] data;
            MemoryMapping.PrepareDataToSend(floatArray, out data);

            MemoryMapping.WriteToMem(data);
        }
    }
Esempio n. 8
0
        public void SetMemory(long address, long value)
        {
            long[] addresses = ApplyBitmaskFunction(address).ToHashSet().ToArray();
            foreach (var addr in addresses)
            {
                Console.WriteLine($"Setting memory at '{addr}' from to '{value}'");

                if (MemoryMapping.ContainsKey(addr))
                {
                    MemoryMapping[addr] = value;
                }
                else
                {
                    MemoryMapping.Add(addr, value);
                }
            }
        }
Esempio n. 9
0
        public override ModuleInfo GetModule(string moduleName)
        {
            int mappingIndex = this.mappings.FindIndex(mapping => mapping.ModuleName.EndsWith(moduleName));

            if (mappingIndex < 0)
            {
                throw new Exception($"{moduleName} module not found");
            }

            IntPtr startingAddress = this.mappings[mappingIndex].StartAddress;
            string fullModuleName  = this.mappings[mappingIndex].ModuleName;

            while (mappingIndex < this.mappings.Count && (!this.mappings[mappingIndex].IsStartingModule || this.mappings[mappingIndex].ModuleName == fullModuleName))
            {
                mappingIndex++;
            }

            mappingIndex--;
            uint size = Convert.ToUInt32(MemoryMapping.GetSize(startingAddress, this.mappings[mappingIndex].EndAddress));

            return(new ModuleInfo(moduleName, startingAddress, size, fullModuleName));
        }
Esempio n. 10
0
 public Board()
 {
     this.CPU     = new MC6809(this);
     this.mapping = new MemoryMapping(this.ram, 0x0000, 0xffff, EightBit.AccessLevel.ReadWrite);
 }
Esempio n. 11
0
 public long SumOfMemoryContent()
 {
     return(MemoryMapping.Sum(kvp => kvp.Value));
 }
Esempio n. 12
0
 void OnApplicationQuit()
 {
     MemoryMapping.CloseMemoryMappedFIle();
 }