summaryrefslogtreecommitdiff
path: root/emulator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'emulator.cpp')
-rw-r--r--emulator.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/emulator.cpp b/emulator.cpp
index 7ce5f60..c6557a2 100644
--- a/emulator.cpp
+++ b/emulator.cpp
@@ -41,6 +41,8 @@ unsigned char g_psg[PSG_SIZE] = {};
VDP g_vdp(VDP_START);
std::vector<Breakpoint> code_bkpts{}, read_bkpts{}, write_bkpts{}, access_bkpts{};
+uint64_t g_cycles_counter = 0;
+
template<typename T, size_t S>
struct Backtrace {
static_assert(S > 0, "Backtrace size cannot be zero");
@@ -290,7 +292,7 @@ static std::string CreateResponse(
return "OK";
}
case PacketType::kStep:
- m68k_execute(1);
+ g_cycles_counter += m68k_execute(1);
return "S05"; // TODO real reason
case PacketType::kSetBreakpoint:
{
@@ -484,9 +486,10 @@ int emulator(M68KDebuggingControl& m68k_debug, Graphics& graphics)
}
if (m68k_debug.IsRunning()) {
do {
- m68k_execute(10000);
+ g_cycles_counter += m68k_execute(1000);
} while(!g_vdp.Scanline());
graphics.Render(g_vdp);
+ g_cycles_counter += m68k_execute(8000);
}
if (m68k_debug.HasBreakpoint()) {
m68k_debug.SetRunning(false);
@@ -535,7 +538,7 @@ int main(int argc, char* argv[])
m68k_init();
m68k_set_cpu_type(M68K_CPU_TYPE_68000);
m68k_pulse_reset();
- m68k_execute(1); // Skip reset cycles
+ g_cycles_counter += m68k_execute(1); // Skip reset cycles
emulator(g_m68k_debug, graphics);