示例#1
0
        private void SetupMemoryDomains()
        {
            var domains = new List <MemoryDomain>
            {
                MemoryDomain.FromByteArray("Main RAM", MemoryDomain.Endian.Little, _ram)
            };

            var systemBusDomain = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little,
                                                           (addr) =>
            {
                if (addr < 0 || addr >= 65536)
                {
                    throw new ArgumentOutOfRangeException();
                }
                return(Cpu.ReadMemory((ushort)addr));
            },
                                                           (addr, value) =>
            {
                if (addr < 0 || addr >= 65536)
                {
                    throw new ArgumentOutOfRangeException();
                }
                Cpu.WriteMemory((ushort)addr, value);
            }, 1);

            domains.Add(systemBusDomain);

            _memoryDomains = new MemoryDomainList(domains);
            (ServiceProvider as BasicServiceProvider).Register <IMemoryDomains>(_memoryDomains);
        }
示例#2
0
 public MemoryDomain GetExRAM()
 {
     return(MemoryDomain.FromByteArray("ExRAM", MemoryDomain.Endian.Little, EXRAM));
 }