add USE_EMU as build option; slight refactor build

This commit is contained in:
Christopher A. Mosher 2022-11-03 01:07:39 -04:00
parent 7059628f52
commit 617bad3e51
5 changed files with 33 additions and 19 deletions

View File

@ -1,6 +1,10 @@
cmake_minimum_required(VERSION 3.22.1)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(CMAKE_FIND_DEBUG_MODE TRUE)
project(epple2)
include(GNUInstallDirs)
add_subdirectory(src)
add_subdirectory(conf)

View File

@ -1,10 +1,3 @@
set(CMAKE_FIND_DEBUG_MODE 1)
find_package(SDL2 CONFIG)
include_directories(${SDL2_INCLUDE_DIRS})
message("SDL2_INCLUDE_DIRS: ${SDL2_INCLUDE_DIRS}")
message("SDL2_LIBRARIES: ${SDL2_LIBRARIES}")
set(sources
a2colorsobserved.cpp
addressbus.cpp
@ -76,6 +69,20 @@ wozfile.cpp
)
add_executable(epple2 ${sources})
target_compile_features(epple2 PUBLIC cxx_std_17)
target_compile_definitions(epple2 PUBLIC ETCDIR="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}")
find_package(SDL2 CONFIG)
message(STATUS "SDL2_INCLUDE_DIRS: ${SDL2_INCLUDE_DIRS}")
message(STATUS "SDL2_LIBRARIES: ${SDL2_LIBRARIES}")
target_include_directories(epple2 PRIVATE ${SDL2_INCLUDE_DIRS})
target_link_libraries(epple2 ${SDL2_LIBRARIES})
target_compile_features(epple2 PRIVATE cxx_std_17)
target_compile_definitions(epple2 PRIVATE ETCDIR="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}")
option(USE_EMU "Use http://www.visual6502.org/ CPU (will run slowly)")
if (USE_EMU)
message(STATUS "USE_EMU")
target_compile_definitions(epple2 PRIVATE USE_EMU)
# target_compile_definitions(epple2 PRIVATE TRACESEG)
target_compile_definitions(epple2 PRIVATE TRACEREG)
endif()

View File

@ -52,7 +52,7 @@ Apple2::Apple2(KeypressQueue& keypresses, PaddleButtonStates& paddleButtonStates
transistors("transistors"),
cpu(transistors,addressBus),
#else
cpu(addressBus),
cpu(addressBus),
#endif
powerUpReset(*this),
revision(1)

View File

@ -41,9 +41,6 @@
class Emulator;
class ScreenImage;
//#define USE_EMU 1
#undef USE_EMU
class Apple2 : public Timable
{
Slots slts;
@ -52,10 +49,10 @@ class Apple2 : public Timable
Paddles paddles;
SpeakerClicker speaker;
Memory rom;
MemoryRandomAccess ram;
CassetteIn cassetteIn;
CassetteOut cassetteOut;
AddressBus addressBus;
MemoryRandomAccess ram;
CassetteIn cassetteIn;
CassetteOut cassetteOut;
AddressBus addressBus;
PictureGenerator picgen;
TextCharacters textRows;
Video video;
@ -63,7 +60,7 @@ class Apple2 : public Timable
std::ifstream transistors;
Emu6502 cpu;
#else
CPU cpu;
CPU cpu;
#endif
PowerUpReset powerUpReset;
int revision;

View File

@ -95,6 +95,12 @@ static void trim(std::string& str)
void Config::parse(MemoryRandomAccess& ram, Memory& rom, Slots& slts, int& revision, ScreenImage& gui, CassetteIn& cassetteIn, CassetteOut& cassetteOut)
{
#ifdef USE_EMU
std::cout << "Running with http://www.visual6502.org/ CPU emulation (which will be slow)." << std::endl;
#endif
std::ifstream* pConfig;
std::string path(this->file_path);