comparison m68k_core_x86.c @ 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 17ecd28ddc8a
children d8b0244101c4
comparison
equal deleted inserted replaced
2102:f3fb7e2c727a 2103:522d04e2adcd
2505 2505
2506 void m68k_invalidate_code_range(m68k_context *context, uint32_t start, uint32_t end) 2506 void m68k_invalidate_code_range(m68k_context *context, uint32_t start, uint32_t end)
2507 { 2507 {
2508 m68k_options *opts = context->options; 2508 m68k_options *opts = context->options;
2509 native_map_slot *native_code_map = opts->gen.native_code_map; 2509 native_map_slot *native_code_map = opts->gen.native_code_map;
2510 start -= M68K_MAX_INST_SIZE - 2; 2510 if (start > M68K_MAX_INST_SIZE - 2) {
2511 start -= M68K_MAX_INST_SIZE - 2;
2512 } else {
2513 start = 0;
2514 }
2511 memmap_chunk const *mem_chunk = find_map_chunk(start, &opts->gen, 0, NULL); 2515 memmap_chunk const *mem_chunk = find_map_chunk(start, &opts->gen, 0, NULL);
2512 if (mem_chunk) { 2516 if (mem_chunk) {
2513 //calculate the lowest alias for this address 2517 //calculate the lowest alias for this address
2514 start = mem_chunk->start + ((start - mem_chunk->start) & mem_chunk->mask); 2518 start = mem_chunk->start + ((start - mem_chunk->start) & mem_chunk->mask);
2515 } 2519 }