summaryrefslogtreecommitdiff
path: root/emulator.cpp
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2022-10-19 02:28:03 +0300
committerOxore <oxore@protonmail.com>2022-10-19 02:28:03 +0300
commiteddd0a826b1720c26b0ac5df0269db3982bc8f35 (patch)
tree94548f986eb190c734315db252e57a79c118031f /emulator.cpp
parentae9a7aef2f0422f6872e6ae27e4e4e2084d8ce8f (diff)
Begin implementing VDP rendering
Diffstat (limited to 'emulator.cpp')
-rw-r--r--emulator.cpp17
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;
}