SubNESHawk: Add ppu cycle to tracer

This commit is contained in:
alyosha-tas 2019-01-19 09:23:22 -06:00
parent ad6790cfb7
commit 8e99908c47
3 changed files with 12 additions and 3 deletions

View File

@ -74,7 +74,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
"{0:X4}: {1,-9} {2} ",
PC, rawbytes, disasm).PadRight(32),
RegisterInfo = string.Format(
"A:{0:X2} X:{1:X2} Y:{2:X2} SP:{4:X2} P:{3:X2} {6}{7}{8}{9}{10}{11}{12}{13} Cy:{5}",
"A:{0:X2} X:{1:X2} Y:{2:X2} SP:{4:X2} P:{3:X2} {6}{7}{8}{9}{10}{11}{12}{13} Cy:{5} PPU-Cy:{15}",
A, X, Y, P, S, TotalExecutedCycles,
FlagN ? "N" : "n",
FlagV ? "V" : "v",
@ -84,7 +84,8 @@ namespace BizHawk.Emulation.Cores.Components.M6502
FlagI ? "I" : "i",
FlagZ ? "Z" : "z",
FlagC ? "C" : "c",
!RDY ? "R" : "r")
!RDY ? "R" : "r",
ext_ppu_cycle)
};
}
@ -120,6 +121,9 @@ namespace BizHawk.Emulation.Cores.Components.M6502
public bool NMI;
public bool RDY;
// ppu cycle (used with SubNESHawk)
public int ext_ppu_cycle = 0;
public void SyncState(Serializer ser)
{
ser.BeginSection("MOS6502X");
@ -143,6 +147,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
ser.Sync("interrupt_pending", ref interrupt_pending);
ser.Sync("branch_irq_hack", ref branch_irq_hack);
ser.Sync("rdy_freeze", ref rdy_freeze);
ser.Sync("ext_ppu_cycle", ref ext_ppu_cycle);
ser.EndSection();
}

View File

@ -52,6 +52,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
{
subnes.videoProvider.FillFrameBuffer();
current_cycle = 0;
subnes.cpu.ext_ppu_cycle = current_cycle;
}
_islag = subnes.alt_lag;
@ -86,6 +87,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
}
subnes.do_single_step(controller, out pass_new_input, out pass_a_frame);
current_cycle++;
subnes.cpu.ext_ppu_cycle = current_cycle;
stop_cur_frame |= pass_a_frame;
stop_cur_frame |= pass_new_input;
}

View File

@ -36,7 +36,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
ser.Register<IVideoProvider>(subnes.videoProvider);
ser.Register<ISoundProvider>(subnes.magicSoundProvider);
_tracer = new TraceBuffer { Header = subnes.cpu.TraceHeader };
_tracer = new TraceBuffer { Header = "6502: PC, machine code, mnemonic, operands, registers (A, X, Y, P, SP), flags (NVTBDIZCR), CPU Cycle, PPU Cycle" };
ser.Register<ITraceable>(_tracer);
ServiceProvider = ser;
@ -46,6 +46,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
subnes.using_reset_timing = true;
HardReset();
current_cycle = 0;
subnes.cpu.ext_ppu_cycle = current_cycle;
VBL_CNT = 0;
}
@ -61,6 +62,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
subnes.apu.NESSoftReset();
subnes.ppu.NESSoftReset();
current_cycle = 0;
subnes.cpu.ext_ppu_cycle = current_cycle;
}
public DisplayType Region => DisplayType.NTSC;