예제 #1
0
        public byte[] this[uint index, int size]
        {
            get
            {
                uint     nonCachedIndex = TLB.TranslateAddress(index) & 0x1FFFFFFF;
                byte[]   result         = new byte[size];
                MemEntry Entry          = GetEntry(nonCachedIndex);

                if (Entry.ReadArray == null)
                {
                    throw new Common.Exceptions.MemoryProtectionViolation($"Memory at \"0x{index:x8}\" is not readable.");
                }

                Buffer.BlockCopy(Entry.ReadArray, (int)(nonCachedIndex - Entry.StartAddress), result, 0, size);

                Entry.ReadEvent?.Invoke();

                return(result);
            }
            set
            {
                uint     nonCachedIndex = TLB.TranslateAddress(index) & 0x1FFFFFFF;
                MemEntry Entry          = GetEntry(nonCachedIndex);

                if (Entry.WriteArray == null)
                {
                    throw new Common.Exceptions.MemoryProtectionViolation($"Memory at \"0x{index:x8}\" is not writable.");
                }

                Buffer.BlockCopy(value, 0, Entry.WriteArray, (int)(nonCachedIndex - Entry.StartAddress), size);

                Entry.WriteEvent?.Invoke();
            }
        }
예제 #2
0
        public byte this[uint index]
        {
            get
            {
                uint     nonCachedIndex = TLB.TranslateAddress(index) & 0x1FFFFFFF;
                MemEntry Entry          = GetEntry(nonCachedIndex);

                if (Entry.ReadArray == null)
                {
                    throw new Common.Exceptions.MemoryProtectionViolation($"Memory at \"0x{index:x8}\" is not readable.");
                }

                return(Entry.ReadArray[nonCachedIndex - Entry.StartAddress]);
            }
            set
            {
                uint     nonCachedIndex = TLB.TranslateAddress(index) & 0x1FFFFFFF;
                MemEntry Entry          = GetEntry(nonCachedIndex);

                if (Entry.WriteArray == null)
                {
                    throw new Common.Exceptions.MemoryProtectionViolation($"Memory at \"0x{index:x8}\" is not writable.");
                }

                Entry.WriteArray[nonCachedIndex - Entry.StartAddress] = value;
            }
        }