===========================================================================
| 2558 | |
| 2559 | //=========================================================================== |
| 2560 | Update_t CmdStepOver (int nArgs) |
| 2561 | { |
| 2562 | // assert( g_nDisasmCurAddress == regs.pc ); |
| 2563 | |
| 2564 | // g_nDebugSteps = nArgs ? g_aArgs[1].nValue : 1; |
| 2565 | WORD nDebugSteps = nArgs ? g_aArgs[1].nValue : 1; |
| 2566 | |
| 2567 | while (nDebugSteps-- > 0) |
| 2568 | { |
| 2569 | BYTE nOpcode = ReadByteFromMemory(regs.pc); |
| 2570 | WORD nExpectedAddr = (regs.pc + 3) & _6502_MEM_END; // Wrap around 64K edge case when PC = $FFFD..$FFFF: 20 xx xx |
| 2571 | // int eMode = g_aOpcodes[ nOpcode ].addrmode; |
| 2572 | // int nByte = g_aOpmodes[eMode]._nBytes; |
| 2573 | // if ((eMode == AM_A) && |
| 2574 | |
| 2575 | CmdTrace(0); |
| 2576 | if (nOpcode == OPCODE_JSR) |
| 2577 | { |
| 2578 | /* |
| 2579 | Repro #2 Test when SP <= 0x01 before JSR and _6502_GetStackReturnAddress() fetch return address |
| 2580 | 300:BA 86 FF A2 01 9A 20 0D 03 A6 FF 9A 60 A9 FF 20 A8 FC 60 |
| 2581 | BPX 306 |
| 2582 | MD1 100 |
| 2583 | MD2 1E0 |
| 2584 | |
| 2585 | ORG $300 |
| 2586 | TSX ; 300 |
| 2587 | STX $FF ; 301 |
| 2588 | LDX #1 ; 303 |
| 2589 | TXS ; 305 |
| 2590 | JSR DelayFF ; 306 |
| 2591 | LDX $FF ; 309 |
| 2592 | TXS ; 30B |
| 2593 | RTS ; 30C |
| 2594 | DelayFF LDA #$FF ; 30D |
| 2595 | JSR $FCA8 ; 30F |
| 2596 | RTS ; 312 |
| 2597 | */ |
| 2598 | CmdStepOut(0); |
| 2599 | |
| 2600 | int nMaxSteps = 0xFFFFF; // GH #1194 |
| 2601 | g_nDebugSteps = nMaxSteps; |
| 2602 | |
| 2603 | while (g_nDebugSteps != 0) |
| 2604 | { |
| 2605 | DebugContinueStepping(true); |
| 2606 | } |
| 2607 | |
| 2608 | // If the PC isn't at the expected address after the JSR print a diagnostic so the user knows the stack may be buggered up |
| 2609 | if (regs.pc != nExpectedAddr) |
| 2610 | { |
| 2611 | WORD nActualAddr = _6502_GetStackReturnAddress(); |
| 2612 | bool bValidAddr = (nActualAddr == nExpectedAddr); |
| 2613 | int nStackOffset = _6502_FindStackReturnAddress( nExpectedAddr ); // Trace stack to seee if our expected address is on it |
| 2614 | |
| 2615 | /* |
| 2616 | ORG $300 |
| 2617 | Main JSR HugeWait |
no test coverage detected