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

Function CheckBreakOpcode

source/Debugger/Debug.cpp:8967–9010  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8965//===========================================================================
8966
8967static void CheckBreakOpcode ( int iOpcode )
8968{
8969 if (iOpcode == 0x00) // BRK
8970 g_bDebugBreakpointHit |= IsDebugBreakOnInvalid(AM_IMPLIED) ? BP_HIT_INVALID : 0;
8971
8972 if (g_aOpcodes[iOpcode].sMnemonic[0] >= 'a') // All 6502/65C02 undocumented opcodes mnemonics are lowercase strings!
8973 {
8974 // Translate g_aOpcodes[iOpcode].nAddressMode into {AM_1, AM_2, AM_3}
8975 int iOpcodeType = AM_1;
8976 switch (g_aOpcodes[iOpcode].nAddressMode)
8977 {
8978 case AM_1: // Invalid 1 Byte
8979 case AM_IMPLIED:
8980 iOpcodeType = AM_1;
8981 break;
8982 case AM_2: // Invalid 2 Bytes
8983 case AM_M: // 4 #Immediate
8984 case AM_Z: // 6 Zeropage
8985 case AM_ZX: // 9 Zeropage, X
8986 case AM_ZY: // 10 Zeropage, Y
8987 case AM_R: // 11 Relative
8988 case AM_IZX: // 12 Indexed (Zeropage Indirect, X)
8989 case AM_NZY: // 14 Indirect (Zeropage) Indexed, Y
8990 case AM_NZ: // 15 Indirect (Zeropage)
8991 iOpcodeType = AM_2;
8992 break;
8993 case AM_3: // Invalid 3 Bytes
8994 case AM_A: // 5 $Absolute
8995 case AM_AX: // 7 Absolute, X
8996 case AM_AY: // 8 Absolute, Y
8997 case AM_IAX: // 13 Indexed (Absolute Indirect, X)
8998 case AM_NA: // 16 Indirect (Absolute) i.e. JMP
8999 iOpcodeType = AM_3;
9000 break;
9001 default:
9002 _ASSERT(0);
9003 }
9004 g_bDebugBreakpointHit |= IsDebugBreakOnInvalid(iOpcodeType) ? BP_HIT_INVALID : 0;
9005 }
9006
9007 // User wants to enter debugger on specific opcode? (NB. Can't be BRK)
9008 if (g_iDebugBreakOnOpcode && g_iDebugBreakOnOpcode == iOpcode)
9009 g_bDebugBreakpointHit |= BP_HIT_OPCODE;
9010}
9011
9012static void UpdateLBR (void)
9013{

Callers 1

DebugContinueSteppingFunction · 0.85

Calls 1

IsDebugBreakOnInvalidFunction · 0.85

Tested by

no test coverage detected