stuff
This commit is contained in:
parent
61c50e1d7c
commit
c77de0e8af
|
@ -33,70 +33,118 @@ namespace BizHawk.Emulation.Common
|
||||||
|
|
||||||
public class RegisterValue
|
public class RegisterValue
|
||||||
{
|
{
|
||||||
public ulong Value { get; set; }
|
public ulong Value { get; private set; }
|
||||||
public byte BitSize { get; set; }
|
public byte BitSize { get; private set; }
|
||||||
|
|
||||||
|
public RegisterValue(ulong val, byte bitSize)
|
||||||
|
{
|
||||||
|
if (bitSize == 64)
|
||||||
|
Value = val;
|
||||||
|
else if (bitSize > 64 || bitSize == 0)
|
||||||
|
throw new System.ArgumentOutOfRangeException("bitSize", "BitSize must be in 1..64");
|
||||||
|
else
|
||||||
|
Value = val & (1UL << bitSize) - 1;
|
||||||
|
BitSize = bitSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegisterValue(bool val)
|
||||||
|
{
|
||||||
|
Value = val ? 1UL : 0UL;
|
||||||
|
BitSize = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegisterValue(byte val)
|
||||||
|
{
|
||||||
|
Value = val;
|
||||||
|
BitSize = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegisterValue(sbyte val)
|
||||||
|
{
|
||||||
|
Value = (byte)val;
|
||||||
|
BitSize = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegisterValue(ushort val)
|
||||||
|
{
|
||||||
|
Value = val;
|
||||||
|
BitSize = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegisterValue(short val)
|
||||||
|
{
|
||||||
|
Value = (ushort)val;
|
||||||
|
BitSize = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegisterValue(uint val)
|
||||||
|
{
|
||||||
|
Value = val;
|
||||||
|
BitSize = 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegisterValue(int val)
|
||||||
|
{
|
||||||
|
Value = (uint)val;
|
||||||
|
BitSize = 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegisterValue(ulong val)
|
||||||
|
{
|
||||||
|
Value = val;
|
||||||
|
BitSize = 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegisterValue(long val)
|
||||||
|
{
|
||||||
|
Value = (ulong)val;
|
||||||
|
BitSize = 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static implicit operator RegisterValue(bool val)
|
public static implicit operator RegisterValue(bool val)
|
||||||
{
|
{
|
||||||
return new RegisterValue
|
return new RegisterValue(val);
|
||||||
{
|
|
||||||
Value = (ulong)(val ? 1 : 0),
|
|
||||||
BitSize = 1
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator RegisterValue(byte val)
|
public static implicit operator RegisterValue(byte val)
|
||||||
{
|
{
|
||||||
return new RegisterValue
|
return new RegisterValue(val);
|
||||||
{
|
}
|
||||||
Value = val,
|
|
||||||
BitSize = 8
|
public static implicit operator RegisterValue(sbyte val)
|
||||||
};
|
{
|
||||||
|
return new RegisterValue(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator RegisterValue(ushort val)
|
public static implicit operator RegisterValue(ushort val)
|
||||||
{
|
{
|
||||||
return new RegisterValue
|
return new RegisterValue(val);
|
||||||
{
|
|
||||||
Value = val,
|
|
||||||
BitSize = 16
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator RegisterValue(int val)
|
public static implicit operator RegisterValue(short val)
|
||||||
{
|
{
|
||||||
return new RegisterValue
|
return new RegisterValue(val);
|
||||||
{
|
|
||||||
Value = (ulong)val,
|
|
||||||
BitSize = 32
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator RegisterValue(uint val)
|
public static implicit operator RegisterValue(uint val)
|
||||||
{
|
{
|
||||||
return new RegisterValue
|
return new RegisterValue(val);
|
||||||
{
|
|
||||||
Value = val,
|
|
||||||
BitSize = 32
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator RegisterValue(long val)
|
public static implicit operator RegisterValue(int val)
|
||||||
{
|
{
|
||||||
return new RegisterValue
|
return new RegisterValue(val);
|
||||||
{
|
|
||||||
Value = (ulong)val,
|
|
||||||
BitSize = 64
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator RegisterValue(ulong val)
|
public static implicit operator RegisterValue(ulong val)
|
||||||
{
|
{
|
||||||
return new RegisterValue
|
return new RegisterValue(val);
|
||||||
{
|
}
|
||||||
Value = val,
|
|
||||||
BitSize = 64
|
public static implicit operator RegisterValue(long val)
|
||||||
};
|
{
|
||||||
|
return new RegisterValue(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,15 +24,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
if (name.Contains("68K SR") || name.StartsWith("Z80"))
|
if (name.Contains("68K SR") || name.StartsWith("Z80"))
|
||||||
size = 16;
|
size = 16;
|
||||||
|
|
||||||
// TODO: clean me up
|
ret[name] = new RegisterValue((ulong)regs[i].Value, size);
|
||||||
if (size == 16)
|
|
||||||
{
|
|
||||||
ret[Marshal.PtrToStringAnsi(regs[i].Name)] = (ushort)regs[i].Value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret[Marshal.PtrToStringAnsi(regs[i].Name)] = (uint)regs[i].Value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue