diff --git a/CasioEmuMsvc/CasioEmuMsvc.vcxproj b/CasioEmuMsvc/CasioEmuMsvc.vcxproj index 6e79169..ec8d238 100644 --- a/CasioEmuMsvc/CasioEmuMsvc.vcxproj +++ b/CasioEmuMsvc/CasioEmuMsvc.vcxproj @@ -367,6 +367,7 @@ + diff --git a/CasioEmuMsvc/CasioEmuMsvc.vcxproj.filters b/CasioEmuMsvc/CasioEmuMsvc.vcxproj.filters index c35c43f..706268a 100644 --- a/CasioEmuMsvc/CasioEmuMsvc.vcxproj.filters +++ b/CasioEmuMsvc/CasioEmuMsvc.vcxproj.filters @@ -377,6 +377,9 @@ 头文件 + + 头文件 + diff --git a/CasioEmuMsvc/Chipset/CPU.hpp b/CasioEmuMsvc/Chipset/CPU.hpp index fb897d2..e5cb596 100644 --- a/CasioEmuMsvc/Chipset/CPU.hpp +++ b/CasioEmuMsvc/Chipset/CPU.hpp @@ -131,7 +131,7 @@ namespace casioemu { bool GetMasterInterruptEnable(); std::string GetBacktrace() const; - private: + #ifdef DBG struct StackFrame { bool lr_pushed; @@ -141,7 +141,7 @@ namespace casioemu { }; ConcurrentObject> stack; #endif - + private: uint16_t Fetch(); enum OpcodeHint { diff --git a/CasioEmuMsvc/Chipset/CPUControl.cpp b/CasioEmuMsvc/Chipset/CPUControl.cpp index 016db68..662fc71 100644 --- a/CasioEmuMsvc/Chipset/CPUControl.cpp +++ b/CasioEmuMsvc/Chipset/CPUControl.cpp @@ -218,7 +218,9 @@ namespace casioemu { sf.new_pc = reg_csr << 16 | reg_pc; if (!stack->empty() && !stack->back().lr_pushed) { std::cout << "[CPU][Warn] Control flow get override!(likely stack corruption or a bootloader)\n"; - stack->clear(); + stack->back().lr_push_address = 0x0721; + stack->back().lr_pushed = true; + // stack->clear(); } stack->push_back(sf); if (on_call_function) diff --git a/CasioEmuMsvc/Ext/LabelFile.h b/CasioEmuMsvc/Ext/LabelFile.h new file mode 100644 index 0000000..fc09526 --- /dev/null +++ b/CasioEmuMsvc/Ext/LabelFile.h @@ -0,0 +1,100 @@ +#pragma once +#include +#include +#include +#include +#include +#include +struct Label { + uint32_t address; + std::string name; +}; +// Function to parse the file +inline std::vector