diff m68k_core.c @ 1648:b7ecd0d6a77b mame_interp

Merge from default
author Michael Pavone <pavone@retrodev.com>
date Tue, 25 Dec 2018 11:12:26 -0800
parents 2455662378ed 24508cb54f87
children 75172d440900
line wrap: on
line diff
--- a/m68k_core.c	Sun Dec 31 10:11:16 2017 -0800
+++ b/m68k_core.c	Tue Dec 25 11:12:26 2018 -0800
@@ -475,7 +475,11 @@
 		}
 	}
 	if (opts->num_movem == opts->movem_storage) {
-		opts->movem_storage *= 2;
+		if (!opts->movem_storage) {
+			opts->movem_storage = 4;
+		} else {
+			opts->movem_storage *= 2;
+		}
 		opts->big_movem = realloc(opts->big_movem, sizeof(movem_fun) * opts->movem_storage);
 	}
 	if (!opts->extra_code.cur) {
@@ -919,7 +923,7 @@
 	RAW_IMPL(M68K_MOVE_USP, translate_m68k_move_usp),
 	RAW_IMPL(M68K_LEA, translate_m68k_lea_pea),
 	RAW_IMPL(M68K_PEA, translate_m68k_lea_pea),
-	RAW_IMPL(M68K_CLR, translate_m68k_clr),
+	UNARY_IMPL(M68K_CLR, N0|V0|C0|Z1),
 	OP_IMPL(M68K_EXG, translate_m68k_exg),
 	RAW_IMPL(M68K_SCC, translate_m68k_scc),
 
@@ -1188,7 +1192,6 @@
 void start_68k_context(m68k_context * context, uint32_t address)
 {
 	m68k_options * options = context->options;
-	context->should_return = 0;
 #ifdef USE_NATIVE
 	code_ptr addr = get_native_address_trans(context, address);
 	options->start_context(addr, context);
@@ -1235,8 +1238,21 @@
 void m68k_options_free(m68k_options *opts)
 {
 #ifdef USE_NATIVE
+	for (uint32_t address = 0; address < opts->gen.address_mask; address += NATIVE_CHUNK_SIZE)
+	{
+		uint32_t chunk = address / NATIVE_CHUNK_SIZE;
+		if (opts->gen.native_code_map[chunk].base) {
+			free(opts->gen.native_code_map[chunk].offsets);
+		}
+	}
 	free(opts->gen.native_code_map);
+	uint32_t ram_inst_slots = ram_size(&opts->gen) / 1024;
+	for (uint32_t i = 0; i < ram_inst_slots; i++)
+	{
+		free(opts->gen.ram_inst_sizes[i]);
+	}
 	free(opts->gen.ram_inst_sizes);
+	free(opts->big_movem);
 #endif
 	free(opts);
 }