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

Function CheckBreakpointsIO

source/Debugger/Debug.cpp:1408–1479  ·  view source on GitHub ↗

===========================================================================

Source from the content-addressed store, hash-verified

1406
1407//===========================================================================
1408int CheckBreakpointsIO ()
1409{
1410 int iBreakpointHit = 0;
1411
1412 const int NUM_TARGETS = 3;
1413 int aTarget[ NUM_TARGETS ] =
1414 {
1415 NO_6502_TARGET,
1416 NO_6502_TARGET,
1417 NO_6502_TARGET
1418 };
1419
1420 int nBytes;
1421
1422 // bIncludeNextOpcodeAddress == false:
1423 // . JSR addr16: ignore addr16 as a target
1424 // . BRK/RTS/RTI: ignore return (or vector) addr16 as a target
1425 _6502_GetTargets( regs.pc, &aTarget[0], &aTarget[1], &aTarget[2], &nBytes, true, false );
1426
1427 if (nBytes)
1428 {
1429 for (int iTarget = 0; iTarget < NUM_TARGETS; iTarget++ )
1430 {
1431 int nAddress = aTarget[ iTarget ];
1432 if (nAddress != NO_6502_TARGET)
1433 {
1434 for (int iBreakpoint = 0; iBreakpoint < MAX_BREAKPOINTS; iBreakpoint++)
1435 {
1436 Breakpoint_t *pBP = &g_aBreakpoints[iBreakpoint];
1437 if (_BreakpointValid( pBP ))
1438 {
1439 if (pBP->eSource == BP_SRC_MEM_RW || pBP->eSource == BP_SRC_MEM_READ_ONLY || pBP->eSource == BP_SRC_MEM_WRITE_ONLY)
1440 {
1441 if (_CheckBreakpointValue( pBP, nAddress ))
1442 {
1443 g_nBreakMemoryAddr = (WORD)nAddress; // last BP hit
1444 g_sBreakMemoryFullPrefixAddr = GetFullPrefixAddrForBreakpoint(pBP->addrPrefix, (WORD)nAddress, DEVICE_e::DEV_MEMORY, false); // string is last BP hit
1445 BYTE opcode = ReadByteFromMemory(regs.pc);
1446
1447 if (pBP->eSource == BP_SRC_MEM_RW)
1448 {
1449 iBreakpointHit |= HitBreakpoint(pBP, BP_HIT_MEM, iBreakpoint);
1450 }
1451 else if (pBP->eSource == BP_SRC_MEM_READ_ONLY)
1452 {
1453 if (g_aOpcodes[opcode].nMemoryAccess & (MEM_RI|MEM_R))
1454 {
1455 iBreakpointHit |= HitBreakpoint(pBP, BP_HIT_MEMR, iBreakpoint);
1456 }
1457 }
1458 else if (pBP->eSource == BP_SRC_MEM_WRITE_ONLY)
1459 {
1460 if (g_aOpcodes[opcode].nMemoryAccess & (MEM_WI|MEM_W))
1461 {
1462 iBreakpointHit |= HitBreakpoint(pBP, BP_HIT_MEMW, iBreakpoint);
1463 }
1464 }
1465 else

Callers 1

DebugContinueSteppingFunction · 0.85

Calls 6

_6502_GetTargetsFunction · 0.85
_BreakpointValidFunction · 0.85
_CheckBreakpointValueFunction · 0.85
ReadByteFromMemoryFunction · 0.85
HitBreakpointFunction · 0.85

Tested by

no test coverage detected