sms: disassemble

This commit is contained in:
goyuken 2015-01-05 21:19:38 +00:00
parent 574cd2f649
commit 98b12af680
2 changed files with 38 additions and 6 deletions

View File

@ -11,10 +11,13 @@
//please note that however much youre tempted to, timings can't be put in a table here because they depend on how the instruction executes at runtime
using System;
using System.Collections.Generic;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Components.Z80
{
public class Disassembler
public class Disassembler : IDisassemblable
{
readonly static sbyte[,] opcodeSizes = new sbyte[7, 256];
@ -518,5 +521,33 @@ namespace BizHawk.Emulation.Cores.Components.Z80
{
return Result(DisassembleInternal(read), read);
}
#region IDisassemblable
public string Cpu
{
get { return "Z80"; }
set { }
}
public string PCRegisterName
{
get { return "PC"; }
}
public IEnumerable<string> AvailableCpus
{
get { yield return "Z80"; }
}
public string Disassemble(MemoryDomain m, uint addr, out int length)
{
int loc = (int)addr;
string ret = Disassemble(() => m.PeekByte(loc++));
length = loc - (int)addr;
return ret;
}
#endregion
}
}

View File

@ -212,6 +212,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
SaveRAM = new byte[0x8000];
SetupMemoryDomains();
(ServiceProvider as BasicServiceProvider).Register<IDisassemblable>(new Disassembler());
}
public IEmulatorServiceProvider ServiceProvider { get; private set; }