diff m68k_core.c @ 692:e11e68918691

Fix bug in map_native_address that was breaking some self-modifying code in Gunstar Heroes
author Michael Pavone <pavone@retrodev.com>
date Tue, 28 Apr 2015 19:04:36 -0700
parents fc04781f4d28
children 7f96bd1cb1be
line wrap: on
line diff
--- a/m68k_core.c	Sat Mar 14 12:05:03 2015 -0700
+++ b/m68k_core.c	Tue Apr 28 19:04:36 2015 -0700
@@ -606,7 +606,7 @@
 				uint32_t masked = (address & opts->gen.memmap[i].mask);
 				uint32_t final_off = masked + meta_off;
 				uint32_t ram_flags_off = final_off >> (opts->gen.ram_flags_shift + 3);
-				context->ram_code_flags[ram_flags_off] |= 1 << ((final_off >> opts->gen.ram_flags_shift) & 3);
+				context->ram_code_flags[ram_flags_off] |= 1 << ((final_off >> opts->gen.ram_flags_shift) & 7);
 
 				uint32_t slot = final_off / 1024;
 				if (!opts->gen.ram_inst_sizes[slot]) {
@@ -618,7 +618,7 @@
 				masked = (address + size - 1) & opts->gen.memmap[i].mask;
 				final_off = masked + meta_off;
 				ram_flags_off = final_off >> (opts->gen.ram_flags_shift + 3);
-				context->ram_code_flags[ram_flags_off] |= 1 << ((final_off >> opts->gen.ram_flags_shift) & 3);
+				context->ram_code_flags[ram_flags_off] |= 1 << ((final_off >> opts->gen.ram_flags_shift) & 7);
 			}
 			break;
 		} else if ((opts->gen.memmap[i].flags & (MMAP_WRITE | MMAP_CODE)) == (MMAP_WRITE | MMAP_CODE)) {