summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-04-21 01:19:40 -0700
committerMichael Pavone <pavone@retrodev.com>2017-04-21 01:19:40 -0700
commitc23439852e6e0292a4293eb2b0dc6910de66bc54 (patch)
tree5dc4427c71731e27bc3e2b82df0286b256e403cf
parent66161b5a973121a69a30245fce65e190cccf2eac (diff)
Minor optimization to avoid invalidating translated code when the bank has not actually changed. Makes a nasty edge case in the 68K debugger slightly less severe when dealing with code that uses banking
-rw-r--r--romdb.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/romdb.c b/romdb.c
index 48a76a7..c603521 100644
--- a/romdb.c
+++ b/romdb.c
@@ -296,8 +296,11 @@ m68k_context * write_bank_reg_w(uint32_t address, m68k_context * context, uint16
}
}
} else {
- m68k_invalidate_code_range(gen->m68k, address * 0x80000, (address + 1) * 0x80000);
- context->mem_pointers[gen->mapper_start_index + address] = gen->cart + 0x40000*value;
+ void *new_ptr = gen->cart + 0x40000*value;
+ if (context->mem_pointers[gen->mapper_start_index + address] != new_ptr) {
+ m68k_invalidate_code_range(gen->m68k, address * 0x80000, (address + 1) * 0x80000);
+ context->mem_pointers[gen->mapper_start_index + address] = new_ptr;
+ }
}
return context;
}