summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--bus.cpp (renamed from bus.c)27
-rw-r--r--bus.hpp (renamed from bus.h)0
-rw-r--r--emulator.cpp (renamed from emulator.c)14
-rw-r--r--m68kconf.h8
5 files changed, 30 insertions, 23 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c94615b..d6456c7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,8 +16,8 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fno-omit
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer")
set(emulator_sources
- bus.c
- emulator.c
+ bus.cpp
+ emulator.cpp
)
set(musashi_m68k_sources
musashi-m68k/m68kcpu.c
diff --git a/bus.c b/bus.cpp
index 64a8ac9..caff07c 100644
--- a/bus.c
+++ b/bus.cpp
@@ -1,23 +1,22 @@
/* SPDX-License-Identifier: Unlicense
*/
-#include "bus.h"
-
-#include <assert.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-
+#include "bus.hpp"
#include "musashi-m68k/m68k.h"
-unsigned char g_rom[ROM_SIZE] = {0};
-unsigned char g_ram[RAM_SIZE] = {0};
-unsigned char g_io1[IO1_SIZE] = {0};
-unsigned char g_io2[IO2_SIZE] = {0};
+#include <cassert>
+#include <cstdarg>
+#include <cstdbool>
+#include <cstdio>
+#include <cstdint>
+#include <cstdlib>
+
+unsigned char g_rom[ROM_SIZE] = {};
+unsigned char g_ram[RAM_SIZE] = {};
+unsigned char g_io1[IO1_SIZE] = {};
+unsigned char g_io2[IO2_SIZE] = {};
-static void exit_error(char* fmt, ...)
+static void exit_error(const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
diff --git a/bus.h b/bus.hpp
index baa65be..baa65be 100644
--- a/bus.h
+++ b/bus.hpp
diff --git a/emulator.c b/emulator.cpp
index 21b9c94..0e3fb29 100644
--- a/emulator.c
+++ b/emulator.cpp
@@ -1,19 +1,19 @@
/* SPDX-License-Identifier: Unlicense
*/
-#include "bus.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <time.h>
+#include "bus.hpp"
#include "musashi-m68k/m68k.h"
+#include <cstdio>
+#include <cstdlib>
+#include <cstdarg>
+#include <ctime>
+
#if !defined(DEBUG_TRACE_INSTRUCTIONS)
# define DEBUG_TRACE_INSTRUCTIONS 0
#endif
-static void exit_error(char* fmt, ...)
+static void exit_error(const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
diff --git a/m68kconf.h b/m68kconf.h
index 09e3e95..0b67f76 100644
--- a/m68kconf.h
+++ b/m68kconf.h
@@ -30,6 +30,10 @@
#ifndef M68KCONF__HEADER
#define M68KCONF__HEADER
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Configuration switches.
* Use OPT_SPECIFY_HANDLER for configuration options that allow callbacks.
* OPT_SPECIFY_HANDLER causes the core to link directly to the function
@@ -209,6 +213,10 @@ void m68k_instr_callback(int pc);
#endif /* M68K_COMPILE_FOR_MAME */
+#ifdef __cplusplus
+}
+#endif
+
/* ======================================================================== */
/* ============================== END OF FILE ============================= */
/* ======================================================================== */