diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index 62f32a67..864c7c00 100644 --- a/source/Debugger/Debug.cpp +++ b/source/Debugger/Debug.cpp @@ -309,6 +309,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA FILE *g_hTraceFile = NULL; bool g_bTraceHeader = false; // semaphore, flag header to be printed + bool g_bTraceFileWithVideoScanner = false; DWORD extbench = 0; @@ -2012,6 +2013,7 @@ Update_t CmdTraceFile (int nArgs) else strcpy( sFileName, g_sFileNameTrace ); + g_bTraceFileWithVideoScanner = (nArgs >= 2); char sFilePath[ MAX_PATH ]; strcpy(sFilePath, g_sCurrentDir); // TODO: g_sDebugDir @@ -2021,7 +2023,9 @@ Update_t CmdTraceFile (int nArgs) if (g_hTraceFile) { - _snprintf( sText, sizeof(sText), "Trace started: %s", sFilePath ); + char* pTextHdr = g_bTraceFileWithVideoScanner ? "Trace (with video info) started: %s" + : "Trace started: %s"; + _snprintf( sText, sizeof(sText), pTextHdr, sFilePath ); g_bTraceHeader = true; } @@ -8034,8 +8038,6 @@ bool InternalSingleStep () //=========================================================================== -#define TRACELINE_WITH_VIDEO_SCANNER_POS 0 - void OutputTraceLine () { DisasmLine_t line; @@ -8046,33 +8048,38 @@ void OutputTraceLine () char sFlags[ _6502_NUM_FLAGS + 1 ]; DrawFlags( 0, regs.ps, sFlags ); // Get Flags String - if (g_hTraceFile) + if (!g_hTraceFile) + return; + + if (g_bTraceHeader) { - if (g_bTraceHeader) - { - g_bTraceHeader = false; + g_bTraceHeader = false; + if (g_bTraceFileWithVideoScanner) + { fprintf( g_hTraceFile, -#if TRACELINE_WITH_VIDEO_SCANNER_POS // "0000 0000 0000 00 00 00 00 0000 -------- 0000:90 90 90 NOP" - "Vert Horz Addr Data A: X: Y: SP: Flags Addr:Opcode Mnemonic\n" -#else -// "00 00 00 0000 -------- 0000:90 90 90 NOP" - "A: X: Y: SP: Flags Addr:Opcode Mnemonic\n" -#endif - ); + "Vert Horz Addr Data A: X: Y: SP: Flags Addr:Opcode Mnemonic\n"); } - - char sTarget[ 16 ]; - if (line.bTargetValue) + else { - sprintf( sTarget, "%s:%s" - , line.sTargetPointer - , line.sTargetValue - ); + fprintf( g_hTraceFile, +// "00 00 00 0000 -------- 0000:90 90 90 NOP" + "A: X: Y: SP: Flags Addr:Opcode Mnemonic\n"); } + } -#if TRACELINE_WITH_VIDEO_SCANNER_POS + char sTarget[ 16 ]; + if (line.bTargetValue) + { + sprintf( sTarget, "%s:%s" + , line.sTargetPointer + , line.sTargetValue + ); + } + + if (g_bTraceFileWithVideoScanner) + { uint16_t addr = NTSC_VideoGetScannerAddress(0); BYTE data = mem[addr]; @@ -8090,7 +8097,9 @@ void OutputTraceLine () , sDisassembly //, sTarget // TODO: Show target? ); -#else + } + else + { fprintf( g_hTraceFile, "%02X %02X %02X %04X %s %s\n", (unsigned)regs.a, @@ -8101,7 +8110,6 @@ void OutputTraceLine () , sDisassembly //, sTarget // TODO: Show target? ); -#endif } } diff --git a/source/Debugger/Debugger_Commands.cpp b/source/Debugger/Debugger_Commands.cpp index 970ec3d1..fe678cbd 100644 --- a/source/Debugger/Debugger_Commands.cpp +++ b/source/Debugger/Debugger_Commands.cpp @@ -65,7 +65,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {TEXT("RTS") , CmdStepOut , CMD_STEP_OUT , "Step out of subroutine" }, // CPU - Meta Info {TEXT("T") , CmdTrace , CMD_TRACE , "Trace current instruction" }, - {TEXT("TF") , CmdTraceFile , CMD_TRACE_FILE , "Save trace to filename" }, + {TEXT("TF") , CmdTraceFile , CMD_TRACE_FILE , "Save trace to filename [with video scanner info]" }, {TEXT("TL") , CmdTraceLine , CMD_TRACE_LINE , "Trace (with cycle counting)" }, {TEXT("U") , CmdUnassemble , CMD_UNASSEMBLE , "Disassemble instructions" }, // {TEXT("WAIT") , CmdWait , CMD_WAIT , "Run until diff --git a/source/Debugger/Debugger_Help.cpp b/source/Debugger/Debugger_Help.cpp index 84ed29ea..d6d862a1 100644 --- a/source/Debugger/Debugger_Help.cpp +++ b/source/Debugger/Debugger_Help.cpp @@ -867,7 +867,7 @@ Update_t CmdHelpSpecific (int nArgs) ConsoleBufferPush( " JSR will be stepped into" ); ConsoleBufferPush( " Hotkey: Shift-Space" ); case CMD_TRACE_FILE: - Colorize( sText, " Usage: \"[filename]\"" ); + Colorize( sText, " Usage: \"[filename]\" [v]" ); ConsolePrint( sText ); break; case CMD_TRACE_LINE: