pce: disassemble

This commit is contained in:
goyuken 2015-01-05 21:03:54 +00:00
parent efc8d26ac7
commit 574cd2f649
3 changed files with 62 additions and 3 deletions

View File

@ -575,6 +575,7 @@
<Compile Include="CPUs\HuC6280\Disassembler.cs" />
<Compile Include="CPUs\HuC6280\Execute.cs" />
<Compile Include="CPUs\HuC6280\HuC6280.cs" />
<Compile Include="CPUs\HuC6280\IDisassemblable.cs" />
<Compile Include="CPUs\MOS 6502X\Disassembler.cs" />
<Compile Include="CPUs\MOS 6502X\Execute.cs" />
<Compile Include="CPUs\MOS 6502X\MOS6502X.cs" />

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Components.H6280
{
partial class HuC6280 : IDisassemblable
{
public string Cpu
{
get { return "6280"; }
set { }
}
public string PCRegisterName
{
get { return "PC"; }
}
public IEnumerable<string> AvailableCpus
{
get { yield return "6280"; }
}
public string Disassemble(MemoryDomain m, uint addr, out int length)
{
if (m.Size != 0x10000)
throw new InvalidOperationException("Something needs to be figured out...");
return DisassembleExt((ushort)addr, out length,
(a) => m.PeekByte(a),
(a) => (ushort)(m.PeekByte(a) | m.PeekByte(a + 1) << 8));
}
}
}

View File

@ -68,9 +68,6 @@ namespace BizHawk.Emulation.Cores.PCEngine
[CoreConstructor("PCE", "SGX")]
public PCEngine(CoreComm comm, GameInfo game, byte[] rom, object Settings, object syncSettings)
{
ServiceProvider = new BasicServiceProvider(this);
Tracer = new TraceBuffer();
(ServiceProvider as BasicServiceProvider).Register<ITraceable>(Tracer);
MemoryCallbacks = new MemoryCallbackSystem();
CoreComm = comm;
@ -90,6 +87,14 @@ namespace BizHawk.Emulation.Cores.PCEngine
_syncSettings = (PCESyncSettings)syncSettings ?? new PCESyncSettings();
Init(game, rom);
SetControllerButtons();
{
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
Tracer = new TraceBuffer();
ser.Register<ITraceable>(Tracer);
ser.Register<IDisassemblable>(Cpu);
}
}
public IEmulatorServiceProvider ServiceProvider { get; private set; }
@ -491,6 +496,21 @@ namespace BizHawk.Emulation.Cores.PCEngine
});
domains.Add(SystemBusDomain);
var CpuBusDomain = new MemoryDomain("CPU Bus", 0x10000, MemoryDomain.Endian.Little,
(addr) =>
{
if (addr < 0 || addr >= 0x10000)
throw new ArgumentOutOfRangeException();
return Cpu.ReadMemory((ushort)addr);
},
(addr, value) =>
{
if (addr < 0 || addr >= 0x10000)
throw new ArgumentOutOfRangeException();
Cpu.WriteMemory((ushort)addr, value);
});
domains.Add(CpuBusDomain);
var RomDomain = new MemoryDomain("ROM", RomLength, MemoryDomain.Endian.Little,
addr => RomData[addr],
(addr, value) => RomData[addr] = value);