Add all 65816 instruction tests

Separate CPU class into instructions and addressing files
This commit is contained in:
scawful
2023-12-03 05:13:25 -05:00
parent b4820d1d32
commit a0019ab7fb
14 changed files with 4538 additions and 1277 deletions

View File

@@ -6,6 +6,7 @@ add_executable(
app/rom.cc
app/core/common.cc
app/gui/pipeline.cc
${YAZE_APP_EMU_SRC}
${YAZE_APP_GFX_SRC}
${YAZE_APP_ZELDA3_SRC}
${YAZE_GUI_SRC}
@@ -16,11 +17,11 @@ target_include_directories(
z3ed PUBLIC
lib/
app/
lib/SDL_mixer/include/
${CMAKE_SOURCE_DIR}/src/
${PNG_INCLUDE_DIRS}
${SDL2_INCLUDE_DIR}
${GLEW_INCLUDE_DIRS}
lib/SDL_mixer/include/
)
target_link_libraries(

View File

@@ -14,12 +14,13 @@
#include "absl/strings/str_cat.h"
#include "app/core/common.h" // for PcToSnes, SnesToPc
#include "app/core/constants.h" // for RETURN_IF_ERROR
#include "app/gui/pipeline.h"
#include "app/emu/snes.h"
#include "app/gfx/bitmap.h"
#include "app/gfx/compression.h"
#include "app/gfx/snes_palette.h"
#include "app/gfx/snes_tile.h"
#include "app/gui/canvas.h"
#include "app/gui/pipeline.h"
#include "app/rom.h" // for ROM
#include "app/zelda3/overworld.h"
#include "cli/patch.h" // for ApplyBpsPatch, CreateBpsPatch
@@ -273,8 +274,32 @@ class Expand : public CommandHandler {
}
};
// Start Emulator on a SNES rom file
// -emu <rom_file> <optional:num_cpu_cycles>
class Emulator : public CommandHandler {
public:
absl::Status handle(const std::vector<std::string>& arg_vec) override {
std::string filename = arg_vec[0];
RETURN_IF_ERROR(rom_.LoadFromFile(filename))
snes.SetupMemory(rom_);
snes.Init(rom_);
int i = 0;
while (i < 80000) {
snes.Run();
i++;
}
return absl::OkStatus();
}
app::emu::SNES snes;
};
struct Commands {
std::unordered_map<std::string, std::shared_ptr<CommandHandler>> handlers = {
{"-emu", std::make_shared<Emulator>()},
{"-a", std::make_shared<ApplyPatch>()},
{"-c", std::make_shared<CreatePatch>()},
{"-o", std::make_shared<Open>()},