make some effort to support memdomain of full 32bits size, and use it for n64 system bus. make sure to check that its disabled in ramsearch engine and in hex editor. we could probably fix it to work in hex editor later.

This commit is contained in:
zeromus 2014-09-09 21:34:41 +00:00
parent a8684c34a6
commit 87e9d235f6
5 changed files with 34 additions and 8 deletions

View File

@ -174,32 +174,44 @@ namespace BizHawk.Client.Common
protected byte GetByte()
{
return _domain.PeekByte(_address % _domain.Size);
if (_domain.Size == 0)
return _domain.PeekByte(_address);
else return _domain.PeekByte(_address % _domain.Size);
}
protected ushort GetWord()
{
return _domain.PeekWord(_address % _domain.Size, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
if (_domain.Size == 0)
return _domain.PeekWord(_address, _bigEndian);
else return _domain.PeekWord(_address % _domain.Size, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
}
protected uint GetDWord()
{
return _domain.PeekDWord(_address % _domain.Size, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
if(_domain.Size == 0)
return _domain.PeekDWord(_address, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
else return _domain.PeekDWord(_address % _domain.Size, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
}
protected void PokeByte(byte val)
{
_domain.PokeByte(_address % _domain.Size, val);
if(_domain.Size == 0)
_domain.PokeByte(_address, val);
else _domain.PokeByte(_address % _domain.Size, val);
}
protected void PokeWord(ushort val)
{
_domain.PokeWord(_address % _domain.Size, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
if (_domain.Size == 0)
_domain.PokeWord(_address, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
else _domain.PokeWord(_address % _domain.Size, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
}
protected void PokeDWord(uint val)
{
_domain.PokeDWord(_address % _domain.Size, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
if (_domain.Size == 0)
_domain.PokeDWord(_address, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
else _domain.PokeDWord(_address % _domain.Size, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
}
public void ClearChangeCount() { _changecount = 0; }
@ -208,7 +220,7 @@ namespace BizHawk.Client.Common
{
get
{
return !IsSeparator && Address.Value >= Domain.Size;
return !IsSeparator && (Domain.Size != 0 && Address.Value >= Domain.Size);
}
}

View File

@ -661,6 +661,9 @@ namespace BizHawk.Client.EmuHawk
for (var i = 0; i < MemoryDomains.Count; i++)
{
//zero 09-sep-2014 - what cases would have a MemoryDomain of size 0?
//1. unspecified malfunctions (please specify)
//2. full 32bit memorydomains
if (MemoryDomains[i].Size > 0)
{
var str = MemoryDomains[i].ToString();

View File

@ -60,6 +60,12 @@ namespace BizHawk.Common.NumberExtensions
/// </summary>
public static int NumHexDigits(this int i)
{
//now this is a bit of a trick. if it was less than 0, it mustve been >= 0x80000000 and so takes all 8 digits
if (i < 0)
{
return 8;
}
if (i < 0x100)
{
return 2;

View File

@ -10,6 +10,11 @@ namespace BizHawk.Emulation.Common
public enum Endian { Big, Little, Unknown }
public readonly string Name;
/// <summary>
/// Special note: if this is 0, the memorydomain is 0x100000000 (full 32bits) in size.
/// This was judged to be less of a mess than using a bunch of longs everywhere.
/// </summary>
public readonly int Size;
public readonly Endian EndianType;

View File

@ -129,7 +129,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
_memoryDomains.Add(new MemoryDomain
(
name: "Sytem Bus",
size: int.MaxValue,
size: 0, //special case for full 32bit memorydomain
endian: MemoryDomain.Endian.Big,
peekByte: peekByte,
pokeByte: pokeByte