diff --git a/src/debug.cpp b/src/debug.cpp index 0e31aaed..9ee7f0f8 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -205,10 +205,13 @@ unsigned int NewBreak(const char* name, int start, int end, unsigned int type, c int GetPRGAddress(int A){ int result; - if((A < 0x8000) || (A > 0xFFFF))return -1; + if(A > 0xFFFF) + return -1; result = &Page[A>>11][A]-PRGptr[0]; - if((result > (int)PRGsize[0]) || (result < 0))return -1; - else return result; + if((result > (int)PRGsize[0]) || (result < 0)) + return -1; + else + return result; } /** diff --git a/src/drivers/win/tracer.cpp b/src/drivers/win/tracer.cpp index 7f55c0db..201ccb6e 100644 --- a/src/drivers/win/tracer.cpp +++ b/src/drivers/win/tracer.cpp @@ -349,26 +349,30 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size) uint8 tmp; static int unloggedlines; - if(((logging_options & LOG_NEW_INSTRUCTIONS) && (oldcodecount != codecount)) || - ((logging_options & LOG_NEW_DATA) && (olddatacount != datacount))) - { - //something new was logged - oldcodecount = codecount; - olddatacount = datacount; - if(unloggedlines > 0) + // if instruction executed from the RAM, skip this, log all instead + // TODO: loops folding mame-lyke style + if(GetPRGAddress(addr) != -1) { + if(((logging_options & LOG_NEW_INSTRUCTIONS) && (oldcodecount != codecount)) || + ((logging_options & LOG_NEW_DATA) && (olddatacount != datacount))) { - sprintf(str_temp, "(%d lines skipped)", unloggedlines); - OutputLogLine(str_temp); - unloggedlines = 0; - } - } else - { - if((logging_options & LOG_NEW_INSTRUCTIONS) || - (logging_options & LOG_NEW_DATA)) + //something new was logged + oldcodecount = codecount; + olddatacount = datacount; + if(unloggedlines > 0) + { + sprintf(str_temp, "(%d lines skipped)", unloggedlines); + OutputLogLine(str_temp); + unloggedlines = 0; + } + } else { - if(FCEUI_GetLoggingCD()) - unloggedlines++; - return; + if((logging_options & LOG_NEW_INSTRUCTIONS) || + (logging_options & LOG_NEW_DATA)) + { + if(FCEUI_GetLoggingCD()) + unloggedlines++; + return; + } } }