tracer/logger fixed unlogged ram code

This commit is contained in:
CaH4e3 2012-12-07 19:18:47 +00:00
parent 7c0604e323
commit f3d6e617d5
2 changed files with 28 additions and 21 deletions

View File

@ -205,10 +205,13 @@ unsigned int NewBreak(const char* name, int start, int end, unsigned int type, c
int GetPRGAddress(int A){ int GetPRGAddress(int A){
int result; int result;
if((A < 0x8000) || (A > 0xFFFF))return -1; if(A > 0xFFFF)
return -1;
result = &Page[A>>11][A]-PRGptr[0]; result = &Page[A>>11][A]-PRGptr[0];
if((result > (int)PRGsize[0]) || (result < 0))return -1; if((result > (int)PRGsize[0]) || (result < 0))
else return result; return -1;
else
return result;
} }
/** /**

View File

@ -349,6 +349,9 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
uint8 tmp; uint8 tmp;
static int unloggedlines; static int unloggedlines;
// 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)) || if(((logging_options & LOG_NEW_INSTRUCTIONS) && (oldcodecount != codecount)) ||
((logging_options & LOG_NEW_DATA) && (olddatacount != datacount))) ((logging_options & LOG_NEW_DATA) && (olddatacount != datacount)))
{ {
@ -371,6 +374,7 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
return; return;
} }
} }
}
if ((addr + size) > 0xFFFF) if ((addr + size) > 0xFFFF)
{ {