1#ifndef YAZE_APP_EMU_DEBUG_STEP_CONTROLLER_H_
2#define YAZE_APP_EMU_DEBUG_STEP_CONTROLLER_H_
49 std::optional<CallStackEntry>
call;
50 std::optional<CallStackEntry>
ret;
166constexpr uint8_t
JSR = 0x20;
167constexpr uint8_t
JSL = 0x22;
171constexpr uint8_t
RTS = 0x60;
172constexpr uint8_t
RTL = 0x6B;
173constexpr uint8_t
RTI = 0x40;
176constexpr uint8_t
BCC = 0x90;
177constexpr uint8_t
BCS = 0xB0;
178constexpr uint8_t
BEQ = 0xF0;
179constexpr uint8_t
BMI = 0x30;
180constexpr uint8_t
BNE = 0xD0;
181constexpr uint8_t
BPL = 0x10;
182constexpr uint8_t
BVC = 0x50;
183constexpr uint8_t
BVS = 0x70;
184constexpr uint8_t
BRA = 0x80;
185constexpr uint8_t
BRL = 0x82;
Controller for intelligent step operations.
void ProcessInstruction(uint32_t pc)
StepResult StepInto()
Step a single instruction and update call stack.
uint32_t CalculateCallTarget(uint32_t pc, uint8_t opcode) const
uint32_t CalculateReturnAddress(uint32_t pc, uint8_t opcode) const
std::function< uint8_t(uint32_t)> MemoryReader
void SetMemoryReader(MemoryReader reader)
void SetPcGetter(PcGetter getter)
StepResult StepOver(uint32_t max_instructions=1000000)
Step over the current instruction.
std::function< void()> SingleStepper
static bool IsReturnInstruction(uint8_t opcode)
Check if an opcode is a return instruction (RTS/RTL/RTI)
static bool IsCallInstruction(uint8_t opcode)
Check if an opcode is a call instruction (JSR/JSL)
static bool IsBranchInstruction(uint8_t opcode)
Check if an opcode is a branch instruction.
void ClearCallStack()
Clear the call stack (e.g., on reset)
std::function< uint32_t()> PcGetter
size_t GetCallDepth() const
Get the current call depth.
static uint8_t GetInstructionSize(uint8_t opcode, bool m_flag, bool x_flag)
Get instruction size for step over calculations.
std::vector< CallStackEntry > call_stack_
const std::vector< CallStackEntry > & GetCallStack() const
Get the current call stack.
void SetSingleStepper(SingleStepper stepper)
StepResult StepOut(uint32_t max_instructions=1000000)
Step out of the current subroutine.
constexpr uint8_t JMP_IND
constexpr uint8_t JMP_LONG
constexpr uint8_t JMP_IND_L
constexpr uint8_t JMP_ABS
constexpr uint8_t JMP_ABS_X
Tracks call stack for intelligent stepping.
CallStackEntry(uint32_t call, uint32_t target, uint32_t ret, bool long_call)
Result of a step operation.
std::optional< CallStackEntry > call
uint32_t instructions_executed
std::optional< CallStackEntry > ret