diff options
Diffstat (limited to 'emulator.cpp')
-rw-r--r-- | emulator.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/emulator.cpp b/emulator.cpp index 3ec756d..70927bd 100644 --- a/emulator.cpp +++ b/emulator.cpp @@ -2,6 +2,7 @@ */ #include "bus.hpp" +#include "graphics.hpp" #include "vdp.hpp" #include "m68k_debugging.hpp" #include "gdbremote_parser.hpp" @@ -433,7 +434,7 @@ void ParseAndReact( } } -int emulator(M68KDebuggingControl& m68k_debug) +int emulator(M68KDebuggingControl& m68k_debug, Graphics& graphics) { const int port = 3333; const int socket_fd = setup_socket(port); @@ -483,8 +484,9 @@ int emulator(M68KDebuggingControl& m68k_debug) } if (m68k_debug.IsRunning()) { do { - m68k_execute(100000); + m68k_execute(1000000); } while(!g_vdp.Scanline()); + graphics.Render(g_vdp); } if (m68k_debug.HasBreakpoint()) { m68k_debug.SetRunning(false); @@ -501,7 +503,7 @@ int emulator(M68KDebuggingControl& m68k_debug) clock_nanosleep(CLOCK_MONOTONIC, 0, &kOneMillisecond, nullptr); } close(conn_fd); - g_no_ack_mode = false; + g_no_ack_mode = false; // TODO move to GDB::ExchangeContext } close(socket_fd); return 0; @@ -525,12 +527,17 @@ int main(int argc, char* argv[]) exit_error("Error reading %s", argv[1]); printf("Read into ROM %zu bytes\n", fread_ret); + Graphics graphics{}; + if (!graphics.IsOk()) { + return EXIT_FAILURE; + } + m68k_init(); m68k_set_cpu_type(M68K_CPU_TYPE_68000); m68k_pulse_reset(); m68k_execute(1); // Skip reset cycles - emulator(g_m68k_debug); + emulator(g_m68k_debug, graphics); - return 0; + return EXIT_SUCCESS; } |