diff m68k_core.c @ 1214:afa3d0a227ae

Fix regression in handling of unmapped memory addresses
author Michael Pavone <pavone@retrodev.com>
date Wed, 01 Feb 2017 19:33:11 -0800
parents 191ac490fb3d
children 2e6dcb5c11a2
line wrap: on
line diff
--- a/m68k_core.c	Sun Jan 29 11:06:22 2017 -0800
+++ b/m68k_core.c	Wed Feb 01 19:33:11 2017 -0800
@@ -565,6 +565,8 @@
 	if (mem_chunk) {
 		//calculate the lowest alias for this address
 		address = mem_chunk->start + ((address - mem_chunk->start) & mem_chunk->mask);
+	} else {
+		address &= opts->gen.address_mask;
 	}
 	uint32_t chunk = address / NATIVE_CHUNK_SIZE;
 	if (!native_code_map[chunk].base) {
@@ -589,6 +591,8 @@
 	if (mem_chunk) {
 		//calculate the lowest alias for this address
 		address = mem_chunk->start + ((address - mem_chunk->start) & mem_chunk->mask);
+	} else {
+		address &= opts->gen.address_mask;
 	}
 	
 	uint32_t chunk = address / NATIVE_CHUNK_SIZE;
@@ -635,6 +639,8 @@
 		}
 		//calculate the lowest alias for this address
 		address = mem_chunk->start + ((address - mem_chunk->start) & mem_chunk->mask);
+	} else {
+		address &= opts->gen.address_mask;
 	}
 	
 	uint32_t chunk = address / NATIVE_CHUNK_SIZE;