comparison 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
comparison
equal deleted inserted replaced
1509:36732f5c2281 1648:b7ecd0d6a77b
473 ) { 473 ) {
474 return opts->big_movem[i].impl; 474 return opts->big_movem[i].impl;
475 } 475 }
476 } 476 }
477 if (opts->num_movem == opts->movem_storage) { 477 if (opts->num_movem == opts->movem_storage) {
478 opts->movem_storage *= 2; 478 if (!opts->movem_storage) {
479 opts->movem_storage = 4;
480 } else {
481 opts->movem_storage *= 2;
482 }
479 opts->big_movem = realloc(opts->big_movem, sizeof(movem_fun) * opts->movem_storage); 483 opts->big_movem = realloc(opts->big_movem, sizeof(movem_fun) * opts->movem_storage);
480 } 484 }
481 if (!opts->extra_code.cur) { 485 if (!opts->extra_code.cur) {
482 init_code_info(&opts->extra_code); 486 init_code_info(&opts->extra_code);
483 } 487 }
917 RAW_IMPL(M68K_MOVEM, translate_m68k_movem), 921 RAW_IMPL(M68K_MOVEM, translate_m68k_movem),
918 RAW_IMPL(M68K_MOVEP, translate_m68k_movep), 922 RAW_IMPL(M68K_MOVEP, translate_m68k_movep),
919 RAW_IMPL(M68K_MOVE_USP, translate_m68k_move_usp), 923 RAW_IMPL(M68K_MOVE_USP, translate_m68k_move_usp),
920 RAW_IMPL(M68K_LEA, translate_m68k_lea_pea), 924 RAW_IMPL(M68K_LEA, translate_m68k_lea_pea),
921 RAW_IMPL(M68K_PEA, translate_m68k_lea_pea), 925 RAW_IMPL(M68K_PEA, translate_m68k_lea_pea),
922 RAW_IMPL(M68K_CLR, translate_m68k_clr), 926 UNARY_IMPL(M68K_CLR, N0|V0|C0|Z1),
923 OP_IMPL(M68K_EXG, translate_m68k_exg), 927 OP_IMPL(M68K_EXG, translate_m68k_exg),
924 RAW_IMPL(M68K_SCC, translate_m68k_scc), 928 RAW_IMPL(M68K_SCC, translate_m68k_scc),
925 929
926 //function calls and branches 930 //function calls and branches
927 RAW_IMPL(M68K_BCC, translate_m68k_bcc), 931 RAW_IMPL(M68K_BCC, translate_m68k_bcc),
1186 1190
1187 m68k_context * sync_components(m68k_context * context, uint32_t address); 1191 m68k_context * sync_components(m68k_context * context, uint32_t address);
1188 void start_68k_context(m68k_context * context, uint32_t address) 1192 void start_68k_context(m68k_context * context, uint32_t address)
1189 { 1193 {
1190 m68k_options * options = context->options; 1194 m68k_options * options = context->options;
1191 context->should_return = 0;
1192 #ifdef USE_NATIVE 1195 #ifdef USE_NATIVE
1193 code_ptr addr = get_native_address_trans(context, address); 1196 code_ptr addr = get_native_address_trans(context, address);
1194 options->start_context(addr, context); 1197 options->start_context(addr, context);
1195 #else 1198 #else
1196 while (!context->should_return) { 1199 while (!context->should_return) {
1233 } 1236 }
1234 1237
1235 void m68k_options_free(m68k_options *opts) 1238 void m68k_options_free(m68k_options *opts)
1236 { 1239 {
1237 #ifdef USE_NATIVE 1240 #ifdef USE_NATIVE
1241 for (uint32_t address = 0; address < opts->gen.address_mask; address += NATIVE_CHUNK_SIZE)
1242 {
1243 uint32_t chunk = address / NATIVE_CHUNK_SIZE;
1244 if (opts->gen.native_code_map[chunk].base) {
1245 free(opts->gen.native_code_map[chunk].offsets);
1246 }
1247 }
1238 free(opts->gen.native_code_map); 1248 free(opts->gen.native_code_map);
1249 uint32_t ram_inst_slots = ram_size(&opts->gen) / 1024;
1250 for (uint32_t i = 0; i < ram_inst_slots; i++)
1251 {
1252 free(opts->gen.ram_inst_sizes[i]);
1253 }
1239 free(opts->gen.ram_inst_sizes); 1254 free(opts->gen.ram_inst_sizes);
1255 free(opts->big_movem);
1240 #endif 1256 #endif
1241 free(opts); 1257 free(opts);
1242 } 1258 }
1243 1259
1244 #ifndef USE_NATIVE 1260 #ifndef USE_NATIVE