46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
![]() |
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 string.Format("{0:X4} {1,-7} {2}", info.RawBytes.Substring(0, 4), info.Mnemonic, info.Args);
|
|||
|
}
|
|||
|
|
|||
|
// TODO: refactor MC6800's disassembler to be a static call
|
|||
|
private MC68000 _disassemblerInstance = new MC68000();
|
|||
|
}
|
|||
|
}
|