diff --git a/CMakeLists.txt b/CMakeLists.txt index 34c7dc0..955d246 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,10 @@ project(${CMAKE_PROJECT_NAME}) message("Build type: " ${CMAKE_BUILD_TYPE}) # Enable CMake support for ASM and C languages -enable_language(C ASM) +enable_language(C CXX ASM) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) # Create an executable object type add_executable(${CMAKE_PROJECT_NAME}) @@ -45,7 +48,7 @@ target_link_directories(${CMAKE_PROJECT_NAME} PRIVATE # Add sources to executable target_sources(${CMAKE_PROJECT_NAME} PRIVATE # Add user sources here - "Lib/YMF262-HAL/Src/YMF262-HAL.c" + "Lib/YMF262-HAL/Src/YMF262-HAL.cpp" ) # Add include paths diff --git a/Lib/YMF262-HAL/Inc/YMF262-HAL.h b/Lib/YMF262-HAL/Inc/YMF262-HAL.hpp similarity index 62% rename from Lib/YMF262-HAL/Inc/YMF262-HAL.h rename to Lib/YMF262-HAL/Inc/YMF262-HAL.hpp index c947fd4..4b67e1a 100644 --- a/Lib/YMF262-HAL/Inc/YMF262-HAL.h +++ b/Lib/YMF262-HAL/Inc/YMF262-HAL.hpp @@ -1,5 +1,6 @@ #ifndef YMF262_HAL #define YMF262_HAL +class YMF262_HAL; #endif \ No newline at end of file diff --git a/Lib/YMF262-HAL/Src/YMF262-HAL.c b/Lib/YMF262-HAL/Src/YMF262-HAL.c deleted file mode 100644 index 3f2f99c..0000000 --- a/Lib/YMF262-HAL/Src/YMF262-HAL.c +++ /dev/null @@ -1 +0,0 @@ -#include "YMF262-HAL.h" diff --git a/Lib/YMF262-HAL/Src/YMF262-HAL.cpp b/Lib/YMF262-HAL/Src/YMF262-HAL.cpp new file mode 100644 index 0000000..decef5a --- /dev/null +++ b/Lib/YMF262-HAL/Src/YMF262-HAL.cpp @@ -0,0 +1,33 @@ +#include "YMF262-HAL.hpp" +#include + +class YMF262_HAL{ + private: + uint_32_t _t_icw_ticks; + uint_32_t _t_as_ticks; + uint_32_t _t_ah_ticks; + uint_32_t _t_csw_ticks; + uint_32_t _t_csr_ticks; + uint_32_t _t_ww_ticks; + uint_32_t _t_wds_ticks; + uint_32_t _t_wdh_ticks; + uint_32_t _t_rw_ticks; + uint_32_t _t_acc_ticks; + uint_32_t _t_rdh__ticks; + uint_32_t _t_recovery_ticks; + + YMF262_HAL(uint_32_t opl_clock, uint_32_t cpu_clock){ + _t_icw_ticks = (400 * cpu_clock) / opl_clock; + _t_recovery_ticks = (32 * cpu_clock) / opl_clock; + double ticks_per_ns = (double)cpu_clock / 1.0e9; + _t_as_ticks = (uint32_t)(10 * ticks_per_ns); + _t_ah_ticks = (uint32_t)(10 * ticks_per_ns); + _t_csw_ticks = (uint32_t)(100 * ticks_per_ns); + _t_ww_ticks = (uint32_t)(100 * ticks_per_ns); + _t_wds_ticks = (uint32_t)(10 * ticks_per_ns); + _t_wdh_ticks = (uint32_t)(20 * ticks_per_ns); + _t_csr_ticks = (uint32_t)(150 * ticks_per_ns); + _t_rw_ticks = (uint32_t)(150 * ticks_per_ns); + _t_acc_ticks = (uint32_t)(150 * ticks_per_ns); + _t_rdh__ticks = (uint32_t)(10 * ticks_per_ns); +} \ No newline at end of file