本文整理汇总了C#中BizHawk.Emulation.Common.MemoryDomain类的典型用法代码示例。如果您正苦于以下问题:C# MemoryDomain类的具体用法?C# MemoryDomain怎么用?C# MemoryDomain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MemoryDomain类属于BizHawk.Emulation.Common命名空间,在下文中一共展示了MemoryDomain类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Disassemble
public override string Disassemble(MemoryDomain m, uint addr, out int length)
{
ushort tmp;
string ret = Common.Components.Z80GB.NewDisassembler.Disassemble((ushort)addr, (a) => m.PeekByte(a), out tmp);
length = tmp;
return ret;
}
示例2: SetupMemoryDomains
private 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);
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(memoryDomains);
}
示例3: SetupMemoryDomains
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);
}
示例4: SetUpMemoryDomains
private void SetUpMemoryDomains()
{
_domainList.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("System Bus", 1 << 28, MemoryDomain.Endian.Little,
delegate(long addr)
{
if (addr < 0 || addr >= 0x10000000)
throw new IndexOutOfRangeException();
return LibMeteor.libmeteor_peekbus((uint)addr);
},
delegate(long addr, byte val)
{
if (addr < 0 || addr >= 0x10000000)
throw new IndexOutOfRangeException();
LibMeteor.libmeteor_writebus((uint)addr, val);
});
_domainList.Add(sb);
}
// special combined ram memory domain
{
var ew = _domainList[1];
var iw = _domainList[0];
MemoryDomain cr = new MemoryDomain("Combined WRAM", (256 + 32) * 1024, MemoryDomain.Endian.Little,
delegate(long 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(long 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);
});
_domainList.Add(cr);
}
_memoryDomains = new MemoryDomainList(_domainList);
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains);
}
示例5: MemoryLuaLibrary
public MemoryLuaLibrary(Lua lua)
: base(lua)
{
if (MemoryDomainCore != null)
{
_currentMemoryDomain = MemoryDomainCore.MainMemory;
}
}
示例6: Disassemble
public string Disassemble(MemoryDomain m, uint addr, out int length)
{
if (_selectedDisassemblable == null)
{
SetDefaultDisassemblable();
}
return _selectedDisassemblable.Disassemble(m, addr, out length);
}
示例7: InitMemoryDomains
private void InitMemoryDomains()
{
var mm = new List<MemoryDomain>();
var s = new LibVBANext.MemoryAreas();
var l = MemoryDomain.Endian.Little;
LibVBANext.GetMemoryAreas(Core, s);
mm.Add(MemoryDomain.FromIntPtr("IWRAM", 32 * 1024, l, s.iwram, true, 4));
mm.Add(MemoryDomain.FromIntPtr("EWRAM", 256 * 1024, l, s.ewram, true, 4));
mm.Add(MemoryDomain.FromIntPtr("BIOS", 16 * 1024, l, s.bios, false, 4));
mm.Add(MemoryDomain.FromIntPtr("PALRAM", 1024, l, s.palram, false, 4));
mm.Add(MemoryDomain.FromIntPtr("VRAM", 96 * 1024, l, s.vram, true, 4));
mm.Add(MemoryDomain.FromIntPtr("OAM", 1024, l, s.oam, true, 4));
mm.Add(MemoryDomain.FromIntPtr("ROM", 32 * 1024 * 1024, l, s.rom, true, 4));
mm.Add(new MemoryDomain("System Bus", 0x10000000, l,
delegate(long addr)
{
if (addr < 0 || addr >= 0x10000000)
throw new ArgumentOutOfRangeException();
return LibVBANext.SystemBusRead(Core, (int)addr);
},
delegate(long addr, byte val)
{
if (addr < 0 || addr >= 0x10000000)
throw new ArgumentOutOfRangeException();
LibVBANext.SystemBusWrite(Core, (int)addr, val);
}, 4));
// special combined ram memory domain
{
var ew = mm[1];
var iw = mm[0];
MemoryDomain cr = new MemoryDomain("Combined WRAM", (256 + 32) * 1024, MemoryDomain.Endian.Little,
delegate(long 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(long 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);
}, 4);
mm.Add(cr);
}
_memoryDomains = new MemoryDomainList(mm);
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains);
}
示例8: WrappedMemoryDomain
public WrappedMemoryDomain(string name, MemoryDomain m)
{
_m = m;
Name = name;
Size = m.Size;
WordSize = m.WordSize;
EndianType = m.EndianType;
Writable = m.Writable;
}
示例9: Disassemble
public string Disassemble(MemoryDomain m, uint addr, out int length)
{
_disassemblerInstance.ReadWord = (a) => (short)m.PeekUshort(a, m.EndianType == MemoryDomain.Endian.Big);
_disassemblerInstance.ReadByte = (a) => (sbyte)m.PeekByte(a);
_disassemblerInstance.ReadLong = (a) => (int)m.PeekUint(a, m.EndianType == MemoryDomain.Endian.Big);
var info = _disassemblerInstance.Disassemble((int)addr);
length = info.Length;
return string.Format("{0:X4} {1,-7} {2}", info.RawBytes.Substring(0, 4), info.Mnemonic, info.Args);
}
示例10: Disassemble
public string Disassemble(MemoryDomain m, uint addr, out int length)
{
length = 4; // TODO: is this right?
var instruction = m.PeekUint(addr, true);
//TODO - reserve buffer here for disassembling into. allocating repeatedly will be slower
var result = api.m64p_decode_op(instruction, addr);
string strResult = Marshal.PtrToStringAnsi(result);
return strResult;
}
示例11: WordWatch
/// <summary>
/// Inialize a new instance of <see cref="WordWatch"/>
/// </summary>
/// <param name="domain"><see cref="MemoryDomain"/> where you want to track</param>
/// <param name="address">The address you want to track</param>
/// <param name="type">How you you want to display the value See <see cref="DisplayType"/></param>
/// <param name="bigEndian">Specify the endianess. true for big endian</param>
/// <param name="note">A custom note about the <see cref="Watch"/></param>
/// <param name="value">Current value</param>
/// <param name="previous">Previous value</param>
/// <param name="changeCount">How many times value has changed</param>
/// <exception cref="ArgumentException">Occurs when a <see cref="DisplayType"/> is incompatible with <see cref="WatchSize.Word"/></exception>
internal WordWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string note, ushort value, ushort previous, int changeCount)
: base(domain, address, WatchSize.Word, type, bigEndian, note)
{
if (value == 0)
{
this._value = GetWord();
}
else
{
this._value = value;
}
this._previous = previous;
this._changecount = changeCount;
}
示例12: ByteWatch
public ByteWatch(MemoryDomain domain, long address, DisplayType type, bool bigEndian, string notes)
{
_address = address;
_domain = domain;
_value = _previous = GetByte();
if (AvailableTypes(WatchSize.Byte).Contains(type))
{
_type = type;
}
_bigEndian = bigEndian;
if (notes != null)
{
Notes = notes;
}
}
示例13: ToString
public static string ToString(Watch watch, MemoryDomain domain)
{
var numDigits = (domain.Size - 1).NumHexDigits();
var sb = new StringBuilder();
sb
.Append((watch.Address ?? 0).ToHexString(numDigits)).Append('\t')
.Append(watch.SizeAsChar).Append('\t')
.Append(watch.TypeAsChar).Append('\t')
.Append(watch.BigEndian ? '1' : '0').Append('\t')
.Append(watch.DomainName).Append('\t')
.Append(watch.Notes.Trim(new[] { '\r', '\n' }));
return sb.ToString();
}
示例14: SetWatch
public void SetWatch(MemoryDomain domain, IEnumerable<Watch> watches = null, Mode mode = Mode.New)
{
if (watches != null)
{
_watchList.AddRange(watches);
}
_mode = mode;
DomainDropDown.Items.Clear();
DomainDropDown.Items.AddRange(MemoryDomains
.Select(d => d.ToString())
.ToArray());
DomainDropDown.SelectedItem = MemoryDomains.MainMemory.ToString();
SetTitle();
}
示例15: SetupMemoryDomains
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.Read((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.Read((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);
}