summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/memory.c')
-rw-r--r--src/emu/memory.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/emu/memory.c b/src/emu/memory.c
index 826ea4496d4..eade6d00fe7 100644
--- a/src/emu/memory.c
+++ b/src/emu/memory.c
@@ -367,6 +367,17 @@ const char *address_space_names[ADDRESS_SPACES] = { "program", "data", "I/O" };
/*-------------------------------------------------
+ INLINE FUNCTIONS
+-------------------------------------------------*/
+
+INLINE void force_opbase_update(void)
+{
+ opcode_entry = 0xff;
+ memory_set_opbase(activecpu_get_physical_pc_byte());
+}
+
+
+/*-------------------------------------------------
FUNCTION PROTOTYPES
-------------------------------------------------*/
@@ -576,14 +587,13 @@ opbase_handler memory_set_opbase_handler(int cpunum, opbase_handler function)
void memory_set_opbase(offs_t pc)
{
- address_space *space = &active_address_space[ADDRESS_SPACE_PROGRAM];
-
+ const address_space *space = &active_address_space[ADDRESS_SPACE_PROGRAM];
UINT8 *base = NULL, *based = NULL;
- handler_data *handlers;
+ const handler_data *handlers;
UINT8 entry;
/* allow overrides */
- if (opbasefunc)
+ if (opbasefunc != NULL)
{
pc = (*opbasefunc)(pc);
if (pc == ~0)
@@ -596,10 +606,6 @@ void memory_set_opbase(offs_t pc)
if (entry >= SUBTABLE_BASE)
entry = space->readlookup[LEVEL2_INDEX(entry,pc)];
- /* if this entry if the current one, no need to go further */
- if (entry == opcode_entry)
- return;
-
/* keep track of current entry */
opcode_entry = entry;
@@ -627,7 +633,7 @@ void memory_set_opbase(offs_t pc)
/* if no decrypted opcodes, point to the same base */
base = bank_ptr[entry];
based = bankd_ptr[entry];
- if (!based)
+ if (based == NULL)
based = base;
/* compute the adjusted base */
@@ -662,7 +668,7 @@ void memory_set_decrypted_region(int cpunum, offs_t start, offs_t end, void *bas
/* if this is live, adjust now */
if (cpu_getactivecpu() >= 0 && cpunum == cur_context && opcode_entry == banknum)
- memory_set_opbase(activecpu_get_physical_pc_byte());
+ force_opbase_update();
}
else if (bdata->base < end && bdata->end > start)
fatalerror("memory_set_decrypted_region found straddled region %08X-%08X for CPU %d", start, end, cpunum);
@@ -862,10 +868,7 @@ void memory_set_bank(int banknum, int entrynum)
/* if we're executing out of this bank, adjust the opbase pointer */
if (opcode_entry == banknum && cpu_getactivecpu() >= 0)
- {
- opcode_entry = 0xff;
- memory_set_opbase(activecpu_get_physical_pc_byte());
- }
+ force_opbase_update();
}
@@ -891,10 +894,7 @@ void memory_set_bankptr(int banknum, void *base)
/* if we're executing out of this bank, adjust the opbase pointer */
if (opcode_entry == banknum && cpu_getactivecpu() >= 0)
- {
- opcode_entry = 0xff;
- memory_set_opbase(activecpu_get_physical_pc_byte());
- }
+ force_opbase_update();
}