GPGX - disassembler support

This commit is contained in:
adelikat 2016-02-20 09:35:34 -05:00
parent 13e274cba5
commit f59038fb90
3 changed files with 70 additions and 11 deletions

View File

@ -738,7 +738,7 @@
<DependentUpon>QuickNES.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Nintendo\QuickNES\QuickNES.ITraceable.cs">
<DependentUpon>QuickNES.cs</DependentUpon>
<DependentUpon>QuickNES.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Nintendo\QuickNES\QuickNES.IVideoProvider.cs">
<DependentUpon>QuickNES.cs</DependentUpon>
@ -770,6 +770,7 @@
<Compile Include="Consoles\Sega\Genesis\Native68000\Musashi.cs" />
<Compile Include="Consoles\Sega\gpgx\GenDbgHlp.cs" />
<Compile Include="Consoles\Sega\gpgx\GPGX.cs" />
<Compile Include="Consoles\Sega\gpgx\GPGX.IDisassembler.cs" />
<Compile Include="Consoles\Sega\gpgx\GPGXControlConverter.cs" />
<Compile Include="Consoles\Sega\gpgx\LibGPGX.cs" />
<Compile Include="Consoles\Sega\Saturn\FilePiping.cs" />

View File

@ -0,0 +1,45 @@
using System.Collections.Generic;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Components.M68000;
namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
{
public partial class GPGX : IDisassemblable
{
public string Cpu
{
get
{
return "M68000";
}
set
{
}
}
public string PCRegisterName
{
get { return "M68K PC"; }
}
public IEnumerable<string> AvailableCpus
{
get { yield return "M68000"; }
}
public string Disassemble(MemoryDomain m, uint addr, out int length)
{
_disassemblerInstance.ReadWord = (a) => (short)m.PeekWord(a, m.EndianType == MemoryDomain.Endian.Big);
_disassemblerInstance.ReadByte = (a) => (sbyte)m.PeekByte(a);
_disassemblerInstance.ReadLong = (a) => (int)m.PeekDWord(a, m.EndianType == MemoryDomain.Endian.Big);
var info = _disassemblerInstance.Disassemble((int)addr);
length = info.Length;
return info.ToString();
}
// TODO: refactor MC6800's disassembler to be a static call
private MC68000 _disassemblerInstance = new MC68000();
}
}

View File

@ -25,8 +25,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
portedUrl: "https://code.google.com/p/genplus-gx/",
singleInstance: true
)]
public class GPGX : IEmulator, ISyncSoundProvider, IVideoProvider, ISaveRam, IStatable, IRegionable,
IInputPollable, IDebuggable, ISettable<GPGX.GPGXSettings, GPGX.GPGXSyncSettings>, IDriveLight, ICodeDataLogger
public partial class GPGX : IEmulator, ISyncSoundProvider, IVideoProvider, ISaveRam, IStatable, IRegionable,
IInputPollable, IDebuggable, ISettable<GPGX.GPGXSettings, GPGX.GPGXSyncSettings>, IDriveLight, ICodeDataLogger, IDisassemblable
{
static GPGX AttachedCore = null;
@ -667,40 +667,53 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
mm.Add(MemoryDomain.FromIntPtrSwap16(name, size, MemoryDomain.Endian.Big, area, writable: true, byteSize: byteSize));
}
}
mm.Add(new MemoryDomain("M68K BUS", 0x1000000, MemoryDomain.Endian.Big,
delegate(long addr)
var m68Bus = new MemoryDomain("M68K BUS", 0x1000000, MemoryDomain.Endian.Big,
delegate (long addr)
{
var a = (uint)addr;
if (a >= 0x1000000)
throw new ArgumentOutOfRangeException();
return LibGPGX.gpgx_peek_m68k_bus(a);
},
delegate(long addr, byte val)
delegate (long addr, byte val)
{
var a = (uint)addr;
if (a >= 0x1000000)
throw new ArgumentOutOfRangeException();
LibGPGX.gpgx_write_m68k_bus(a, val);
}, 2));
mm.Add(new MemoryDomain("S68K BUS", 0x1000000, MemoryDomain.Endian.Big,
delegate(long addr)
}, 2);
mm.Add(m68Bus);
var s68Bus = new MemoryDomain("S68K BUS", 0x1000000, MemoryDomain.Endian.Big,
delegate (long addr)
{
var a = (uint)addr;
if (a >= 0x1000000)
throw new ArgumentOutOfRangeException();
return LibGPGX.gpgx_peek_s68k_bus(a);
},
delegate(long addr, byte val)
delegate (long addr, byte val)
{
var a = (uint)addr;
if (a >= 0x1000000)
throw new ArgumentOutOfRangeException();
LibGPGX.gpgx_write_s68k_bus(a, val);
}, 2));
}, 2);
if (IsSegaCD)
{
mm.Add(s68Bus);
}
MemoryDomains = new MemoryDomainList(mm);
MemoryDomains.SystemBus = IsSegaCD ? s68Bus : m68Bus;
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(MemoryDomains);
}
public bool IsSegaCD { get { return CD != null; } }
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
{
LibGPGX.RegisterInfo[] regs = new LibGPGX.RegisterInfo[LibGPGX.gpgx_getmaxnumregs()];