MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / UpdateLBR

Function UpdateLBR

source/Debugger/Debug.cpp:9012–9045  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9010}
9011
9012static void UpdateLBR (void)
9013{
9014 const BYTE nOpcode = ReadByteFromMemory(regs.pc);
9015
9016 bool isControlFlowOpcode =
9017 nOpcode == OPCODE_BRK ||
9018 nOpcode == OPCODE_JSR ||
9019 nOpcode == OPCODE_JMP_A ||
9020 nOpcode == OPCODE_RTI ||
9021 nOpcode == OPCODE_RTS ||
9022 nOpcode == OPCODE_JMP_NA;
9023
9024 if (GetMainCpu() == CPU_65C02 && nOpcode == OPCODE_JMP_IAX)
9025 isControlFlowOpcode = true;
9026
9027 if (g_aOpcodes[nOpcode].nAddressMode == AM_R)
9028 {
9029 if ((nOpcode == OPCODE_BRA)
9030 || (nOpcode == OPCODE_BPL && !(regs.ps & AF_SIGN) )
9031 || (nOpcode == OPCODE_BMI && (regs.ps & AF_SIGN) )
9032 || (nOpcode == OPCODE_BVC && !(regs.ps & AF_OVERFLOW))
9033 || (nOpcode == OPCODE_BVS && (regs.ps & AF_OVERFLOW))
9034 || (nOpcode == OPCODE_BCC && !(regs.ps & AF_CARRY) )
9035 || (nOpcode == OPCODE_BCS && (regs.ps & AF_CARRY) )
9036 || (nOpcode == OPCODE_BNE && !(regs.ps & AF_ZERO) )
9037 || (nOpcode == OPCODE_BEQ && (regs.ps & AF_ZERO) ))
9038 {
9039 isControlFlowOpcode = true; // Branch taken
9040 }
9041 }
9042
9043 if (isControlFlowOpcode)
9044 g_LBR = regs.pc;
9045}
9046
9047static std::string GetBreakpointHitIdString(int id)
9048{

Callers 1

DebugContinueSteppingFunction · 0.85

Calls 2

ReadByteFromMemoryFunction · 0.85
GetMainCpuFunction · 0.50

Tested by

no test coverage detected