diff options
author | Oxore <oxore@protonmail.com> | 2022-08-27 11:53:25 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2022-08-27 11:53:25 +0300 |
commit | 903b8dbcaad887f6e14cc8cffc22ddda08dc9f85 (patch) | |
tree | 01254a3d08791a71dea3e7f987b859ae58921d35 | |
parent | c1b9fead37e32be1b2f97d5be2d8254fdc16d307 (diff) |
Move to C++ completely
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-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.h | 8 |
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 @@ -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/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); @@ -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 ============================= */ /* ======================================================================== */ |