changeset 2103:522d04e2adcd

Fix regression in booting games with Japanese Mega CD BIOS
author Michael Pavone <pavone@retrodev.com>
date Fri, 11 Feb 2022 22:55:01 -0800
parents f3fb7e2c727a
children ff32a90260c9
files m68k_core_x86.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/m68k_core_x86.c	Fri Feb 11 22:31:40 2022 -0800
+++ b/m68k_core_x86.c	Fri Feb 11 22:55:01 2022 -0800
@@ -2507,7 +2507,11 @@
 {
 	m68k_options *opts = context->options;
 	native_map_slot *native_code_map = opts->gen.native_code_map;
-	start -= M68K_MAX_INST_SIZE - 2;
+	if (start > M68K_MAX_INST_SIZE - 2) {
+		start -= M68K_MAX_INST_SIZE - 2;
+	} else {
+		start = 0;
+	}
 	memmap_chunk const *mem_chunk = find_map_chunk(start, &opts->gen, 0, NULL);
 	if (mem_chunk) {
 		//calculate the lowest alias for this address