private void SetupMemoryDomains() { var domains = new List <MemoryDomain>(); var RAM = new MemoryDomainByteArray("RAM", MemoryDomain.Endian.Little, ram, true, 1); var SystemBus = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little, addr => PeekMemory((ushort)addr), (addr, value) => ApplySystemBusPoke((int)addr, value), 1); var PPUBus = new MemoryDomainDelegate("PPU Bus", 0x4000, MemoryDomain.Endian.Little, addr => ppu.ppubus_peek((int)addr), (addr, value) => ppu.ppubus_write((int)addr, value), 1); var CIRAMdomain = new MemoryDomainByteArray("CIRAM (nametables)", MemoryDomain.Endian.Little, CIRAM, true, 1); var OAMdoman = new MemoryDomainByteArray("OAM", MemoryDomain.Endian.Unknown, ppu.OAM, true, 1); domains.Add(RAM); domains.Add(SystemBus); domains.Add(PPUBus); domains.Add(CIRAMdomain); domains.Add(OAMdoman); if (!(Board is FDS) && Board.SaveRam != null) { var BatteryRam = new MemoryDomainByteArray("Battery RAM", MemoryDomain.Endian.Little, Board.SaveRam, true, 1); domains.Add(BatteryRam); } if (Board.ROM != null) { var PRGROM = new MemoryDomainByteArray("PRG ROM", MemoryDomain.Endian.Little, Board.ROM, true, 1); domains.Add(PRGROM); } if (Board.VROM != null) { var CHRROM = new MemoryDomainByteArray("CHR VROM", MemoryDomain.Endian.Little, Board.VROM, true, 1); domains.Add(CHRROM); } if (Board.VRAM != null) { var VRAM = new MemoryDomainByteArray("VRAM", MemoryDomain.Endian.Little, Board.VRAM, true, 1); domains.Add(VRAM); } if (Board.WRAM != null) { var WRAM = new MemoryDomainByteArray("WRAM", MemoryDomain.Endian.Little, Board.WRAM, true, 1); domains.Add(WRAM); } // if there were more boards with special ram sets, we'd want to do something more general if (Board is FDS) { domains.Add((Board as FDS).GetDiskPeeker()); } else if (Board is ExROM) { domains.Add((Board as ExROM).GetExRAM()); } _memoryDomains = new MemoryDomainList(domains); (ServiceProvider as BasicServiceProvider).Register <IMemoryDomains>(_memoryDomains); }
protected void PostInit() { using (_exe.EnterExit()) { var areas = new LibWaterboxCore.MemoryArea[256]; _core.GetMemoryAreas(areas); _memoryAreas = areas.Where(a => a.Data != IntPtr.Zero && a.Size != 0) .ToArray(); var memoryDomains = _memoryAreas.Select(a => WaterboxMemoryDomain.Create(a, _exe)).ToList(); var primaryDomain = memoryDomains .Where(md => md.Definition.Flags.HasFlag(LibWaterboxCore.MemoryDomainFlags.Primary)) .Single(); var mdl = new MemoryDomainList( memoryDomains.Cast <MemoryDomain>() .Concat(new[] { _exe.GetPagesDomain() }) .ToList() ); mdl.MainMemory = primaryDomain; _serviceProvider.Register <IMemoryDomains>(mdl); _saveramAreas = memoryDomains .Where(md => md.Definition.Flags.HasFlag(LibWaterboxCore.MemoryDomainFlags.Saverammable)) .ToArray(); _saveramSize = (int)_saveramAreas.Sum(a => a.Size); _exe.Seal(); } }
protected void PostInit() { using (_exe.EnterExit()) { var areas = new LibWaterboxCore.MemoryArea[256]; _core.GetMemoryAreas(areas); _memoryAreas = areas.Where(a => a.Data != IntPtr.Zero && a.Size != 0) .ToArray(); _saveramAreas = _memoryAreas.Where(a => (a.Flags & LibWaterboxCore.MemoryDomainFlags.Saverammable) != 0) .ToArray(); _saveramSize = (int)_saveramAreas.Sum(a => a.Size); var memoryDomains = _memoryAreas.Select(a => new LibWaterboxCore.WaterboxMemoryDomain(a, _exe)); var primaryIndex = _memoryAreas .Select((a, i) => new { a, i }) .Single(a => (a.a.Flags & LibWaterboxCore.MemoryDomainFlags.Primary) != 0).i; var mdl = new MemoryDomainList(memoryDomains.Cast <MemoryDomain>().ToList()); mdl.MainMemory = mdl[primaryIndex]; _serviceProvider.Register <IMemoryDomains>(mdl); var sr = _core as ICustomSaveram; if (sr != null) { _serviceProvider.Register <ISaveRam>(new CustomSaverammer(sr)); // override the default implementation } _exe.Seal(); } }
void SetupMemoryDomains() { var domains = new List <MemoryDomain> { new MemoryDomainDelegate( "System Bus", 0x10000, MemoryDomain.Endian.Little, (addr) => LibMSX.MSX_getsysbus(MSX_Pntr, (int)(addr & 0xFFFF)), (addr, value) => { }, 1), new MemoryDomainDelegate( "VRAM", 0x4000, MemoryDomain.Endian.Little, (addr) => LibMSX.MSX_getvram(MSX_Pntr, (int)(addr & 0x3FFF)), (addr, value) => { }, 1), }; if (SaveRAM != null) { var saveRamDomain = new MemoryDomainDelegate("Save RAM", SaveRAM.Length, MemoryDomain.Endian.Little, addr => SaveRAM[addr], (addr, value) => { SaveRAM[addr] = value; SaveRamModified = true; }, 1); domains.Add(saveRamDomain); } SyncAllByteArrayDomains(); MemoryDomains = new MemoryDomainList(_byteArrayDomains.Values.Concat(domains).ToList()); (ServiceProvider as BasicServiceProvider).Register <IMemoryDomains>(MemoryDomains); _memoryDomainsInit = true; }
private void SetupMemoryDomains() { var domains = new List<MemoryDomain>(3); var MainMemoryDomain = new MemoryDomainByteArray("Main RAM", MemoryDomain.Endian.Little, Ram, true, 1); var VRamDomain = new MemoryDomainByteArray("Video RAM", MemoryDomain.Endian.Little, VDP.VRAM, true, 1); 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(MainMemoryDomain); domains.Add(VRamDomain); domains.Add(SystemBusDomain); memoryDomains = new MemoryDomainList(domains); (ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(memoryDomains); }
void InitMemoryDomains() { CreateMemoryDomain(LibGambatte.MemoryAreas.wram, "WRAM"); CreateMemoryDomain(LibGambatte.MemoryAreas.rom, "ROM"); CreateMemoryDomain(LibGambatte.MemoryAreas.vram, "VRAM"); CreateMemoryDomain(LibGambatte.MemoryAreas.cartram, "Cart RAM"); CreateMemoryDomain(LibGambatte.MemoryAreas.oam, "OAM"); CreateMemoryDomain(LibGambatte.MemoryAreas.hram, "HRAM"); // also add a special memory domain for the system bus, where calls get sent directly to the core each time _MemoryDomains.Add(new MemoryDomain("System Bus", 65536, MemoryDomain.Endian.Little, delegate(int addr) { if (addr < 0 || addr >= 65536) { throw new ArgumentOutOfRangeException(); } return(LibGambatte.gambatte_cpuread(GambatteState, (ushort)addr)); }, delegate(int addr, byte val) { if (addr < 0 || addr >= 65536) { throw new ArgumentOutOfRangeException(); } LibGambatte.gambatte_cpuwrite(GambatteState, (ushort)addr, val); })); MemoryDomains = new MemoryDomainList(_MemoryDomains); }
private unsafe void SetMemoryDomains() { var mmd = new List <MemoryDomain>(); OctoshockDll.shock_GetMemData(psx, out var ptr, out var size, OctoshockDll.eMemType.MainRAM); mmd.Add(new MemoryDomainIntPtr("MainRAM", MemoryDomain.Endian.Little, ptr, size, true, 4)); OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.GPURAM); mmd.Add(new MemoryDomainIntPtr("GPURAM", MemoryDomain.Endian.Little, ptr, size, true, 4)); OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.SPURAM); mmd.Add(new MemoryDomainIntPtr("SPURAM", MemoryDomain.Endian.Little, ptr, size, true, 4)); OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.BiosROM); mmd.Add(new MemoryDomainIntPtr("BiosROM", MemoryDomain.Endian.Little, ptr, size, true, 4)); OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.PIOMem); mmd.Add(new MemoryDomainIntPtr("PIOMem", MemoryDomain.Endian.Little, ptr, size, true, 4)); OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.DCache); mmd.Add(new MemoryDomainIntPtr("DCache", MemoryDomain.Endian.Little, ptr, size, true, 4)); mmd.Add(new MemoryDomainDelegate("System Bus", 0x1_0000_0000, MemoryDomain.Endian.Little, (a) => { byte v; OctoshockDll.shock_PeekMemory(psx, (uint)a, out v); return(v); }, (a, v) => { OctoshockDll.shock_PokeMemory(psx, (uint)a, v); }, 4)); MemoryDomains = new MemoryDomainList(mmd); (ServiceProvider as BasicServiceProvider).Register <IMemoryDomains>(MemoryDomains); }
private void SetupMemoryDomains() { var domains = new List <MemoryDomain>(3); var MainMemoryDomain = new MemoryDomainByteArray("Main RAM", MemoryDomain.Endian.Little, Ram, true, 1); var VRamDomain = new MemoryDomainByteArray("Video RAM", MemoryDomain.Endian.Little, VDP.VRAM, true, 1); 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(MainMemoryDomain); domains.Add(VRamDomain); domains.Add(SystemBusDomain); memoryDomains = new MemoryDomainList(domains); (ServiceProvider as BasicServiceProvider).Register <IMemoryDomains>(memoryDomains); }
void SetupMemoryDomains() { var domains = new List <MemoryDomain>(3); var MainMemoryDomain = new MemoryDomain("Main RAM", Ram.Length, MemoryDomain.Endian.Big, addr => Ram[addr & 0xFFFF], (addr, value) => Ram[addr & 0xFFFF] = value); var Z80Domain = new MemoryDomain("Z80 RAM", Z80Ram.Length, MemoryDomain.Endian.Little, addr => Z80Ram[addr & 0x1FFF], (addr, value) => { Z80Ram[addr & 0x1FFF] = value; }); var VRamDomain = new MemoryDomain("Video RAM", VDP.VRAM.Length, MemoryDomain.Endian.Big, addr => VDP.VRAM[addr & 0xFFFF], (addr, value) => VDP.VRAM[addr & 0xFFFF] = value); var RomDomain = new MemoryDomain("MD CART", RomData.Length, MemoryDomain.Endian.Big, addr => RomData[addr], //adelikat: For speed considerations, I didn't mask this, every tool that uses memory domains is smart enough not to overflow, if I'm wrong let me know! (addr, value) => RomData[addr & (RomData.Length - 1)] = value); var SystemBusDomain = new MemoryDomain("System Bus", 0x1000000, MemoryDomain.Endian.Big, addr => (byte)ReadByte((int)addr), (addr, value) => Write8((uint)addr, (uint)value)); domains.Add(MainMemoryDomain); domains.Add(Z80Domain); domains.Add(VRamDomain); domains.Add(RomDomain); domains.Add(SystemBusDomain); memoryDomains = new MemoryDomainList(domains); (ServiceProvider as BasicServiceProvider).Register <IMemoryDomains>(memoryDomains); }
private void SetupMemoryDomains() { var domains = new List<MemoryDomain>(); var RAM = new MemoryDomainByteArray("RAM", MemoryDomain.Endian.Little, ram, true, 1); var SystemBus = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little, addr => PeekMemory((ushort)addr), (addr, value) => ApplySystemBusPoke((int)addr, value), 1); var PPUBus = new MemoryDomainDelegate("PPU Bus", 0x4000, MemoryDomain.Endian.Little, addr => ppu.ppubus_peek((int)addr), (addr, value) => ppu.ppubus_write((int)addr, value), 1); var CIRAMdomain = new MemoryDomainByteArray("CIRAM (nametables)", MemoryDomain.Endian.Little, CIRAM, true, 1); var OAMdoman = new MemoryDomainByteArray("OAM", MemoryDomain.Endian.Unknown, ppu.OAM, true, 1); domains.Add(RAM); domains.Add(SystemBus); domains.Add(PPUBus); domains.Add(CIRAMdomain); domains.Add(OAMdoman); if (!(Board is FDS) && Board.SaveRam != null) { var BatteryRam = new MemoryDomainByteArray("Battery RAM", MemoryDomain.Endian.Little, Board.SaveRam, true, 1); domains.Add(BatteryRam); } if (Board.ROM != null) { var PRGROM = new MemoryDomainByteArray("PRG ROM", MemoryDomain.Endian.Little, Board.ROM, true, 1); domains.Add(PRGROM); } if (Board.VROM != null) { var CHRROM = new MemoryDomainByteArray("CHR VROM", MemoryDomain.Endian.Little, Board.VROM, true, 1); domains.Add(CHRROM); } if (Board.VRAM != null) { var VRAM = new MemoryDomainByteArray("VRAM", MemoryDomain.Endian.Little, Board.VRAM, true, 1); domains.Add(VRAM); } if (Board.WRAM != null) { var WRAM = new MemoryDomainByteArray("WRAM", MemoryDomain.Endian.Little, Board.WRAM, true, 1); domains.Add(WRAM); } // if there were more boards with special ram sets, we'd want to do something more general if (Board is FDS) { domains.Add((Board as FDS).GetDiskPeeker()); } else if (Board is ExROM) { domains.Add((Board as ExROM).GetExRAM()); } _memoryDomains = new MemoryDomainList(domains); (ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains); }
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); }
private void SetupMemoryDomains() { var domains = new List<MemoryDomain> { MemoryDomain.FromByteArray("Main RAM", MemoryDomain.Endian.Little, _ram) }; var systemBusDomain = new MemoryDomain("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); }); domains.Add(systemBusDomain); _memoryDomains = new MemoryDomainList(domains); (ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains); }
private void SetupMemoryDomains() { var mms = new List <MemoryDomain> { new MemoryDomainIntPtr("RAM", MemoryDomain.Endian.Little, LibLynx.GetRamPointer(Core), 65536, true, 2) }; IntPtr p; int s; if (LibLynx.GetSaveRamPtr(Core, out s, out p)) { mms.Add(new MemoryDomainIntPtr("Save RAM", MemoryDomain.Endian.Little, p, s, true, 2)); } IntPtr p0, p1; int s0, s1; LibLynx.GetReadOnlyCartPtrs(Core, out s0, out p0, out s1, out p1); if (s0 > 0 && p0 != IntPtr.Zero) { mms.Add(new MemoryDomainIntPtr("Cart A", MemoryDomain.Endian.Little, p0, s0, false, 2)); } if (s1 > 0 && p1 != IntPtr.Zero) { mms.Add(new MemoryDomainIntPtr("Cart B", MemoryDomain.Endian.Little, p1, s1, false, 2)); } _memoryDomains = new MemoryDomainList(mms); (ServiceProvider as BasicServiceProvider).Register <IMemoryDomains>(_memoryDomains); }
void SetupMemoryDomains() { var domains = new List <MemoryDomain>(3); var MainMemoryDomain = new MemoryDomain("Main RAM", Ram.Length, MemoryDomain.Endian.Little, addr => Ram[addr], (addr, value) => Ram[addr] = value); var VRamDomain = new MemoryDomain("Video RAM", VDP.VRAM.Length, MemoryDomain.Endian.Little, addr => VDP.VRAM[addr], (addr, value) => VDP.VRAM[addr] = value); var SystemBusDomain = new MemoryDomain("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); }); domains.Add(MainMemoryDomain); domains.Add(VRamDomain); domains.Add(SystemBusDomain); memoryDomains = new MemoryDomainList(domains); }
private void SetupMemoryDomains() { var domains = new List <MemoryDomain> { 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) }; SyncAllByteArrayDomains(); memoryDomains = new MemoryDomainList(_byteArrayDomains.Values.Concat(domains).ToList()); (ServiceProvider as BasicServiceProvider).Register <IMemoryDomains>(memoryDomains); _memoryDomainsInit = true; }
private void SetupMemoryDomains() { var domains = new List <MemoryDomain>(); var systemBusDomain = new MemoryDomainDelegate("System Bus (21 bit)", 0x200000, MemoryDomain.Endian.Little, (addr) => { if (addr < 0 || addr >= 0x200000) { throw new ArgumentOutOfRangeException(); } return(Cpu.ReadMemory21((int)addr)); }, (addr, value) => { if (addr < 0 || addr >= 0x200000) { throw new ArgumentOutOfRangeException(); } Cpu.WriteMemory21((int)addr, value); }, wordSize: 2); domains.Add(systemBusDomain); var cpuBusDomain = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little, (addr) => { if (addr < 0 || addr >= 0x10000) { throw new ArgumentOutOfRangeException(); } return(Cpu.PeekMemory((ushort)addr)); }, (addr, value) => { if (addr < 0 || addr >= 0x10000) { throw new ArgumentOutOfRangeException(); } Cpu.PokeMemory((ushort)addr, value); }, wordSize: 2); domains.Add(cpuBusDomain); SyncAllByteArrayDomains(); domains.AddRange(_byteArrayDomains.Values); domains.AddRange(_ushortArrayDomains.Values); _memoryDomains = new MemoryDomainList(domains); _memoryDomains.SystemBus = cpuBusDomain; _memoryDomains.MainMemory = _byteArrayDomains["Main Memory"]; ((BasicServiceProvider)ServiceProvider).Register <IMemoryDomains>(_memoryDomains); _memoryDomainsInit = true; }
void SetupMemoryDomains() { var domains = new List <MemoryDomain>(3); var MainMemoryDomain = new MemoryDomain("Main RAM", SystemRam.Length, MemoryDomain.Endian.Little, addr => SystemRam[addr], (addr, value) => SystemRam[addr] = value); var VRamDomain = new MemoryDomain("Video RAM", Vdp.VRAM.Length, MemoryDomain.Endian.Little, addr => Vdp.VRAM[addr], (addr, value) => Vdp.VRAM[addr] = value); var ROMDomain = new MemoryDomain("ROM", RomData.Length, MemoryDomain.Endian.Little, addr => RomData[addr], (addr, value) => RomData[addr] = value); var SystemBusDomain = new MemoryDomain("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); }); domains.Add(MainMemoryDomain); domains.Add(VRamDomain); domains.Add(ROMDomain); domains.Add(SystemBusDomain); if (SaveRAM != null) { var SaveRamDomain = new MemoryDomain("Save RAM", SaveRAM.Length, MemoryDomain.Endian.Little, addr => SaveRAM[addr], (addr, value) => { SaveRAM[addr] = value; SaveRamModified = true; }); domains.Add(SaveRamDomain); } if (ExtRam != null) { var ExtRamDomain = new MemoryDomain("Cart (Volatile) RAM", ExtRam.Length, MemoryDomain.Endian.Little, addr => ExtRam[addr], (addr, value) => { ExtRam[addr] = value; }); domains.Add(ExtRamDomain); } MemoryDomains = new MemoryDomainList(domains); (ServiceProvider as BasicServiceProvider).Register <IMemoryDomains>(MemoryDomains); }
public Octoshock(CoreComm comm) { var domains = new List<MemoryDomain>(); CoreComm = comm; VirtualWidth = BufferWidth = 256; BufferHeight = 192; MemoryDomains = new MemoryDomainList(memoryDomains); }
public Octoshock(CoreComm comm) { var domains = new List <MemoryDomain>(); CoreComm = comm; VirtualWidth = BufferWidth = 256; BufferHeight = 192; MemoryDomains = new MemoryDomainList(memoryDomains); }
void SetupMemoryDomains(byte[] romData, byte[] sgbRomData) { // remember, MainMemory must always be the same as MemoryDomains[0], else GIANT DRAGONS //<zeromus> - this is stupid. //lets just do this entirely differently for SGB if (IsSGB) { //NOTE: CGB has 32K of wram, and DMG has 8KB of wram. Not sure how to control this right now.. bsnes might not have any ready way of doign that? I couldnt spot it. //You wouldnt expect a DMG game to access excess wram, but what if it tried to? maybe an oversight in bsnes? MakeMemoryDomain("SGB WRAM", LibsnesApi.SNES_MEMORY.SGB_WRAM, MemoryDomain.Endian.Little); var romDomain = new MemoryDomain("SGB CARTROM", romData.Length, MemoryDomain.Endian.Little, (addr) => romData[addr], (addr, value) => romData[addr] = value); _memoryDomains.Add(romDomain); //the last 1 byte of this is special.. its an interrupt enable register, instead of ram. weird. maybe its actually ram and just getting specially used? MakeMemoryDomain("SGB HRAM", LibsnesApi.SNES_MEMORY.SGB_HRAM, MemoryDomain.Endian.Little); MakeMemoryDomain("SGB CARTRAM", LibsnesApi.SNES_MEMORY.SGB_CARTRAM, MemoryDomain.Endian.Little); MainMemory = MakeMemoryDomain("WRAM", LibsnesApi.SNES_MEMORY.WRAM, MemoryDomain.Endian.Little); var sgbromDomain = new MemoryDomain("SGB.SFC ROM", sgbRomData.Length, MemoryDomain.Endian.Little, (addr) => sgbRomData[addr], (addr, value) => sgbRomData[addr] = value); _memoryDomains.Add(sgbromDomain); } else { MainMemory = MakeMemoryDomain("WRAM", LibsnesApi.SNES_MEMORY.WRAM, MemoryDomain.Endian.Little); MakeMemoryDomain("CARTROM", LibsnesApi.SNES_MEMORY.CARTRIDGE_ROM, MemoryDomain.Endian.Little); MakeMemoryDomain("CARTRAM", LibsnesApi.SNES_MEMORY.CARTRIDGE_RAM, MemoryDomain.Endian.Little); MakeMemoryDomain("VRAM", LibsnesApi.SNES_MEMORY.VRAM, MemoryDomain.Endian.Little); MakeMemoryDomain("OAM", LibsnesApi.SNES_MEMORY.OAM, MemoryDomain.Endian.Little); MakeMemoryDomain("CGRAM", LibsnesApi.SNES_MEMORY.CGRAM, MemoryDomain.Endian.Little); MakeMemoryDomain("APURAM", LibsnesApi.SNES_MEMORY.APURAM, MemoryDomain.Endian.Little); if (!DeterministicEmulation) { _memoryDomains.Add(new MemoryDomain("BUS", 0x1000000, MemoryDomain.Endian.Little, (addr) => api.QUERY_peek(LibsnesApi.SNES_MEMORY.SYSBUS, (uint)addr), (addr, val) => api.QUERY_poke(LibsnesApi.SNES_MEMORY.SYSBUS, (uint)addr, val))); } } MemoryDomains = new MemoryDomainList(_memoryDomains); }
private void SetupMemoryDomains() { var domains = new List <MemoryDomain>(); var mainRamDomain = new MemoryDomainDelegate("Main Ram", 0xC000, MemoryDomain.Endian.Little, addr => { if (addr < 0 || addr >= 0xC000) { throw new ArgumentOutOfRangeException(); } return((byte)_machine.Memory.Peek((int)addr)); }, (addr, value) => { if (addr < 0 || addr >= 0xC000) { throw new ArgumentOutOfRangeException(); } _machine.Memory.Write((int)addr, value); }, 1); domains.Add(mainRamDomain); var systemBusDomain = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little, addr => { if (addr < 0 || addr >= 65536) { throw new ArgumentOutOfRangeException(); } return((byte)_machine.Memory.Peek((int)addr)); }, (addr, value) => { if (addr < 0 || addr >= 65536) { throw new ArgumentOutOfRangeException(); } _machine.Memory.Write((int)addr, value); }, 1); domains.Add(systemBusDomain); _memoryDomains = new MemoryDomainList(domains); ((BasicServiceProvider)ServiceProvider).Register(_memoryDomains); }
void SetupMemoryDomains() { var domains = new List<MemoryDomain>(3); var MainMemoryDomain = new MemoryDomainByteArray("Main RAM", MemoryDomain.Endian.Little, SystemRam, true, 1); var VRamDomain = new MemoryDomainByteArray("Video RAM", MemoryDomain.Endian.Little, Vdp.VRAM, true, 1); var ROMDomain = new MemoryDomainByteArray("ROM", MemoryDomain.Endian.Little, RomData, true, 1); 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(MainMemoryDomain); domains.Add(VRamDomain); domains.Add(ROMDomain); domains.Add(SystemBusDomain); if (SaveRAM != null) { var SaveRamDomain = new MemoryDomainDelegate("Save RAM", SaveRAM.Length, MemoryDomain.Endian.Little, addr => SaveRAM[addr], (addr, value) => { SaveRAM[addr] = value; SaveRamModified = true; }, 1); domains.Add(SaveRamDomain); } if (ExtRam != null) { var ExtRamDomain = new MemoryDomainByteArray("Cart (Volatile) RAM", MemoryDomain.Endian.Little, ExtRam, true, 1); domains.Add(ExtRamDomain); } MemoryDomains = new MemoryDomainList(domains); (ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(MemoryDomains); }
unsafe void InitMemoryDomains() { List <MemoryDomain> mm = new List <MemoryDomain>(); for (int i = 0; ; i++) { IntPtr data = IntPtr.Zero; int size = 0; bool writable = false; IntPtr name = IntPtr.Zero; if (!QN.qn_get_memory_area(Context, i, ref data, ref size, ref writable, ref name)) { break; } if (data != IntPtr.Zero && size > 0 && name != IntPtr.Zero) { mm.Add(MemoryDomain.FromIntPtr(Marshal.PtrToStringAnsi(name), size, MemoryDomain.Endian.Little, data, writable)); } } // add system bus mm.Add(new MemoryDomain ( "System Bus", 0x10000, MemoryDomain.Endian.Unknown, delegate(long addr) { if (addr < 0 || addr >= 0x10000) { throw new ArgumentOutOfRangeException(); } return(QN.qn_peek_prgbus(Context, (int)addr)); }, delegate(long addr, byte val) { if (addr < 0 || addr >= 0x10000) { throw new ArgumentOutOfRangeException(); } QN.qn_poke_prgbus(Context, (int)addr, val); } )); _memoryDomains = new MemoryDomainList(mm); (ServiceProvider as BasicServiceProvider).Register <IMemoryDomains>(_memoryDomains); }
private void SetupMemoryDomains() { var domains = new List <MemoryDomain> { new MemoryDomain( "Main RAM", ram.Length, MemoryDomain.Endian.Little, addr => ram[addr], (addr, value) => ram[addr] = value ) }; _memoryDomains = new MemoryDomainList(domains); }
public NullEmulator(CoreComm comm) { CoreComm = comm; var domains = new MemoryDomainList( new List<MemoryDomain> { new MemoryDomain("Main RAM", 1, MemoryDomain.Endian.Little, addr => 0, (a, v) => { }) }); memoryDomains = new MemoryDomainList(domains); var d = DateTime.Now; xmas = d.Month == 12 && d.Day >= 17 && d.Day <= 27; if (xmas) pleg = new Pleg(); }
void SetMemoryDomains() { var mm = new List <MemoryDomain>(); foreach (var md in L.MemoryDomains) { mm.Add(new MemoryDomain("L " + md.Name, md.Size, md.EndianType, md.PeekByte, md.PokeByte)); } foreach (var md in R.MemoryDomains) { mm.Add(new MemoryDomain("R " + md.Name, md.Size, md.EndianType, md.PeekByte, md.PokeByte)); } MemoryDomains = new MemoryDomainList(mm); }
public static IEnumerable <ToolStripItem> MenuItems(this MemoryDomainList domains, Action <string> setCallback, string selected = "", int?maxSize = null) { foreach (var domain in domains) { var name = domain.Name; var item = new ToolStripMenuItem { Text = name, Enabled = !(maxSize.HasValue && domain.Size > maxSize.Value), Checked = name == selected }; item.Click += (o, ev) => setCallback(name); yield return(item); } }
unsafe void InitMemoryDomains() { List<MemoryDomain> mm = new List<MemoryDomain>(); for (int i = 0; ; i++) { IntPtr data = IntPtr.Zero; int size = 0; bool writable = false; IntPtr name = IntPtr.Zero; if (!QN.qn_get_memory_area(Context, i, ref data, ref size, ref writable, ref name)) break; if (data != IntPtr.Zero && size > 0 && name != IntPtr.Zero) { mm.Add(MemoryDomain.FromIntPtr(Marshal.PtrToStringAnsi(name), size, MemoryDomain.Endian.Little, data, writable)); } } // add system bus mm.Add(new MemoryDomain ( "System Bus", 0x10000, MemoryDomain.Endian.Unknown, delegate(long addr) { if (addr < 0 || addr >= 0x10000) { throw new ArgumentOutOfRangeException(); } return QN.qn_peek_prgbus(Context, (int)addr); }, delegate(long addr, byte val) { if (addr < 0 || addr >= 0x10000) { throw new ArgumentOutOfRangeException(); } QN.qn_poke_prgbus(Context, (int)addr, val); } )); _memoryDomains = new MemoryDomainList(mm); (ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains); }
void InitMemoryDomains() { var ret = new List <MemoryDomain>(); var nmds = LibYabause.libyabause_getmemoryareas_ex(); foreach (var nmd in nmds) { int l = nmd.length; IntPtr d = nmd.data; ret.Add(new MemoryDomain( nmd.name, nmd.length, MemoryDomain.Endian.Little, delegate(int addr) { if (addr < 0 || addr >= l) { throw new ArgumentOutOfRangeException(); } unsafe { byte *p = (byte *)d; return(p[addr]); } }, delegate(int addr, byte val) { if (addr < 0 || addr >= l) { throw new ArgumentOutOfRangeException(); } unsafe { byte *p = (byte *)d; p[addr] = val; } } )); } // fulfill the prophecy of MainMemory always being MemoryDomains[0] var tmp = ret[2]; ret[2] = ret[0]; ret[0] = tmp; MemoryDomains = new MemoryDomainList(ret); }
private void SetupMemoryDomains() { // chips must be initialized before this code runs! var domains = new List <MemoryDomain>(1); domains.Add(new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little, board.cpu.Peek, board.cpu.Poke)); domains.Add(new MemoryDomain("RAM", 0x10000, MemoryDomain.Endian.Little, board.ram.Peek, board.ram.Poke)); domains.Add(new MemoryDomain("CIA0", 0x10, MemoryDomain.Endian.Little, board.cia0.Peek, board.cia0.Poke)); domains.Add(new MemoryDomain("CIA1", 0x10, MemoryDomain.Endian.Little, board.cia1.Peek, board.cia1.Poke)); domains.Add(new MemoryDomain("VIC", 0x40, MemoryDomain.Endian.Little, board.vic.Peek, board.vic.Poke)); domains.Add(new MemoryDomain("SID", 0x20, MemoryDomain.Endian.Little, board.sid.Peek, board.sid.Poke)); //domains.Add(new MemoryDomain("1541 Bus", 0x10000, MemoryDomain.Endian.Little, new Func<int, byte>(disk.Peek), new Action<int, byte>(disk.Poke))); //domains.Add(new MemoryDomain("1541 VIA0", 0x10, MemoryDomain.Endian.Little, new Func<int, byte>(disk.PeekVia0), new Action<int, byte>(disk.PokeVia0))); //domains.Add(new MemoryDomain("1541 VIA1", 0x10, MemoryDomain.Endian.Little, new Func<int, byte>(disk.PeekVia1), new Action<int, byte>(disk.PokeVia1))); //domains.Add(new MemoryDomain("1541 RAM", 0x1000, MemoryDomain.Endian.Little, new Func<int, byte>(disk.PeekRam), new Action<int, byte>(disk.PokeRam))); memoryDomains = new MemoryDomainList(domains); }
private void CreateMemoryDomains(int romsize) { var LE = MemoryDomain.Endian.Little; var mm = new List <MemoryDomain>(); mm.Add(_iwram = new MemoryDomainIntPtr("IWRAM", LE, IntPtr.Zero, 32 * 1024, true, 4)); mm.Add(_ewram = new MemoryDomainIntPtr("EWRAM", LE, IntPtr.Zero, 256 * 1024, true, 4)); mm.Add(_bios = new MemoryDomainIntPtr("BIOS", LE, IntPtr.Zero, 16 * 1024, false, 4)); mm.Add(_palram = new MemoryDomainIntPtr("PALRAM", LE, IntPtr.Zero, 1024, true, 4)); mm.Add(_vram = new MemoryDomainIntPtr("VRAM", LE, IntPtr.Zero, 96 * 1024, true, 4)); mm.Add(_oam = new MemoryDomainIntPtr("OAM", LE, IntPtr.Zero, 1024, true, 4)); mm.Add(_rom = new MemoryDomainIntPtr("ROM", LE, IntPtr.Zero, romsize, false, 4)); mm.Add(_cwram = new MemoryDomainDelegate("Combined WRAM", (256 + 32) * 1024, LE, null, null, 4)); MemoryDomains = new MemoryDomainList(mm); WireMemoryDomainPointers(); }
private void CreateMemoryDomains(int romsize) { var le = MemoryDomain.Endian.Little; var mm = new List <MemoryDomain>(); mm.Add(_iwram = new MemoryDomainIntPtr("IWRAM", le, IntPtr.Zero, 32 * 1024, true, 4)); mm.Add(_ewram = new MemoryDomainIntPtr("EWRAM", le, IntPtr.Zero, 256 * 1024, true, 4)); mm.Add(_bios = new MemoryDomainIntPtr("BIOS", le, IntPtr.Zero, 16 * 1024, false, 4)); mm.Add(_palram = new MemoryDomainIntPtr("PALRAM", le, IntPtr.Zero, 1024, true, 4)); mm.Add(_vram = new MemoryDomainIntPtr("VRAM", le, IntPtr.Zero, 96 * 1024, true, 4)); mm.Add(_oam = new MemoryDomainIntPtr("OAM", le, IntPtr.Zero, 1024, true, 4)); mm.Add(_rom = new MemoryDomainIntPtr("ROM", le, IntPtr.Zero, romsize, true, 4)); // 128 KB is the max size for GBA savedata // mGBA does not know a game's save type (and as a result actual savedata size) on startup. // Instead, BizHawk's savedata buffer will be accessed directly for a consistent interface. mm.Add(_sram = new MemoryDomainIntPtr("SRAM", le, IntPtr.Zero, 128 * 1024, true, 4)); mm.Add(_cwram = new MemoryDomainDelegate("Combined WRAM", (256 + 32) * 1024, le, null, null, 4)); mm.Add(new MemoryDomainDelegate("System Bus", 0x10000000, le, delegate(long addr) { var a = (uint)addr; if (a >= 0x10000000) { throw new ArgumentOutOfRangeException(); } return(LibmGBA.BizReadBus(Core, a)); }, delegate(long addr, byte val) { var a = (uint)addr; if (a >= 0x10000000) { throw new ArgumentOutOfRangeException(); } LibmGBA.BizWriteBus(Core, a, val); }, 4)); _memoryDomains = new MemoryDomainList(mm); WireMemoryDomainPointers(); }
unsafe void SetMemoryDomains() { var mmd = new List <MemoryDomain>(); for (int i = 0; ; i++) { IntPtr name; int size; IntPtr data; if (!BizSwan.bizswan_getmemoryarea(Core, i, out name, out size, out data)) { break; } if (size == 0) { continue; } string sname = Marshal.PtrToStringAnsi(name); byte * p = (byte *)data; mmd.Add(new MemoryDomain( sname, size, MemoryDomain.Endian.Little, delegate(int addr) { if (addr < 0 || addr >= size) { throw new ArgumentOutOfRangeException(); } return(p[addr]); }, delegate(int addr, byte value) { if (addr < 0 || addr >= size) { throw new ArgumentOutOfRangeException(); } p[addr] = value; })); } MemoryDomains = new MemoryDomainList(mmd, 0); }
private void SetupMemoryDomains() { var domains = new List <MemoryDomain> { 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) }; if (use_SGM) { var SGMLRam = new MemoryDomainByteArray("SGM Low RAM", MemoryDomain.Endian.Little, SGM_low_RAM, true, 1); domains.Add(SGMLRam); var SGMHRam = new MemoryDomainByteArray("SGM High RAM", MemoryDomain.Endian.Little, SGM_high_RAM, true, 1); domains.Add(SGMHRam); } SyncAllByteArrayDomains(); _memoryDomains = new MemoryDomainList(_byteArrayDomains.Values.Concat(domains).ToList()); ((BasicServiceProvider)ServiceProvider).Register <IMemoryDomains>(_memoryDomains); _memoryDomainsInit = true; }
private void CreateMemoryDomains(int romsize) { var le = MemoryDomain.Endian.Little; var mm = new List <MemoryDomain>(); mm.Add(_iwram = new MemoryDomainIntPtr("IWRAM", le, IntPtr.Zero, 32 * 1024, true, 4)); mm.Add(_ewram = new MemoryDomainIntPtr("EWRAM", le, IntPtr.Zero, 256 * 1024, true, 4)); mm.Add(_bios = new MemoryDomainIntPtr("BIOS", le, IntPtr.Zero, 16 * 1024, false, 4)); mm.Add(_palram = new MemoryDomainIntPtr("PALRAM", le, IntPtr.Zero, 1024, true, 4)); mm.Add(_vram = new MemoryDomainIntPtr("VRAM", le, IntPtr.Zero, 96 * 1024, true, 4)); mm.Add(_oam = new MemoryDomainIntPtr("OAM", le, IntPtr.Zero, 1024, true, 4)); mm.Add(_rom = new MemoryDomainIntPtr("ROM", le, IntPtr.Zero, romsize, false, 4)); mm.Add(_sram = new MemoryDomainIntPtr("SRAM", le, IntPtr.Zero, 0, true, 4)); // size will be fixed in wireup mm.Add(_cwram = new MemoryDomainDelegate("Combined WRAM", (256 + 32) * 1024, le, null, null, 4)); mm.Add(new MemoryDomainDelegate("System Bus", 0x10000000, le, delegate(long addr) { var a = (uint)addr; if (a >= 0x10000000) { throw new ArgumentOutOfRangeException(); } return(LibmGBA.BizReadBus(_core, a)); }, delegate(long addr, byte val) { var a = (uint)addr; if (a >= 0x10000000) { throw new ArgumentOutOfRangeException(); } LibmGBA.BizWriteBus(_core, a, val); }, 4)); _memoryDomains = new MemoryDomainList(mm); WireMemoryDomainPointers(); }
void SetupMemoryDomains() { var domains = new List <MemoryDomain> { 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) }; if (SaveRAM != null) { var saveRamDomain = new MemoryDomainDelegate("Save RAM", SaveRAM.Length, MemoryDomain.Endian.Little, addr => SaveRAM[addr], (addr, value) => { SaveRAM[addr] = value; SaveRamModified = true; }, 1); domains.Add(saveRamDomain); } SyncAllByteArrayDomains(); MemoryDomains = new MemoryDomainList(_byteArrayDomains.Values.Concat(domains).ToList()); (ServiceProvider as BasicServiceProvider).Register <IMemoryDomains>(MemoryDomains); _memoryDomainsInit = true; }
private void SetupMemoryDomains() { var domains = new List<MemoryDomain>(); var mainRamDomain = new MemoryDomain("Main Ram", 0xC000, MemoryDomain.Endian.Little, (addr) => { if (addr < 0 || addr >= 0xC000) throw new ArgumentOutOfRangeException(); return (byte)_machine.Memory.Peek((int)addr); }, (addr, value) => { if (addr < 0 || addr >= 0xC000) throw new ArgumentOutOfRangeException(); _machine.Memory.Write((int)addr, value); }); domains.Add(mainRamDomain); var systemBusDomain = new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little, (addr) => { if (addr < 0 || addr >= 65536) throw new ArgumentOutOfRangeException(); return (byte)_machine.Memory.Peek((int)addr); }, (addr, value) => { if (addr < 0 || addr >= 65536) throw new ArgumentOutOfRangeException(); _machine.Memory.Write((int)addr, value); }); domains.Add(systemBusDomain); _memoryDomains = new MemoryDomainList(domains); (ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains); }
public void Disassemble(Stream s, MemoryDomainList mem) { var w = new StreamWriter(s); w.WriteLine("; Bizhawk CDL Disassembly"); w.WriteLine(); foreach (var kvp in this) { w.WriteLine(".\"{0}\" size=0x{1:x8}", kvp.Key, kvp.Value.Length); byte[] cd = kvp.Value; var md = mem[kvp.Key]; for (int i = 0; i < kvp.Value.Length; i++) { if ((kvp.Value[i] & (byte)HuC6280.CDLUsage.Code) != 0) { int unused; string dis = HuC6280.DisassembleExt( 0, out unused, delegate(ushort addr) { return(md.PeekByte(addr + i)); }, delegate(ushort addr) { return(md.PeekWord(addr + i, false)); } ); w.WriteLine("0x{0:x8}: {1}", i, dis); } } w.WriteLine(); } w.WriteLine("; EOF"); w.Flush(); }
private void SetupMemoryDomains() { var mms = new List<MemoryDomain>(); mms.Add(MemoryDomain.FromIntPtr("RAM", 65536, MemoryDomain.Endian.Little, LibLynx.GetRamPointer(Core), true, 2)); IntPtr p; int s; if (LibLynx.GetSaveRamPtr(Core, out s, out p)) { mms.Add(MemoryDomain.FromIntPtr("Save RAM", s, MemoryDomain.Endian.Little, p, true, 2)); } IntPtr p0, p1; int s0, s1; LibLynx.GetReadOnlyCartPtrs(Core, out s0, out p0, out s1, out p1); if (s0 > 0 && p0 != IntPtr.Zero) mms.Add(MemoryDomain.FromIntPtr("Cart A", s0, MemoryDomain.Endian.Little, p0, false, 2)); if (s1 > 0 && p1 != IntPtr.Zero) mms.Add(MemoryDomain.FromIntPtr("Cart B", s1, MemoryDomain.Endian.Little, p1, false, 2)); _memoryDomains = new MemoryDomainList(mms); (ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains); }
public Atari2600(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings) { Ram = new byte[128]; CoreComm = comm; Settings = (A2600Settings)settings ?? new A2600Settings(); SyncSettings = (A2600SyncSettings)syncSettings ?? new A2600SyncSettings(); var domains = new List<MemoryDomain> { new MemoryDomain( "Main RAM", 128, MemoryDomain.Endian.Little, addr => Ram[addr], (addr, value) => Ram[addr] = value), new MemoryDomain( "TIA", 16, MemoryDomain.Endian.Little, addr => _tia.ReadMemory((ushort)addr, true), (addr, value) => this._tia.WriteMemory((ushort)addr, value)), new MemoryDomain( "PIA", 1024, MemoryDomain.Endian.Little, addr => M6532.ReadMemory((ushort)addr, true), (addr, value) => M6532.WriteMemory((ushort)addr, value)), new MemoryDomain( "System Bus", 8192, MemoryDomain.Endian.Little, addr => _mapper.PeekMemory((ushort) addr), (addr, value) => _mapper.PokeMemory((ushort) addr, value)) }; CoreComm.CpuTraceAvailable = true; Rom = rom; _game = game; if (!game.GetOptionsDict().ContainsKey("m")) { game.AddOption("m", DetectMapper(rom)); } Console.WriteLine("Game uses mapper " + game.GetOptionsDict()["m"]); RebootCore(); if (_mapper is mDPC) // TODO: also mDPCPlus { domains.Add(new MemoryDomain( "DPC", 2048, MemoryDomain.Endian.Little, addr => (_mapper as mDPC).DspData[addr], (addr, value) => (_mapper as mDPC).DspData[addr] = value)); } if (_mapper.HasCartRam) { domains.Add(new MemoryDomain( "Cart Ram", _mapper.CartRam.Len, MemoryDomain.Endian.Little, addr => _mapper.CartRam[addr], (addr, value) => _mapper.CartRam[addr] = value)); } MemoryDomains = new MemoryDomainList(domains); }
void InitMemoryDomains() { var ret = new List<MemoryDomain>(); var nmds = LibYabause.libyabause_getmemoryareas_ex(); foreach (var nmd in nmds) { int l = nmd.length; IntPtr d = nmd.data; ret.Add(new MemoryDomain( nmd.name, nmd.length, MemoryDomain.Endian.Little, delegate(int addr) { if (addr < 0 || addr >= l) throw new ArgumentOutOfRangeException(); unsafe { byte* p = (byte*)d; return p[addr]; } }, delegate(int addr, byte val) { if (addr < 0 || addr >= l) throw new ArgumentOutOfRangeException(); unsafe { byte* p = (byte*)d; p[addr] = val; } } )); } // fulfill the prophecy of MainMemory always being MemoryDomains[0] var tmp = ret[2]; ret[2] = ret[0]; ret[0] = tmp; MemoryDomains = new MemoryDomainList(ret); }
void SetupMemoryDomains(byte[] romData, byte[] sgbRomData) { // remember, MainMemory must always be the same as MemoryDomains[0], else GIANT DRAGONS //<zeromus> - this is stupid. //lets just do this entirely differently for SGB if (IsSGB) { //NOTE: CGB has 32K of wram, and DMG has 8KB of wram. Not sure how to control this right now.. bsnes might not have any ready way of doign that? I couldnt spot it. //You wouldnt expect a DMG game to access excess wram, but what if it tried to? maybe an oversight in bsnes? MakeMemoryDomain("SGB WRAM", LibsnesApi.SNES_MEMORY.SGB_WRAM, MemoryDomain.Endian.Little); var romDomain = new MemoryDomain("SGB CARTROM", romData.Length, MemoryDomain.Endian.Little, (addr) => romData[addr], (addr, value) => romData[addr] = value); _memoryDomains.Add(romDomain); //the last 1 byte of this is special.. its an interrupt enable register, instead of ram. weird. maybe its actually ram and just getting specially used? MakeMemoryDomain("SGB HRAM", LibsnesApi.SNES_MEMORY.SGB_HRAM, MemoryDomain.Endian.Little); MakeMemoryDomain("SGB CARTRAM", LibsnesApi.SNES_MEMORY.SGB_CARTRAM, MemoryDomain.Endian.Little); MainMemory = MakeMemoryDomain("WRAM", LibsnesApi.SNES_MEMORY.WRAM, MemoryDomain.Endian.Little); var sgbromDomain = new MemoryDomain("SGB.SFC ROM", sgbRomData.Length, MemoryDomain.Endian.Little, (addr) => sgbRomData[addr], (addr, value) => sgbRomData[addr] = value); _memoryDomains.Add(sgbromDomain); } else { MainMemory = MakeMemoryDomain("WRAM", LibsnesApi.SNES_MEMORY.WRAM, MemoryDomain.Endian.Little); MakeMemoryDomain("CARTROM", LibsnesApi.SNES_MEMORY.CARTRIDGE_ROM, MemoryDomain.Endian.Little); MakeMemoryDomain("CARTRAM", LibsnesApi.SNES_MEMORY.CARTRIDGE_RAM, MemoryDomain.Endian.Little); MakeMemoryDomain("VRAM", LibsnesApi.SNES_MEMORY.VRAM, MemoryDomain.Endian.Little); MakeMemoryDomain("OAM", LibsnesApi.SNES_MEMORY.OAM, MemoryDomain.Endian.Little); MakeMemoryDomain("CGRAM", LibsnesApi.SNES_MEMORY.CGRAM, MemoryDomain.Endian.Little); MakeMemoryDomain("APURAM", LibsnesApi.SNES_MEMORY.APURAM, MemoryDomain.Endian.Little); if (!DeterministicEmulation) _memoryDomains.Add(new MemoryDomain("BUS", 0x1000000, MemoryDomain.Endian.Little, (addr) => api.QUERY_peek(LibsnesApi.SNES_MEMORY.SYSBUS, (uint)addr), (addr, val) => api.QUERY_poke(LibsnesApi.SNES_MEMORY.SYSBUS, (uint)addr, val))); } MemoryDomains = new MemoryDomainList(_memoryDomains); }
void SetupMemoryDomains() { var domains = new List<MemoryDomain>(3); var MainMemoryDomain = new MemoryDomain("Main RAM", Ram.Length, MemoryDomain.Endian.Little, addr => Ram[addr], (addr, value) => Ram[addr] = value); var VRamDomain = new MemoryDomain("Video RAM", VDP.VRAM.Length, MemoryDomain.Endian.Little, addr => VDP.VRAM[addr], (addr, value) => VDP.VRAM[addr] = value); var SystemBusDomain = new MemoryDomain("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); }); domains.Add(MainMemoryDomain); domains.Add(VRamDomain); domains.Add(SystemBusDomain); memoryDomains = new MemoryDomainList(domains); }
private void SetupMemoryDomains() { // chips must be initialized before this code runs! var domains = new List<MemoryDomain>(1); domains.Add(new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little, board.cpu.Peek, board.cpu.Poke)); domains.Add(new MemoryDomain("RAM", 0x10000, MemoryDomain.Endian.Little, board.ram.Peek, board.ram.Poke)); domains.Add(new MemoryDomain("CIA0", 0x10, MemoryDomain.Endian.Little, board.cia0.Peek, board.cia0.Poke)); domains.Add(new MemoryDomain("CIA1", 0x10, MemoryDomain.Endian.Little, board.cia1.Peek, board.cia1.Poke)); domains.Add(new MemoryDomain("VIC", 0x40, MemoryDomain.Endian.Little, board.vic.Peek, board.vic.Poke)); domains.Add(new MemoryDomain("SID", 0x20, MemoryDomain.Endian.Little, board.sid.Peek, board.sid.Poke)); //domains.Add(new MemoryDomain("1541 Bus", 0x10000, MemoryDomain.Endian.Little, new Func<int, byte>(disk.Peek), new Action<int, byte>(disk.Poke))); //domains.Add(new MemoryDomain("1541 VIA0", 0x10, MemoryDomain.Endian.Little, new Func<int, byte>(disk.PeekVia0), new Action<int, byte>(disk.PokeVia0))); //domains.Add(new MemoryDomain("1541 VIA1", 0x10, MemoryDomain.Endian.Little, new Func<int, byte>(disk.PeekVia1), new Action<int, byte>(disk.PokeVia1))); //domains.Add(new MemoryDomain("1541 RAM", 0x1000, MemoryDomain.Endian.Little, new Func<int, byte>(disk.PeekRam), new Action<int, byte>(disk.PokeRam))); memoryDomains = new MemoryDomainList(domains); }
void SetupMemoryDomains() { var domains = new List<MemoryDomain>(3); var MainMemoryDomain = new MemoryDomain("Main RAM", SystemRam.Length, MemoryDomain.Endian.Little, addr => SystemRam[addr], (addr, value) => SystemRam[addr] = value); var VRamDomain = new MemoryDomain("Video RAM", Vdp.VRAM.Length, MemoryDomain.Endian.Little, addr => Vdp.VRAM[addr], (addr, value) => Vdp.VRAM[addr] = value); var SystemBusDomain = new MemoryDomain("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); }); domains.Add(MainMemoryDomain); domains.Add(VRamDomain); domains.Add(SystemBusDomain); if (SaveRAM != null) { var SaveRamDomain = new MemoryDomain("Save RAM", SaveRAM.Length, MemoryDomain.Endian.Little, addr => SaveRAM[addr], (addr, value) => { SaveRAM[addr] = value; SaveRamModified = true; }); domains.Add(SaveRamDomain); } if (ExtRam != null) { var ExtRamDomain = new MemoryDomain("Cart (Volatile) RAM", ExtRam.Length, MemoryDomain.Endian.Little, addr => ExtRam[addr], (addr, value) => { ExtRam[addr] = value; }); domains.Add(ExtRamDomain); } memoryDomains = new MemoryDomainList(domains); }
private void SetupMemoryDomains() { var domains = new List<MemoryDomain> { new MemoryDomain( "Main RAM", ram.Length, MemoryDomain.Endian.Little, addr => ram[addr], (addr, value) => ram[addr] = value ) }; _memoryDomains = new MemoryDomainList(domains); }
unsafe void SetMemoryDomains() { var mmd = new List<MemoryDomain>(); for (int i = 0; ; i++) { IntPtr name; int size; IntPtr data; if (!BizSwan.bizswan_getmemoryarea(Core, i, out name, out size, out data)) break; if (size == 0) continue; string sname = Marshal.PtrToStringAnsi(name); byte *p = (byte*)data; mmd.Add(new MemoryDomain( sname, size, MemoryDomain.Endian.Little, delegate(int addr) { if (addr < 0 || addr >= size) throw new ArgumentOutOfRangeException(); return p[addr]; }, delegate(int addr, byte value) { if (addr < 0 || addr >= size) throw new ArgumentOutOfRangeException(); p[addr] = value; })); } MemoryDomains = new MemoryDomainList(mmd, 0); }
private void SetupMemoryDomains() { var domains = new List<MemoryDomain>(); var RAM = new MemoryDomain("RAM", 0x800, MemoryDomain.Endian.Little, addr => ram[addr], (addr, value) => ram[addr] = value); var SystemBus = new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little, addr => PeekMemory((ushort)addr), (addr, value) => ApplySystemBusPoke(addr, value)); var PPUBus = new MemoryDomain("PPU Bus", 0x4000, MemoryDomain.Endian.Little, addr => ppu.ppubus_peek(addr), (addr, value) => ppu.ppubus_write(addr, value)); var CIRAMdomain = new MemoryDomain("CIRAM (nametables)", 0x800, MemoryDomain.Endian.Little, addr => CIRAM[addr], (addr, value) => CIRAM[addr] = value); var OAMdoman = new MemoryDomain("OAM", 64 * 4, MemoryDomain.Endian.Unknown, addr => ppu.OAM[addr], (addr, value) => ppu.OAM[addr] = value); domains.Add(RAM); domains.Add(SystemBus); domains.Add(PPUBus); domains.Add(CIRAMdomain); domains.Add(OAMdoman); if (!(board is FDS) && board.SaveRam != null) { var BatteryRam = new MemoryDomain("Battery RAM", board.SaveRam.Length, MemoryDomain.Endian.Little, addr => board.SaveRam[addr], (addr, value) => board.SaveRam[addr] = value); domains.Add(BatteryRam); } var PRGROM = new MemoryDomain("PRG ROM", cart.prg_size * 1024, MemoryDomain.Endian.Little, addr => board.ROM[addr], (addr, value) => board.ROM[addr] = value); domains.Add(PRGROM); if (board.VROM != null) { var CHRROM = new MemoryDomain("CHR VROM", cart.chr_size * 1024, MemoryDomain.Endian.Little, addr => board.VROM[addr], (addr, value) => board.VROM[addr] = value); domains.Add(CHRROM); } if (board.VRAM != null) { var VRAM = new MemoryDomain("VRAM", board.VRAM.Length, MemoryDomain.Endian.Little, addr => board.VRAM[addr], (addr, value) => board.VRAM[addr] = value); domains.Add(VRAM); } if (board.WRAM != null) { var WRAM = new MemoryDomain("WRAM", board.WRAM.Length, MemoryDomain.Endian.Little, addr => board.WRAM[addr], (addr, value) => board.WRAM[addr] = value); domains.Add(WRAM); } // if there were more boards with special ram sets, we'd want to do something more general if (board is FDS) domains.Add((board as FDS).GetDiskPeeker()); else if (board is ExROM) domains.Add((board as ExROM).GetExRAM()); memoryDomains = new MemoryDomainList(domains); }
void SetupMemoryDomains() { var domains = new List<MemoryDomain>(3); var MainMemoryDomain = new MemoryDomain("Main RAM", Ram.Length, MemoryDomain.Endian.Big, addr => Ram[addr & 0xFFFF], (addr, value) => Ram[addr & 0xFFFF] = value); var Z80Domain = new MemoryDomain("Z80 RAM", Z80Ram.Length, MemoryDomain.Endian.Little, addr => Z80Ram[addr & 0x1FFF], (addr, value) => { Z80Ram[addr & 0x1FFF] = value; }); var VRamDomain = new MemoryDomain("Video RAM", VDP.VRAM.Length, MemoryDomain.Endian.Big, addr => VDP.VRAM[addr & 0xFFFF], (addr, value) => VDP.VRAM[addr & 0xFFFF] = value); var RomDomain = new MemoryDomain("MD CART", RomData.Length, MemoryDomain.Endian.Big, addr => RomData[addr], //adelikat: For speed considerations, I didn't mask this, every tool that uses memory domains is smart enough not to overflow, if I'm wrong let me know! (addr, value) => RomData[addr & (RomData.Length - 1)] = value); var SystemBusDomain = new MemoryDomain("System Bus", 0x1000000, MemoryDomain.Endian.Big, addr => (byte)ReadByte((int)addr), (addr, value) => Write8((uint)addr, (uint)value)); domains.Add(MainMemoryDomain); domains.Add(Z80Domain); domains.Add(VRamDomain); domains.Add(RomDomain); domains.Add(SystemBusDomain); memoryDomains = new MemoryDomainList(domains); (ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(memoryDomains); }
void SetupMemoryDomains() { var domains = new List<MemoryDomain>(10); int mainmemorymask = Ram.Length - 1; var MainMemoryDomain = new MemoryDomain("Main Memory", Ram.Length, MemoryDomain.Endian.Little, addr => Ram[addr], (addr, value) => Ram[addr] = value); domains.Add(MainMemoryDomain); var SystemBusDomain = new MemoryDomain("System Bus", 0x200000, MemoryDomain.Endian.Little, (addr) => { if (addr < 0 || addr >= 0x200000) throw new ArgumentOutOfRangeException(); return Cpu.ReadMemory21(addr); }, (addr, value) => { if (addr < 0 || addr >= 0x200000) throw new ArgumentOutOfRangeException(); Cpu.WriteMemory21(addr, value); }); domains.Add(SystemBusDomain); var RomDomain = new MemoryDomain("ROM", RomLength, MemoryDomain.Endian.Little, addr => RomData[addr], (addr, value) => RomData[addr] = value); domains.Add(RomDomain); if (BRAM != null) { var BRAMMemoryDomain = new MemoryDomain("Battery RAM", Ram.Length, MemoryDomain.Endian.Little, addr => BRAM[addr], (addr, value) => BRAM[addr] = value); domains.Add(BRAMMemoryDomain); } if (TurboCD) { var CDRamMemoryDomain = new MemoryDomain("TurboCD RAM", CDRam.Length, MemoryDomain.Endian.Little, addr => CDRam[addr], (addr, value) => CDRam[addr] = value); domains.Add(CDRamMemoryDomain); var AdpcmMemoryDomain = new MemoryDomain("ADPCM RAM", ADPCM.RAM.Length, MemoryDomain.Endian.Little, addr => ADPCM.RAM[addr], (addr, value) => ADPCM.RAM[addr] = value); domains.Add(AdpcmMemoryDomain); if (SuperRam != null) { var SuperRamMemoryDomain = new MemoryDomain("Super System Card RAM", SuperRam.Length, MemoryDomain.Endian.Little, addr => SuperRam[addr], (addr, value) => SuperRam[addr] = value); domains.Add(SuperRamMemoryDomain); } } if (ArcadeCard) { var ArcadeRamMemoryDomain = new MemoryDomain("Arcade Card RAM", ArcadeRam.Length, MemoryDomain.Endian.Little, addr => ArcadeRam[addr], (addr, value) => ArcadeRam[addr] = value); domains.Add(ArcadeRamMemoryDomain); } if (PopulousRAM != null) { var PopulusRAMDomain = new MemoryDomain("Cart Battery RAM", PopulousRAM.Length, MemoryDomain.Endian.Little, addr => PopulousRAM[addr], (addr, value) => PopulousRAM[addr] = value); domains.Add(PopulusRAMDomain); } memoryDomains = new MemoryDomainList(domains); }
unsafe void InitMemoryDomains() { List<MemoryDomain> mm = new List<MemoryDomain>(); for (int i = 0; ; i++) { IntPtr data = IntPtr.Zero; int size = 0; bool writable = false; IntPtr name = IntPtr.Zero; if (!LibQuickNES.qn_get_memory_area(Context, i, ref data, ref size, ref writable, ref name)) break; if (data != IntPtr.Zero && size > 0 && name != IntPtr.Zero) { byte* p = (byte*)data; mm.Add(new MemoryDomain ( Marshal.PtrToStringAnsi(name), size, MemoryDomain.Endian.Unknown, delegate(int addr) { if (addr < 0 || addr >= size) throw new ArgumentOutOfRangeException(); return p[addr]; }, delegate(int addr, byte val) { if (!writable) return; if (addr < 0 || addr >= size) throw new ArgumentOutOfRangeException(); p[addr] = val; } )); } } // add system bus mm.Add(new MemoryDomain ( "System Bus", 0x10000, MemoryDomain.Endian.Unknown, delegate(int addr) { if (addr < 0 || addr >= 0x10000) throw new ArgumentOutOfRangeException(); return LibQuickNES.qn_peek_prgbus(Context, addr); }, delegate(int addr, byte val) { if (addr < 0 || addr >= 0x10000) throw new ArgumentOutOfRangeException(); LibQuickNES.qn_poke_prgbus(Context, addr, val); } )); MemoryDomains = new MemoryDomainList(mm, 0); }
void SetUpMemoryDomains() { _MemoryDomains.Clear(); // this must be first to coincide with "main memory" // note that ewram could also be considered main memory depending on which hairs you split AddMemoryDomain(LibMeteor.MemoryArea.iwram, 32 * 1024, "IWRAM"); AddMemoryDomain(LibMeteor.MemoryArea.ewram, 256 * 1024, "EWRAM"); AddMemoryDomain(LibMeteor.MemoryArea.bios, 16 * 1024, "BIOS"); AddMemoryDomain(LibMeteor.MemoryArea.palram, 1024, "PALRAM"); AddMemoryDomain(LibMeteor.MemoryArea.vram, 96 * 1024, "VRAM"); AddMemoryDomain(LibMeteor.MemoryArea.oam, 1024, "OAM"); // even if the rom is less than 32MB, the whole is still valid in meteor AddMemoryDomain(LibMeteor.MemoryArea.rom, 32 * 1024 * 1024, "ROM"); // special domain for system bus { MemoryDomain sb = new MemoryDomain("BUS", 1 << 28, MemoryDomain.Endian.Little, delegate(int addr) { if (addr < 0 || addr >= 0x10000000) throw new IndexOutOfRangeException(); return LibMeteor.libmeteor_peekbus((uint)addr); }, delegate(int addr, byte val) { if (addr < 0 || addr >= 0x10000000) throw new IndexOutOfRangeException(); LibMeteor.libmeteor_writebus((uint)addr, val); }); _MemoryDomains.Add(sb); } // special combined ram memory domain { var ew = _MemoryDomains[1]; var iw = _MemoryDomains[0]; MemoryDomain cr = new MemoryDomain("Combined WRAM", (256 + 32) * 1024, MemoryDomain.Endian.Little, delegate(int addr) { if (addr < 0 || addr >= (256 + 32) * 1024) throw new IndexOutOfRangeException(); if (addr >= 256 * 1024) return iw.PeekByte(addr & 32767); else return ew.PeekByte(addr); }, delegate(int addr, byte val) { if (addr < 0 || addr >= (256 + 32) * 1024) throw new IndexOutOfRangeException(); if (addr >= 256 * 1024) iw.PokeByte(addr & 32767, val); else ew.PokeByte(addr, val); }); _MemoryDomains.Add(cr); } MemoryDomains = new MemoryDomainList(_MemoryDomains); }
unsafe void SetMemoryDomains() { var mm = new List<MemoryDomain>(); for (int i = LibGPGX.MIN_MEM_DOMAIN; i <= LibGPGX.MAX_MEM_DOMAIN; i++) { IntPtr area = IntPtr.Zero; int size = 0; IntPtr pname = LibGPGX.gpgx_get_memdom(i, ref area, ref size); if (area == IntPtr.Zero || pname == IntPtr.Zero || size == 0) continue; string name = Marshal.PtrToStringAnsi(pname); byte* p = (byte*)area; mm.Add(new MemoryDomain(name, size, MemoryDomain.Endian.Unknown, delegate(int addr) { if (addr < 0 || addr >= size) throw new ArgumentOutOfRangeException(); return p[addr]; }, delegate(int addr, byte val) { if (addr < 0 || addr >= size) throw new ArgumentOutOfRangeException(); p[addr] = val; })); } MemoryDomains = new MemoryDomainList(mm, 0); }
void SetMemoryDomains() { var mm = new List<MemoryDomain>(); foreach (var md in L.MemoryDomains) mm.Add(new MemoryDomain("L " + md.Name, md.Size, md.EndianType, md.PeekByte, md.PokeByte)); foreach (var md in R.MemoryDomains) mm.Add(new MemoryDomain("R " + md.Name, md.Size, md.EndianType, md.PeekByte, md.PokeByte)); MemoryDomains = new MemoryDomainList(mm); }
void InitMemoryDomains() { CreateMemoryDomain(LibGambatte.MemoryAreas.wram, "WRAM"); CreateMemoryDomain(LibGambatte.MemoryAreas.rom, "ROM"); CreateMemoryDomain(LibGambatte.MemoryAreas.vram, "VRAM"); CreateMemoryDomain(LibGambatte.MemoryAreas.cartram, "Cart RAM"); CreateMemoryDomain(LibGambatte.MemoryAreas.oam, "OAM"); CreateMemoryDomain(LibGambatte.MemoryAreas.hram, "HRAM"); // also add a special memory domain for the system bus, where calls get sent directly to the core each time _MemoryDomains.Add(new MemoryDomain("System Bus", 65536, MemoryDomain.Endian.Little, delegate(int addr) { if (addr < 0 || addr >= 65536) throw new ArgumentOutOfRangeException(); return LibGambatte.gambatte_cpuread(GambatteState, (ushort)addr); }, delegate(int addr, byte val) { if (addr < 0 || addr >= 65536) throw new ArgumentOutOfRangeException(); LibGambatte.gambatte_cpuwrite(GambatteState, (ushort)addr, val); })); MemoryDomains = new MemoryDomainList(_MemoryDomains); }
private void InitMemoryDomains() { MakeMemoryDomain("RDRAM", mupen64plusApi.N64_MEMORY.RDRAM, MemoryDomain.Endian.Little); MakeMemoryDomain("PI Register", mupen64plusApi.N64_MEMORY.PI_REG, MemoryDomain.Endian.Little); MakeMemoryDomain("SI Register", mupen64plusApi.N64_MEMORY.SI_REG, MemoryDomain.Endian.Little); MakeMemoryDomain("VI Register", mupen64plusApi.N64_MEMORY.VI_REG, MemoryDomain.Endian.Little); MakeMemoryDomain("RI Register", mupen64plusApi.N64_MEMORY.RI_REG, MemoryDomain.Endian.Little); MakeMemoryDomain("AI Register", mupen64plusApi.N64_MEMORY.AI_REG, MemoryDomain.Endian.Little); MakeMemoryDomain("EEPROM", mupen64plusApi.N64_MEMORY.EEPROM, MemoryDomain.Endian.Little); if (_syncSettings.Controllers[0].IsConnected && _syncSettings.Controllers[0].PakType == N64SyncSettings.N64ControllerSettings.N64ControllerPakType.MEMORY_CARD) { MakeMemoryDomain("Mempak 1", mupen64plusApi.N64_MEMORY.MEMPAK1, MemoryDomain.Endian.Little); } if (_syncSettings.Controllers[1].IsConnected && _syncSettings.Controllers[1].PakType == N64SyncSettings.N64ControllerSettings.N64ControllerPakType.MEMORY_CARD) { MakeMemoryDomain("Mempak 2", mupen64plusApi.N64_MEMORY.MEMPAK2, MemoryDomain.Endian.Little); } if (_syncSettings.Controllers[2].IsConnected && _syncSettings.Controllers[2].PakType == N64SyncSettings.N64ControllerSettings.N64ControllerPakType.MEMORY_CARD) { MakeMemoryDomain("Mempak 3", mupen64plusApi.N64_MEMORY.MEMPAK3, MemoryDomain.Endian.Little); } if (_syncSettings.Controllers[3].IsConnected && _syncSettings.Controllers[3].PakType == N64SyncSettings.N64ControllerSettings.N64ControllerPakType.MEMORY_CARD) { MakeMemoryDomain("Mempak 4", mupen64plusApi.N64_MEMORY.MEMPAK4, MemoryDomain.Endian.Little); } MemoryDomains = new MemoryDomainList(_memoryDomains); }
void HardReset() { cart = Cart.Create(rom, GameInfo.CartType); ILogger logger = new ConsoleLogger(); HSC7800 hsc7800 = null; if (hsbios != null) { hsc7800 = new HSC7800(hsbios, hsram); } Bios7800 bios7800 = new Bios7800(bios); theMachine = MachineBase.Create (GameInfo.MachineType, cart, bios7800, hsc7800, GameInfo.LController, GameInfo.RController, logger); theMachine.Reset(); theMachine.InputState.InputPollCallback = CoreComm.InputCallback.Call; ControlAdapter = new Atari7800Control(theMachine); ControllerDefinition = ControlAdapter.ControlType; avProvider.ConnectToMachine(theMachine, GameInfo); // to sync exactly with audio as this emulator creates and times it, the frame rate should be exactly 60:1 or 50:1 CoreComm.VsyncNum = theMachine.FrameHZ; CoreComm.VsyncDen = 1; // reset memory domains if (_MemoryDomains == null) { _MemoryDomains = new List<MemoryDomain>(); if (theMachine is Machine7800) { _MemoryDomains.Add(new MemoryDomain( "RAM1", 0x800, MemoryDomain.Endian.Unknown, delegate(int addr) { if (addr < 0 || addr >= 0x800) throw new ArgumentOutOfRangeException(); return ((Machine7800)theMachine).RAM1[(ushort)addr]; }, delegate(int addr, byte val) { if (addr < 0 || addr >= 0x800) throw new ArgumentOutOfRangeException(); ((Machine7800)theMachine).RAM1[(ushort)addr] = val; })); _MemoryDomains.Add(new MemoryDomain( "RAM2", 0x800, MemoryDomain.Endian.Unknown, delegate(int addr) { if (addr < 0 || addr >= 0x800) throw new ArgumentOutOfRangeException(); return ((Machine7800)theMachine).RAM2[(ushort)addr]; }, delegate(int addr, byte val) { if (addr < 0 || addr >= 0x800) throw new ArgumentOutOfRangeException(); ((Machine7800)theMachine).RAM2[(ushort)addr] = val; })); _MemoryDomains.Add(new MemoryDomain( "BIOS ROM", bios.Length, MemoryDomain.Endian.Unknown, delegate(int addr) { return bios[addr]; }, delegate(int addr, byte val) { })); if (hsc7800 != null) { _MemoryDomains.Add(new MemoryDomain( "HSC ROM", hsbios.Length, MemoryDomain.Endian.Unknown, delegate(int addr) { return hsbios[addr]; }, delegate(int addr, byte val) { })); _MemoryDomains.Add(new MemoryDomain( "HSC RAM", hsram.Length, MemoryDomain.Endian.Unknown, delegate(int addr) { return hsram[addr]; }, delegate(int addr, byte val) { hsram[addr] = val; })); } _MemoryDomains.Add(new MemoryDomain( "System Bus", 65536, MemoryDomain.Endian.Unknown, delegate(int addr) { if (addr < 0 || addr >= 0x10000) throw new ArgumentOutOfRangeException(); return theMachine.Mem[(ushort)addr]; }, delegate(int addr, byte val) { if (addr < 0 || addr >= 0x10000) throw new ArgumentOutOfRangeException(); theMachine.Mem[(ushort)addr] = val; })); } else // todo 2600? { } MemoryDomains = new MemoryDomainList(_MemoryDomains); } }