Mercurial > repos > blastem
comparison m68k_core.c @ 1692:5dacaef602a7 segacd
Merge from default
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 05 Jan 2019 00:58:08 -0800 |
parents | 24508cb54f87 |
children | b7ecd0d6a77b eda8df5bc74c |
comparison
equal
deleted
inserted
replaced
1504:95b3a1a8b26c | 1692:5dacaef602a7 |
---|---|
466 ) { | 466 ) { |
467 return opts->big_movem[i].impl; | 467 return opts->big_movem[i].impl; |
468 } | 468 } |
469 } | 469 } |
470 if (opts->num_movem == opts->movem_storage) { | 470 if (opts->num_movem == opts->movem_storage) { |
471 opts->movem_storage *= 2; | 471 if (!opts->movem_storage) { |
472 opts->movem_storage = 4; | |
473 } else { | |
474 opts->movem_storage *= 2; | |
475 } | |
472 opts->big_movem = realloc(opts->big_movem, sizeof(movem_fun) * opts->movem_storage); | 476 opts->big_movem = realloc(opts->big_movem, sizeof(movem_fun) * opts->movem_storage); |
473 } | 477 } |
474 if (!opts->extra_code.cur) { | 478 if (!opts->extra_code.cur) { |
475 init_code_info(&opts->extra_code); | 479 init_code_info(&opts->extra_code); |
476 } | 480 } |
900 RAW_IMPL(M68K_MOVEM, translate_m68k_movem), | 904 RAW_IMPL(M68K_MOVEM, translate_m68k_movem), |
901 RAW_IMPL(M68K_MOVEP, translate_m68k_movep), | 905 RAW_IMPL(M68K_MOVEP, translate_m68k_movep), |
902 RAW_IMPL(M68K_MOVE_USP, translate_m68k_move_usp), | 906 RAW_IMPL(M68K_MOVE_USP, translate_m68k_move_usp), |
903 RAW_IMPL(M68K_LEA, translate_m68k_lea_pea), | 907 RAW_IMPL(M68K_LEA, translate_m68k_lea_pea), |
904 RAW_IMPL(M68K_PEA, translate_m68k_lea_pea), | 908 RAW_IMPL(M68K_PEA, translate_m68k_lea_pea), |
905 RAW_IMPL(M68K_CLR, translate_m68k_clr), | 909 UNARY_IMPL(M68K_CLR, N0|V0|C0|Z1), |
906 OP_IMPL(M68K_EXG, translate_m68k_exg), | 910 OP_IMPL(M68K_EXG, translate_m68k_exg), |
907 RAW_IMPL(M68K_SCC, translate_m68k_scc), | 911 RAW_IMPL(M68K_SCC, translate_m68k_scc), |
908 | 912 |
909 //function calls and branches | 913 //function calls and branches |
910 RAW_IMPL(M68K_BCC, translate_m68k_bcc), | 914 RAW_IMPL(M68K_BCC, translate_m68k_bcc), |
1166 | 1170 |
1167 void start_68k_context(m68k_context * context, uint32_t address) | 1171 void start_68k_context(m68k_context * context, uint32_t address) |
1168 { | 1172 { |
1169 code_ptr addr = get_native_address_trans(context, address); | 1173 code_ptr addr = get_native_address_trans(context, address); |
1170 m68k_options * options = context->options; | 1174 m68k_options * options = context->options; |
1171 context->should_return = 0; | |
1172 options->start_context(addr, context); | 1175 options->start_context(addr, context); |
1173 } | 1176 } |
1174 | 1177 |
1175 void resume_68k(m68k_context *context) | 1178 void resume_68k(m68k_context *context) |
1176 { | 1179 { |
1190 start_68k_context(context, address); | 1193 start_68k_context(context, address); |
1191 } | 1194 } |
1192 | 1195 |
1193 void m68k_options_free(m68k_options *opts) | 1196 void m68k_options_free(m68k_options *opts) |
1194 { | 1197 { |
1198 for (uint32_t address = 0; address < opts->gen.address_mask; address += NATIVE_CHUNK_SIZE) | |
1199 { | |
1200 uint32_t chunk = address / NATIVE_CHUNK_SIZE; | |
1201 if (opts->gen.native_code_map[chunk].base) { | |
1202 free(opts->gen.native_code_map[chunk].offsets); | |
1203 } | |
1204 } | |
1195 free(opts->gen.native_code_map); | 1205 free(opts->gen.native_code_map); |
1206 uint32_t ram_inst_slots = ram_size(&opts->gen) / 1024; | |
1207 for (uint32_t i = 0; i < ram_inst_slots; i++) | |
1208 { | |
1209 free(opts->gen.ram_inst_sizes[i]); | |
1210 } | |
1196 free(opts->gen.ram_inst_sizes); | 1211 free(opts->gen.ram_inst_sizes); |
1212 free(opts->big_movem); | |
1197 free(opts); | 1213 free(opts); |
1198 } | 1214 } |
1199 | 1215 |
1200 | 1216 |
1201 m68k_context * init_68k_context(m68k_options * opts, m68k_reset_handler reset_handler) | 1217 m68k_context * init_68k_context(m68k_options * opts, m68k_reset_handler reset_handler) |