diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
index 25dca6a906..663d0ecca5 100644
--- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
+++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
@@ -738,7 +738,7 @@
QuickNES.cs
- QuickNES.cs
+ QuickNES.cs
QuickNES.cs
@@ -770,6 +770,7 @@
+
diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.IDisassembler.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.IDisassembler.cs
new file mode 100644
index 0000000000..cb1e0043d8
--- /dev/null
+++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.IDisassembler.cs
@@ -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 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();
+ }
+}
diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs
index 39726deff9..c5e7499d99 100644
--- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs
@@ -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, IDriveLight, ICodeDataLogger
+ public partial class GPGX : IEmulator, ISyncSoundProvider, IVideoProvider, ISaveRam, IStatable, IRegionable,
+ IInputPollable, IDebuggable, ISettable, 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(MemoryDomains);
}
+ public bool IsSegaCD { get { return CD != null; } }
+
public IDictionary GetCpuFlagsAndRegisters()
{
LibGPGX.RegisterInfo[] regs = new LibGPGX.RegisterInfo[LibGPGX.gpgx_getmaxnumregs()];