yabause tracer
This commit is contained in:
parent
cac0f533db
commit
6e0b8e2784
|
@ -942,6 +942,9 @@
|
|||
<Compile Include="Consoles\Sega\Saturn\Yabause.IStatable.cs">
|
||||
<DependentUpon>Yabause.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Sega\Saturn\Yabause.ITraceable.cs">
|
||||
<DependentUpon>Yabause.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Sega\SMS\SMS.cs" />
|
||||
<Compile Include="Consoles\Sega\SMS\SMS.ICodeDataLogger.cs">
|
||||
<DependentUpon>SMS.cs</DependentUpon>
|
||||
|
|
|
@ -85,6 +85,17 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
|||
public static extern void libyabause_setinputcallback(InputCallback cb);
|
||||
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void TraceCallback(string dis, string regs);
|
||||
|
||||
/// <summary>
|
||||
/// set a fcn to call every time input is read
|
||||
/// </summary>
|
||||
/// <param name="cb">execxutes right before the input read. null to clear</param>
|
||||
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void libyabause_settracecallback(TraceCallback cb);
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -79,6 +79,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
|||
|
||||
InputCallbackH = new LibYabause.InputCallback(() => InputCallbacks.Call());
|
||||
LibYabause.libyabause_setinputcallback(InputCallbackH);
|
||||
ConnectTracer();
|
||||
DriveLightEnabled = true;
|
||||
|
||||
DeactivateGL();
|
||||
|
@ -277,6 +278,11 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
|||
|
||||
DriveLightOn = false;
|
||||
|
||||
if (Tracer.Enabled)
|
||||
LibYabause.libyabause_settracecallback(trace_cb);
|
||||
else
|
||||
LibYabause.libyabause_settracecallback(null);
|
||||
|
||||
IsLagFrame = LibYabause.libyabause_frameadvance(out w, out h, out nsamp);
|
||||
BufferWidth = w;
|
||||
BufferHeight = h;
|
||||
|
|
|
@ -37,8 +37,9 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
});
|
||||
}
|
||||
|
||||
private void ConnectTracer()
|
||||
{
|
||||
private void ConnectTracer()
|
||||
{
|
||||
trace_cb = new OctoshockDll.ShockCallback_Trace(ShockTraceCallback);
|
||||
Tracer = new TraceBuffer() { Header = TraceHeader };
|
||||
ServiceProvider = new BasicServiceProvider(this);
|
||||
(ServiceProvider as BasicServiceProvider).Register<ITraceable>(Tracer);
|
||||
|
|
|
@ -323,8 +323,6 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
SetMemoryDomains();
|
||||
InitMemCallbacks();
|
||||
|
||||
trace_cb = new OctoshockDll.ShockCallback_Trace(ShockTraceCallback);
|
||||
|
||||
//set a default framebuffer based on the first frame of emulation, to cut down on flickering or whatever
|
||||
//this is probably quixotic, but we have to pick something
|
||||
{
|
||||
|
|
Binary file not shown.
|
@ -24,6 +24,13 @@ extern "C" __declspec(dllexport) void libyabause_setinputcallback(void (*cb)(voi
|
|||
inputcallback = cb;
|
||||
}
|
||||
|
||||
void (*tracecallback)(const char* dis, const char* regs) = NULL;
|
||||
|
||||
extern "C" __declspec(dllexport) void libyabause_settracecallback(void (*cb)(const char* dis, const char* regs))
|
||||
{
|
||||
tracecallback = cb;
|
||||
}
|
||||
|
||||
CDInterface FECD =
|
||||
{
|
||||
2,
|
||||
|
|
|
@ -36,149 +36,149 @@ typedef struct
|
|||
} i_descr;
|
||||
|
||||
i_descr tab[] = {
|
||||
{ ZERO_F, "clrt", 0xffff, 0x8, 0, 0 },
|
||||
{ ZERO_F, "clrmac", 0xffff, 0x28, 0, 0 },
|
||||
{ ZERO_F, "div0u", 0xffff, 0x19, 0, 0 },
|
||||
{ ZERO_F, "nop", 0xffff, 0x9, 0, 0 },
|
||||
{ ZERO_F, "rte", 0xffff, 0x2b, 0, 0 },
|
||||
{ ZERO_F, "rts", 0xffff, 0xb, 0, 0 },
|
||||
{ ZERO_F, "sett", 0xffff, 0x18, 0, 0 },
|
||||
{ ZERO_F, "sleep", 0xffff, 0x1b, 0, 0 },
|
||||
{ N_F, "cmp/pl r%d", 0xf0ff, 0x4015, 0, 0 },
|
||||
{ N_F, "cmp/pz r%d", 0xf0ff, 0x4011, 0, 0 },
|
||||
{ N_F, "dt r%d", 0xf0ff, 0x4010, 0, 1 },
|
||||
{ N_F, "movt r%d", 0xf0ff, 0x0029, 0, 0 },
|
||||
{ N_F, "rotl r%d", 0xf0ff, 0x4004, 0, 0 },
|
||||
{ N_F, "rotr r%d", 0xf0ff, 0x4005, 0, 0 },
|
||||
{ N_F, "rotcl r%d", 0xf0ff, 0x4024, 0, 0 },
|
||||
{ N_F, "rotcr r%d", 0xf0ff, 0x4025, 0, 0 },
|
||||
{ N_F, "shal r%d", 0xf0ff, 0x4020, 0, 0 },
|
||||
{ N_F, "shar r%d", 0xf0ff, 0x4021, 0, 0 },
|
||||
{ N_F, "shll r%d", 0xf0ff, 0x4000, 0, 0 },
|
||||
{ N_F, "shlr r%d", 0xf0ff, 0x4001, 0, 0 },
|
||||
{ N_F, "shll2 r%d", 0xf0ff, 0x4008, 0, 0 },
|
||||
{ N_F, "shlr2 r%d", 0xf0ff, 0x4009, 0, 0 },
|
||||
{ N_F, "shll8 r%d", 0xf0ff, 0x4018, 0, 0 },
|
||||
{ N_F, "shlr8 r%d", 0xf0ff, 0x4019, 0, 0 },
|
||||
{ N_F, "shll16 r%d", 0xf0ff, 0x4028, 0, 0 },
|
||||
{ N_F, "shlr16 r%d", 0xf0ff, 0x4029, 0, 0 },
|
||||
{ N_F, "stc sr, r%d", 0xf0ff, 0x0002, 0, 0 },
|
||||
{ N_F, "stc gbr, r%d", 0xf0ff, 0x0012, 0, 0 },
|
||||
{ N_F, "stc vbr, r%d", 0xf0ff, 0x0022, 0, 0 },
|
||||
{ N_F, "sts mach, r%d", 0xf0ff, 0x000a, 0, 0 },
|
||||
{ N_F, "sts macl, r%d", 0xf0ff, 0x001a, 0, 0 },
|
||||
{ N_F, "sts pr, r%d", 0xf0ff, 0x002a, 0, 0 },
|
||||
{ N_F, "tas.b @r%d", 0xf0ff, 0x401b, 0, 0 },
|
||||
{ N_F, "stc.l sr, @-r%d", 0xf0ff, 0x4003, 0, 0 },
|
||||
{ N_F, "stc.l gbr, @-r%d", 0xf0ff, 0x4013, 0, 0 },
|
||||
{ N_F, "stc.l vbr, @-r%d", 0xf0ff, 0x4023, 0, 0 },
|
||||
{ N_F, "sts.l mach, @-r%d", 0xf0ff, 0x4002, 0, 0 },
|
||||
{ N_F, "sts.l macl, @-r%d", 0xf0ff, 0x4012, 0, 0 },
|
||||
{ N_F, "sts.l pr, @-r%d", 0xf0ff, 0x4022, 0, 0 },
|
||||
{ M_F, "ldc r%d, sr", 0xf0ff, 0x400e, 0, 0 },
|
||||
{ M_F, "ldc r%d, gbr", 0xf0ff, 0x401e, 0, 0 },
|
||||
{ M_F, "ldc r%d, vbr", 0xf0ff, 0x402e, 0, 0 },
|
||||
{ M_F, "lds r%d, mach", 0xf0ff, 0x400a, 0, 0 },
|
||||
{ M_F, "lds r%d, macl", 0xf0ff, 0x401a, 0, 0 },
|
||||
{ M_F, "lds r%d, pr", 0xf0ff, 0x402a, 0, 0 },
|
||||
{ M_F, "jmp @r%d", 0xf0ff, 0x402b, 0, 0 },
|
||||
{ M_F, "jsr @r%d", 0xf0ff, 0x400b, 0, 0 },
|
||||
{ M_F, "ldc.l @r%d+, sr", 0xf0ff, 0x4007, 0, 0 },
|
||||
{ M_F, "ldc.l @r%d+, gbr", 0xf0ff, 0x4017, 0, 0 },
|
||||
{ M_F, "ldc.l @r%d+, vbr", 0xf0ff, 0x4027, 0, 0 },
|
||||
{ M_F, "lds.l @r%d+, mach", 0xf0ff, 0x4006, 0, 0 },
|
||||
{ M_F, "lds.l @r%d+, macl", 0xf0ff, 0x4016, 0, 0 },
|
||||
{ M_F, "lds.l @r%d+, pr", 0xf0ff, 0x4026, 0, 0 },
|
||||
{ M_F, "braf r%d", 0xf0ff, 0x0023, 0, 1 },
|
||||
{ M_F, "bsrf r%d", 0xf0ff, 0x0003, 0, 1 },
|
||||
{ NM_F, "add r%d, r%d", 0xf00f, 0x300c, 0, 0 },
|
||||
{ NM_F, "addc r%d, r%d", 0xf00f, 0x300e, 0, 0 },
|
||||
{ NM_F, "addv r%d, r%d", 0xf00f, 0x300f, 0, 0 },
|
||||
{ NM_F, "and r%d, r%d", 0xf00f, 0x2009, 0, 0 },
|
||||
{ NM_F, "cmp/eq r%d, r%d", 0xf00f, 0x3000, 0, 0 },
|
||||
{ NM_F, "cmp/hs r%d, r%d", 0xf00f, 0x3002, 0, 0 },
|
||||
{ NM_F, "cmp/ge r%d, r%d", 0xf00f, 0x3003, 0, 0 },
|
||||
{ NM_F, "cmp/hi r%d, r%d", 0xf00f, 0x3006, 0, 0 },
|
||||
{ NM_F, "cmp/gt r%d, r%d", 0xf00f, 0x3007, 0, 0 },
|
||||
{ NM_F, "cmp/str r%d, r%d", 0xf00f, 0x200c, 0, 0 },
|
||||
{ NM_F, "div1 r%d, r%d", 0xf00f, 0x3004, 0, 0 },
|
||||
{ NM_F, "div0s r%d, r%d", 0xf00f, 0x2007, 0, 0 },
|
||||
{ NM_F, "dmuls.l r%d, r%d", 0xf00f, 0x300d, 0, 1 },
|
||||
{ NM_F, "dmulu.l r%d, r%d", 0xf00f, 0x3005, 0, 1 },
|
||||
{ NM_F, "exts.b r%d, r%d", 0xf00f, 0x600e, 0, 0 },
|
||||
{ NM_F, "exts.w r%d, r%d", 0xf00f, 0x600f, 0, 0 },
|
||||
{ NM_F, "extu.b r%d, r%d", 0xf00f, 0x600c, 0, 0 },
|
||||
{ NM_F, "extu.w r%d, r%d", 0xf00f, 0x600d, 0, 0 },
|
||||
{ NM_F, "mov r%d, r%d", 0xf00f, 0x6003, 0, 0 },
|
||||
{ NM_F, "mul.l r%d, r%d", 0xf00f, 0x0007, 0, 1 },
|
||||
{ NM_F, "muls.w r%d, r%d", 0xf00f, 0x200f, 0, 0 },
|
||||
{ NM_F, "mulu.w r%d, r%d", 0xf00f, 0x200e, 0, 0 },
|
||||
{ NM_F, "neg r%d, r%d", 0xf00f, 0x600b, 0, 0 },
|
||||
{ NM_F, "negc r%d, r%d", 0xf00f, 0x600a, 0, 0 },
|
||||
{ NM_F, "not r%d, r%d", 0xf00f, 0x6007, 0, 0 },
|
||||
{ NM_F, "or r%d, r%d", 0xf00f, 0x200b, 0, 0 },
|
||||
{ NM_F, "sub r%d, r%d", 0xf00f, 0x3008, 0, 0 },
|
||||
{ NM_F, "subc r%d, r%d", 0xf00f, 0x300a, 0, 0 },
|
||||
{ NM_F, "subv r%d, r%d", 0xf00f, 0x300b, 0, 0 },
|
||||
{ NM_F, "swap.b r%d, r%d", 0xf00f, 0x6008, 0, 0 },
|
||||
{ NM_F, "swap.w r%d, r%d", 0xf00f, 0x6009, 0, 0 },
|
||||
{ NM_F, "tst r%d, r%d", 0xf00f, 0x2008, 0, 0 },
|
||||
{ NM_F, "xor r%d, r%d", 0xf00f, 0x200a, 0, 0 },
|
||||
{ NM_F, "xtrct r%d, r%d", 0xf00f, 0x200d, 0, 0 },
|
||||
{ NM_F, "mov.b r%d, @r%d", 0xf00f, 0x2000, 0, 0 },
|
||||
{ NM_F, "mov.w r%d, @r%d", 0xf00f, 0x2001, 0, 0 },
|
||||
{ NM_F, "mov.l r%d, @r%d", 0xf00f, 0x2002, 0, 0 },
|
||||
{ NM_F, "mov.b @r%d, r%d", 0xf00f, 0x6000, 0, 0 },
|
||||
{ NM_F, "mov.w @r%d, r%d", 0xf00f, 0x6001, 0, 0 },
|
||||
{ NM_F, "mov.l @r%d, r%d", 0xf00f, 0x6002, 0, 0 },
|
||||
{ NM_F, "mac.l @r%d+, @r%d+", 0xf00f, 0x000f, 0, 1 },
|
||||
{ NM_F, "mac.w @r%d+, @r%d+", 0xf00f, 0x400f, 0, 0 },
|
||||
{ NM_F, "mov.b @r%d+, r%d", 0xf00f, 0x6004, 0, 0 },
|
||||
{ NM_F, "mov.w @r%d+, r%d", 0xf00f, 0x6005, 0, 0 },
|
||||
{ NM_F, "mov.l @r%d+, r%d", 0xf00f, 0x6006, 0, 0 },
|
||||
{ NM_F, "mov.b r%d, @-r%d", 0xf00f, 0x2004, 0, 0 },
|
||||
{ NM_F, "mov.w r%d, @-r%d", 0xf00f, 0x2005, 0, 0 },
|
||||
{ NM_F, "mov.l r%d, @-r%d", 0xf00f, 0x2006, 0, 0 },
|
||||
{ NM_F, "mov.b r%d, @(r0, r%d)", 0xf00f, 0x0004, 0, 0 },
|
||||
{ NM_F, "mov.w r%d, @(r0, r%d)", 0xf00f, 0x0005, 0, 0 },
|
||||
{ NM_F, "mov.l r%d, @(r0, r%d)", 0xf00f, 0x0006, 0, 0 },
|
||||
{ NM_F, "mov.b @(r0, r%d), r%d", 0xf00f, 0x000c, 0, 0 },
|
||||
{ NM_F, "mov.w @(r0, r%d), r%d", 0xf00f, 0x000d, 0, 0 },
|
||||
{ NM_F, "mov.l @(r0, r%d), r%d", 0xf00f, 0x000e, 0, 0 },
|
||||
{ MD_F, "mov.b @(0x%03X, r%d), r0", 0xff00, 0x8400, 0, 0 },
|
||||
{ MD_F, "mov.w @(0x%03X, r%d), r0", 0xff00, 0x8500, 0, 0 },
|
||||
{ ND4_F, "mov.b r0, @(0x%03X, r%d)", 0xff00, 0x8000, 0, 0 },
|
||||
{ ND4_F, "mov.w r0, @(0x%03X, r%d)", 0xff00, 0x8100, 0, 0 },
|
||||
{ NMD_F, "mov.l r%d, @(0x%03X, r%d)", 0xf000, 0x1000, 0,0 },
|
||||
{ NMD_F, "mov.l @(0x%03X, r%d), r%d", 0xf000, 0x5000, 0,0 },
|
||||
{ D_F, "mov.b r0, @(0x%03X, gbr)", 0xff00, 0xc000, 1, 0 },
|
||||
{ D_F, "mov.w r0, @(0x%03X, gbr)", 0xff00, 0xc100, 2, 0 },
|
||||
{ D_F, "mov.l r0, @(0x%03X, gbr)", 0xff00, 0xc200, 4, 0 },
|
||||
{ D_F, "mov.b @(0x%03X, gbr), r0", 0xff00, 0xc400, 1, 0 },
|
||||
{ D_F, "mov.w @(0x%03X, gbr), r0", 0xff00, 0xc500, 2, 0 },
|
||||
{ D_F, "mov.l @(0x%03X, gbr), r0", 0xff00, 0xc600, 4, 0 },
|
||||
{ D_F, "mova @(0x%03X, pc), r0", 0xff00, 0xc700, 4, 0 },
|
||||
{ D_F, "bf 0x%08X", 0xff00, 0x8b00, 5, 0 },
|
||||
{ D_F, "bf/s 0x%08X", 0xff00, 0x8f00, 5, 1 },
|
||||
{ D_F, "bt 0x%08X", 0xff00, 0x8900, 5, 0 },
|
||||
{ D_F, "bt/s 0x%08X", 0xff00, 0x8d00, 5, 1 },
|
||||
{ D12_F, "bra 0x%08X", 0xf000, 0xa000, 0, 0 },
|
||||
{ D12_F, "bsr 0x%08X", 0xf000, 0xb000, 0, 0 },
|
||||
{ ND8_F, "mov.w @(0x%03X, pc), r%d", 0xf000, 0x9000, 2, 0 },
|
||||
{ ND8_F, "mov.l @(0x%03X, pc), r%d", 0xf000, 0xd000, 4, 0 },
|
||||
{ I_F, "and.b #0x%02X, @(r0, gbr)", 0xff00, 0xcd00, 0,0 },
|
||||
{ I_F, "or.b #0x%02X, @(r0, gbr)", 0xff00, 0xcf00, 0,0 },
|
||||
{ I_F, "tst.b #0x%02X, @(r0, gbr)", 0xff00, 0xcc00, 0,0 },
|
||||
{ I_F, "xor.b #0x%02X, @(r0, gbr)", 0xff00, 0xce00, 0,0 },
|
||||
{ I_F, "and #0x%02X, r0", 0xff00, 0xc900, 0, 0 },
|
||||
{ I_F, "cmp/eq #0x%02X, r0", 0xff00, 0x8800, 0, 0 },
|
||||
{ I_F, "or #0x%02X, r0", 0xff00, 0xcb00, 0, 0 },
|
||||
{ I_F, "tst #0x%02X, r0", 0xff00, 0xc800, 0, 0 },
|
||||
{ I_F, "xor #0x%02X, r0", 0xff00, 0xca00, 0, 0 },
|
||||
{ I_F, "trapa #0x%X", 0xff00, 0xc300, 0, 0 },
|
||||
{ NI_F, "add #0x%02X, r%d", 0xf000, 0x7000, 0, 0 },
|
||||
{ NI_F, "mov #0x%02X, r%d", 0xf000, 0xe000, 0, 0 },
|
||||
{ 0, NULL, 0, 0, 0, 0 }
|
||||
{ ZERO_F, "clrt", 0xffff, 0x8, 0, 0 },
|
||||
{ ZERO_F, "clrmac", 0xffff, 0x28, 0, 0 },
|
||||
{ ZERO_F, "div0u", 0xffff, 0x19, 0, 0 },
|
||||
{ ZERO_F, "nop", 0xffff, 0x9, 0, 0 },
|
||||
{ ZERO_F, "rte", 0xffff, 0x2b, 0, 0 },
|
||||
{ ZERO_F, "rts", 0xffff, 0xb, 0, 0 },
|
||||
{ ZERO_F, "sett", 0xffff, 0x18, 0, 0 },
|
||||
{ ZERO_F, "sleep", 0xffff, 0x1b, 0, 0 },
|
||||
{ N_F, "cmp/pl r%d", 0xf0ff, 0x4015, 0, 0 },
|
||||
{ N_F, "cmp/pz r%d", 0xf0ff, 0x4011, 0, 0 },
|
||||
{ N_F, "dt r%d", 0xf0ff, 0x4010, 0, 1 },
|
||||
{ N_F, "movt r%d", 0xf0ff, 0x0029, 0, 0 },
|
||||
{ N_F, "rotl r%d", 0xf0ff, 0x4004, 0, 0 },
|
||||
{ N_F, "rotr r%d", 0xf0ff, 0x4005, 0, 0 },
|
||||
{ N_F, "rotcl r%d", 0xf0ff, 0x4024, 0, 0 },
|
||||
{ N_F, "rotcr r%d", 0xf0ff, 0x4025, 0, 0 },
|
||||
{ N_F, "shal r%d", 0xf0ff, 0x4020, 0, 0 },
|
||||
{ N_F, "shar r%d", 0xf0ff, 0x4021, 0, 0 },
|
||||
{ N_F, "shll r%d", 0xf0ff, 0x4000, 0, 0 },
|
||||
{ N_F, "shlr r%d", 0xf0ff, 0x4001, 0, 0 },
|
||||
{ N_F, "shll2 r%d", 0xf0ff, 0x4008, 0, 0 },
|
||||
{ N_F, "shlr2 r%d", 0xf0ff, 0x4009, 0, 0 },
|
||||
{ N_F, "shll8 r%d", 0xf0ff, 0x4018, 0, 0 },
|
||||
{ N_F, "shlr8 r%d", 0xf0ff, 0x4019, 0, 0 },
|
||||
{ N_F, "shll16 r%d", 0xf0ff, 0x4028, 0, 0 },
|
||||
{ N_F, "shlr16 r%d", 0xf0ff, 0x4029, 0, 0 },
|
||||
{ N_F, "stc sr, r%d", 0xf0ff, 0x0002, 0, 0 },
|
||||
{ N_F, "stc gbr, r%d", 0xf0ff, 0x0012, 0, 0 },
|
||||
{ N_F, "stc vbr, r%d", 0xf0ff, 0x0022, 0, 0 },
|
||||
{ N_F, "sts mach, r%d", 0xf0ff, 0x000a, 0, 0 },
|
||||
{ N_F, "sts macl, r%d", 0xf0ff, 0x001a, 0, 0 },
|
||||
{ N_F, "sts pr, r%d", 0xf0ff, 0x002a, 0, 0 },
|
||||
{ N_F, "tas.b @r%d", 0xf0ff, 0x401b, 0, 0 },
|
||||
{ N_F, "stc.l sr, @-r%d", 0xf0ff, 0x4003, 0, 0 },
|
||||
{ N_F, "stc.l gbr, @-r%d", 0xf0ff, 0x4013, 0, 0 },
|
||||
{ N_F, "stc.l vbr, @-r%d", 0xf0ff, 0x4023, 0, 0 },
|
||||
{ N_F, "sts.l mach, @-r%d", 0xf0ff, 0x4002, 0, 0 },
|
||||
{ N_F, "sts.l macl, @-r%d", 0xf0ff, 0x4012, 0, 0 },
|
||||
{ N_F, "sts.l pr, @-r%d", 0xf0ff, 0x4022, 0, 0 },
|
||||
{ M_F, "ldc r%d, sr", 0xf0ff, 0x400e, 0, 0 },
|
||||
{ M_F, "ldc r%d, gbr", 0xf0ff, 0x401e, 0, 0 },
|
||||
{ M_F, "ldc r%d, vbr", 0xf0ff, 0x402e, 0, 0 },
|
||||
{ M_F, "lds r%d, mach", 0xf0ff, 0x400a, 0, 0 },
|
||||
{ M_F, "lds r%d, macl", 0xf0ff, 0x401a, 0, 0 },
|
||||
{ M_F, "lds r%d, pr", 0xf0ff, 0x402a, 0, 0 },
|
||||
{ M_F, "jmp @r%d", 0xf0ff, 0x402b, 0, 0 },
|
||||
{ M_F, "jsr @r%d", 0xf0ff, 0x400b, 0, 0 },
|
||||
{ M_F, "ldc.l @r%d+, sr", 0xf0ff, 0x4007, 0, 0 },
|
||||
{ M_F, "ldc.l @r%d+, gbr", 0xf0ff, 0x4017, 0, 0 },
|
||||
{ M_F, "ldc.l @r%d+, vbr", 0xf0ff, 0x4027, 0, 0 },
|
||||
{ M_F, "lds.l @r%d+, mach", 0xf0ff, 0x4006, 0, 0 },
|
||||
{ M_F, "lds.l @r%d+, macl", 0xf0ff, 0x4016, 0, 0 },
|
||||
{ M_F, "lds.l @r%d+, pr", 0xf0ff, 0x4026, 0, 0 },
|
||||
{ M_F, "braf r%d", 0xf0ff, 0x0023, 0, 1 },
|
||||
{ M_F, "bsrf r%d", 0xf0ff, 0x0003, 0, 1 },
|
||||
{ NM_F, "add r%d, r%d", 0xf00f, 0x300c, 0, 0 },
|
||||
{ NM_F, "addc r%d, r%d", 0xf00f, 0x300e, 0, 0 },
|
||||
{ NM_F, "addv r%d, r%d", 0xf00f, 0x300f, 0, 0 },
|
||||
{ NM_F, "and r%d, r%d", 0xf00f, 0x2009, 0, 0 },
|
||||
{ NM_F, "cmp/eq r%d, r%d", 0xf00f, 0x3000, 0, 0 },
|
||||
{ NM_F, "cmp/hs r%d, r%d", 0xf00f, 0x3002, 0, 0 },
|
||||
{ NM_F, "cmp/ge r%d, r%d", 0xf00f, 0x3003, 0, 0 },
|
||||
{ NM_F, "cmp/hi r%d, r%d", 0xf00f, 0x3006, 0, 0 },
|
||||
{ NM_F, "cmp/gt r%d, r%d", 0xf00f, 0x3007, 0, 0 },
|
||||
{ NM_F, "cmp/str r%d, r%d", 0xf00f, 0x200c, 0, 0 },
|
||||
{ NM_F, "div1 r%d, r%d", 0xf00f, 0x3004, 0, 0 },
|
||||
{ NM_F, "div0s r%d, r%d", 0xf00f, 0x2007, 0, 0 },
|
||||
{ NM_F, "dmuls.l r%d, r%d", 0xf00f, 0x300d, 0, 1 },
|
||||
{ NM_F, "dmulu.l r%d, r%d", 0xf00f, 0x3005, 0, 1 },
|
||||
{ NM_F, "exts.b r%d, r%d", 0xf00f, 0x600e, 0, 0 },
|
||||
{ NM_F, "exts.w r%d, r%d", 0xf00f, 0x600f, 0, 0 },
|
||||
{ NM_F, "extu.b r%d, r%d", 0xf00f, 0x600c, 0, 0 },
|
||||
{ NM_F, "extu.w r%d, r%d", 0xf00f, 0x600d, 0, 0 },
|
||||
{ NM_F, "mov r%d, r%d", 0xf00f, 0x6003, 0, 0 },
|
||||
{ NM_F, "mul.l r%d, r%d", 0xf00f, 0x0007, 0, 1 },
|
||||
{ NM_F, "muls.w r%d, r%d", 0xf00f, 0x200f, 0, 0 },
|
||||
{ NM_F, "mulu.w r%d, r%d", 0xf00f, 0x200e, 0, 0 },
|
||||
{ NM_F, "neg r%d, r%d", 0xf00f, 0x600b, 0, 0 },
|
||||
{ NM_F, "negc r%d, r%d", 0xf00f, 0x600a, 0, 0 },
|
||||
{ NM_F, "not r%d, r%d", 0xf00f, 0x6007, 0, 0 },
|
||||
{ NM_F, "or r%d, r%d", 0xf00f, 0x200b, 0, 0 },
|
||||
{ NM_F, "sub r%d, r%d", 0xf00f, 0x3008, 0, 0 },
|
||||
{ NM_F, "subc r%d, r%d", 0xf00f, 0x300a, 0, 0 },
|
||||
{ NM_F, "subv r%d, r%d", 0xf00f, 0x300b, 0, 0 },
|
||||
{ NM_F, "swap.b r%d, r%d", 0xf00f, 0x6008, 0, 0 },
|
||||
{ NM_F, "swap.w r%d, r%d", 0xf00f, 0x6009, 0, 0 },
|
||||
{ NM_F, "tst r%d, r%d", 0xf00f, 0x2008, 0, 0 },
|
||||
{ NM_F, "xor r%d, r%d", 0xf00f, 0x200a, 0, 0 },
|
||||
{ NM_F, "xtrct r%d, r%d", 0xf00f, 0x200d, 0, 0 },
|
||||
{ NM_F, "mov.b r%d, @r%d", 0xf00f, 0x2000, 0, 0 },
|
||||
{ NM_F, "mov.w r%d, @r%d", 0xf00f, 0x2001, 0, 0 },
|
||||
{ NM_F, "mov.l r%d, @r%d", 0xf00f, 0x2002, 0, 0 },
|
||||
{ NM_F, "mov.b @r%d, r%d", 0xf00f, 0x6000, 0, 0 },
|
||||
{ NM_F, "mov.w @r%d, r%d", 0xf00f, 0x6001, 0, 0 },
|
||||
{ NM_F, "mov.l @r%d, r%d", 0xf00f, 0x6002, 0, 0 },
|
||||
{ NM_F, "mac.l @r%d+, @r%d+", 0xf00f, 0x000f, 0, 1 },
|
||||
{ NM_F, "mac.w @r%d+, @r%d+", 0xf00f, 0x400f, 0, 0 },
|
||||
{ NM_F, "mov.b @r%d+, r%d", 0xf00f, 0x6004, 0, 0 },
|
||||
{ NM_F, "mov.w @r%d+, r%d", 0xf00f, 0x6005, 0, 0 },
|
||||
{ NM_F, "mov.l @r%d+, r%d", 0xf00f, 0x6006, 0, 0 },
|
||||
{ NM_F, "mov.b r%d, @-r%d", 0xf00f, 0x2004, 0, 0 },
|
||||
{ NM_F, "mov.w r%d, @-r%d", 0xf00f, 0x2005, 0, 0 },
|
||||
{ NM_F, "mov.l r%d, @-r%d", 0xf00f, 0x2006, 0, 0 },
|
||||
{ NM_F, "mov.b r%d, @(r0, r%d)", 0xf00f, 0x0004, 0, 0 },
|
||||
{ NM_F, "mov.w r%d, @(r0, r%d)", 0xf00f, 0x0005, 0, 0 },
|
||||
{ NM_F, "mov.l r%d, @(r0, r%d)", 0xf00f, 0x0006, 0, 0 },
|
||||
{ NM_F, "mov.b @(r0, r%d), r%d", 0xf00f, 0x000c, 0, 0 },
|
||||
{ NM_F, "mov.w @(r0, r%d), r%d", 0xf00f, 0x000d, 0, 0 },
|
||||
{ NM_F, "mov.l @(r0, r%d), r%d", 0xf00f, 0x000e, 0, 0 },
|
||||
{ MD_F, "mov.b @(0x%03X, r%d), r0", 0xff00, 0x8400, 0, 0 },
|
||||
{ MD_F, "mov.w @(0x%03X, r%d), r0", 0xff00, 0x8500, 0, 0 },
|
||||
{ ND4_F, "mov.b r0, @(0x%03X, r%d)", 0xff00, 0x8000, 0, 0 },
|
||||
{ ND4_F, "mov.w r0, @(0x%03X, r%d)", 0xff00, 0x8100, 0, 0 },
|
||||
{ NMD_F, "mov.l r%d, @(0x%03X, r%d)", 0xf000, 0x1000, 0, 0 },
|
||||
{ NMD_F, "mov.l @(0x%03X, r%d), r%d", 0xf000, 0x5000, 0, 0 },
|
||||
{ D_F, "mov.b r0, @(0x%03X, gbr)", 0xff00, 0xc000, 1, 0 },
|
||||
{ D_F, "mov.w r0, @(0x%03X, gbr)", 0xff00, 0xc100, 2, 0 },
|
||||
{ D_F, "mov.l r0, @(0x%03X, gbr)", 0xff00, 0xc200, 4, 0 },
|
||||
{ D_F, "mov.b @(0x%03X, gbr), r0", 0xff00, 0xc400, 1, 0 },
|
||||
{ D_F, "mov.w @(0x%03X, gbr), r0", 0xff00, 0xc500, 2, 0 },
|
||||
{ D_F, "mov.l @(0x%03X, gbr), r0", 0xff00, 0xc600, 4, 0 },
|
||||
{ D_F, "mova @(0x%03X, pc), r0", 0xff00, 0xc700, 4, 0 },
|
||||
{ D_F, "bf 0x%08X", 0xff00, 0x8b00, 5, 0 },
|
||||
{ D_F, "bf/s 0x%08X", 0xff00, 0x8f00, 5, 1 },
|
||||
{ D_F, "bt 0x%08X", 0xff00, 0x8900, 5, 0 },
|
||||
{ D_F, "bt/s 0x%08X", 0xff00, 0x8d00, 5, 1 },
|
||||
{ D12_F, "bra 0x%08X", 0xf000, 0xa000, 0, 0 },
|
||||
{ D12_F, "bsr 0x%08X", 0xf000, 0xb000, 0, 0 },
|
||||
{ ND8_F, "mov.w @(0x%03X, pc), r%d", 0xf000, 0x9000, 2, 0 },
|
||||
{ ND8_F, "mov.l @(0x%03X, pc), r%d", 0xf000, 0xd000, 4, 0 },
|
||||
{ I_F, "and.b #0x%02X, @(r0, gbr)", 0xff00, 0xcd00, 0, 0 },
|
||||
{ I_F, "or.b #0x%02X, @(r0, gbr)", 0xff00, 0xcf00, 0, 0 },
|
||||
{ I_F, "tst.b #0x%02X, @(r0, gbr)", 0xff00, 0xcc00, 0, 0 },
|
||||
{ I_F, "xor.b #0x%02X, @(r0, gbr)", 0xff00, 0xce00, 0, 0 },
|
||||
{ I_F, "and #0x%02X, r0", 0xff00, 0xc900, 0, 0 },
|
||||
{ I_F, "cmp/eq #0x%02X, r0", 0xff00, 0x8800, 0, 0 },
|
||||
{ I_F, "or #0x%02X, r0", 0xff00, 0xcb00, 0, 0 },
|
||||
{ I_F, "tst #0x%02X, r0", 0xff00, 0xc800, 0, 0 },
|
||||
{ I_F, "xor #0x%02X, r0", 0xff00, 0xca00, 0, 0 },
|
||||
{ I_F, "trapa #0x%X", 0xff00, 0xc300, 0, 0 },
|
||||
{ NI_F, "add #0x%02X, r%d", 0xf000, 0x7000, 0, 0 },
|
||||
{ NI_F, "mov #0x%02X, r%d", 0xf000, 0xe000, 0, 0 },
|
||||
{ 0, NULL, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -31,23 +31,23 @@
|
|||
#include "bios.h"
|
||||
#include "yabause.h"
|
||||
|
||||
// #define SH2_TRACE // Uncomment to enable tracing
|
||||
#define SH2_TRACE // Uncomment to enable tracing
|
||||
|
||||
#ifdef SH2_TRACE
|
||||
# include "sh2trace.h"
|
||||
# define MappedMemoryWriteByte(a,v) do { \
|
||||
uint32_t __a = (a), __v = (v); \
|
||||
sh2_trace_writeb(__a, __v); \
|
||||
u32 __a = (a), __v = (v); \
|
||||
/*sh2_trace_writeb(__a, __v);*/ \
|
||||
MappedMemoryWriteByte(__a, __v); \
|
||||
} while (0)
|
||||
# define MappedMemoryWriteWord(a,v) do { \
|
||||
uint32_t __a = (a), __v = (v); \
|
||||
sh2_trace_writew(__a, __v); \
|
||||
u32 __a = (a), __v = (v); \
|
||||
/*sh2_trace_writew(__a, __v);*/ \
|
||||
MappedMemoryWriteWord(__a, __v); \
|
||||
} while (0)
|
||||
# define MappedMemoryWriteLong(a,v) do { \
|
||||
uint32_t __a = (a), __v = (v); \
|
||||
sh2_trace_writel(__a, __v); \
|
||||
u32 __a = (a), __v = (v); \
|
||||
/*sh2_trace_writel(__a, __v);*/ \
|
||||
MappedMemoryWriteLong(__a, __v); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
|
|
@ -48,6 +48,8 @@ static FILE *logfile; // Trace log file
|
|||
static u64 cycle_accum = 0; // Global cycle accumulator
|
||||
static u64 current_cycles = 0; // Cycle count on last call to sh2_trace()
|
||||
|
||||
char disasmbuf[128];
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
FASTCALL u64 sh2_cycle_count(void)
|
||||
|
@ -162,7 +164,10 @@ static INLINE void HEXIT(char * const ptr, u32 val, int ndigits)
|
|||
#endif
|
||||
|
||||
FASTCALL void sh2_trace(SH2_struct *state, u32 address)
|
||||
{
|
||||
{
|
||||
if (!tracecallback)
|
||||
return;
|
||||
|
||||
current_cycles = cycle_accum + state->cycles;
|
||||
|
||||
if (current_cycles < trace_start) {
|
||||
|
@ -171,7 +176,7 @@ FASTCALL void sh2_trace(SH2_struct *state, u32 address)
|
|||
|
||||
} else if (current_cycles >= trace_stop) {
|
||||
|
||||
/* After last instruction: close log file if it's open */
|
||||
/* After last instruction: close log file if it's open
|
||||
if (logfile) {
|
||||
#ifdef GZIP_LOG
|
||||
pclose(logfile);
|
||||
|
@ -179,7 +184,7 @@ FASTCALL void sh2_trace(SH2_struct *state, u32 address)
|
|||
fclose(logfile);
|
||||
#endif
|
||||
logfile = NULL;
|
||||
}
|
||||
}*/
|
||||
|
||||
} else {
|
||||
u16 opcode;
|
||||
|
@ -194,10 +199,10 @@ FASTCALL void sh2_trace(SH2_struct *state, u32 address)
|
|||
#else
|
||||
char buf[100];
|
||||
/* This looks ugly, but it's faster than fprintf() in this case */
|
||||
static char regbuf[] = " R0: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX\n R8: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX\n PR: XXXXXXXX SR: XXX MAC: XXXXXXXX/XXXXXXXX GBR: XXXXXXXX VBR: XXXXXXXX\n";
|
||||
static char regbuf[] = "r0:XXXXXXXX r1:XXXXXXXX r2:XXXXXXXX r3:XXXXXXXX r4:XXXXXXXX r5:XXXXXXXX r6:XXXXXXXX r7:XXXXXXXX r8:XXXXXXXX r9:XXXXXXXX r10:XXXXXXXX r11:XXXXXXXX r12:XXXXXXXX r13:XXXXXXXX r14:XXXXXXXX r15:XXXXXXXX PR:XXXXXXXX SR:XXX MAC:XXXXXXXX XXXXXXXX GBR:XXXXXXXX VBR:XXXXXXXX";
|
||||
int i;
|
||||
#endif
|
||||
|
||||
/*
|
||||
if (!logfile) {
|
||||
const char *filename = "sh2.log";
|
||||
#ifdef GZIP_LOG
|
||||
|
@ -211,7 +216,7 @@ FASTCALL void sh2_trace(SH2_struct *state, u32 address)
|
|||
return;
|
||||
}
|
||||
setvbuf(logfile, NULL, _IOFBF, 65536);
|
||||
}
|
||||
}*/
|
||||
|
||||
opcode = MappedMemoryReadWord(address);
|
||||
|
||||
|
@ -233,9 +238,8 @@ FASTCALL void sh2_trace(SH2_struct *state, u32 address)
|
|||
SH2GetRegisters(state, &state->regs);
|
||||
|
||||
SH2Disasm(address, opcode, 0, buf);
|
||||
fprintf(logfile, "[%c] %08X: %04X %-44s [%12llu]\n",
|
||||
state==SSH2 ? 'S' : 'M', (int)address, (int)opcode, buf+12,
|
||||
(unsigned long long)current_cycles);
|
||||
sprintf(disasmbuf, "[%c] %08X: %04X %-26s",
|
||||
state==SSH2 ? 'S' : 'M', (int)address, (int)opcode, buf+12);
|
||||
#ifdef ECHO_TO_STDERR
|
||||
fprintf(stderr, "[%c] %08X: %04X %-44s [%12llu]\n",
|
||||
state==SSH2 ? 'S' : 'M', (int)address, (int)opcode, buf+12,
|
||||
|
@ -243,20 +247,22 @@ FASTCALL void sh2_trace(SH2_struct *state, u32 address)
|
|||
#endif
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
HEXIT(i>=8 ? ®buf[12+i*9] : ®buf[6+i*9], state->regs.R[i], 8);
|
||||
HEXIT(®buf[i>9 ? i*13-6 : i*12+3], state->regs.R[i], 8);
|
||||
}
|
||||
HEXIT(®buf[162], state->regs.PR, 8);
|
||||
HEXIT(®buf[176], state->regs.SR.all, 3);
|
||||
HEXIT(®buf[186], state->regs.MACH, 8);
|
||||
HEXIT(®buf[195], state->regs.MACL, 8);
|
||||
HEXIT(®buf[210], state->regs.GBR, 8);
|
||||
HEXIT(®buf[225], state->regs.VBR, 8);
|
||||
fwrite(regbuf, sizeof(regbuf)-1, 1, logfile);
|
||||
HEXIT(®buf[201], state->regs.PR, 8);
|
||||
HEXIT(®buf[213], state->regs.SR.all, 3);
|
||||
HEXIT(®buf[221], state->regs.MACH, 8);
|
||||
HEXIT(®buf[230], state->regs.MACL, 8);
|
||||
HEXIT(®buf[243], state->regs.GBR, 8);
|
||||
HEXIT(®buf[256], state->regs.VBR, 8);
|
||||
//fwrite(regbuf, sizeof(regbuf)-1, 1, logfile);
|
||||
#ifdef ECHO_TO_STDERR
|
||||
fwrite(regbuf, sizeof(regbuf)-1, 1, stderr);
|
||||
#endif
|
||||
|
||||
#endif // BINARY_LOG
|
||||
|
||||
tracecallback(disasmbuf, regbuf);
|
||||
|
||||
} // current_cycles >= trace_start && current_cycles < trace_stop
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define SH2TRACE_H
|
||||
|
||||
#include "core.h"
|
||||
#include "yui.h"
|
||||
|
||||
extern FASTCALL u64 sh2_cycle_count(void);
|
||||
extern FASTCALL void sh2_trace_add_cycles(s32 cycles);
|
||||
|
|
|
@ -56,6 +56,8 @@ void YuiSwapBuffers(void);
|
|||
|
||||
extern void (*inputcallback)(void);
|
||||
|
||||
extern void (*tracecallback)(const char* dis, const char* regs);
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue