Mercurial > repos > blastem
comparison genesis.c @ 1777:5358a7126b96 mame_interp
Make get_open_bus_value work right with Musashi
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 13 Mar 2019 20:34:24 -0700 |
parents | a9fc826c6a9d |
children | 49f65d240299 |
comparison
equal
deleted
inserted
replaced
1776:d5118d6f9c75 | 1777:5358a7126b96 |
---|---|
41 | 41 |
42 #ifndef USE_NATIVE | 42 #ifndef USE_NATIVE |
43 #define Z80_CYCLE cycles | 43 #define Z80_CYCLE cycles |
44 #define Z80_OPTS opts | 44 #define Z80_OPTS opts |
45 #define z80_handle_code_write(...) | 45 #define z80_handle_code_write(...) |
46 #include "musashi/m68kcpu.h" | |
46 #else | 47 #else |
47 #define Z80_CYCLE current_cycle | 48 #define Z80_CYCLE current_cycle |
48 #define Z80_OPTS options | 49 #define Z80_OPTS options |
49 #endif | 50 #endif |
50 | 51 |
217 } | 218 } |
218 | 219 |
219 static uint16_t get_open_bus_value(system_header *system) | 220 static uint16_t get_open_bus_value(system_header *system) |
220 { | 221 { |
221 genesis_context *genesis = (genesis_context *)system; | 222 genesis_context *genesis = (genesis_context *)system; |
223 #ifdef USE_NATIVE | |
222 return read_dma_value(genesis->m68k->last_prefetch_address/2); | 224 return read_dma_value(genesis->m68k->last_prefetch_address/2); |
225 #else | |
226 m68000_base_device *device = (m68000_base_device *)genesis->m68k; | |
227 return read_dma_value(device->pref_addr/2); | |
228 #endif | |
223 } | 229 } |
224 | 230 |
225 static void adjust_int_cycle(m68k_context * context, vdp_context * v_context) | 231 static void adjust_int_cycle(m68k_context * context, vdp_context * v_context) |
226 { | 232 { |
227 //static int old_int_cycle = CYCLE_NEVER; | 233 //static int old_int_cycle = CYCLE_NEVER; |
1124 goto done; | 1130 goto done; |
1125 } | 1131 } |
1126 if (load_from_file(&state, statepath)) { | 1132 if (load_from_file(&state, statepath)) { |
1127 genesis_deserialize(&state, gen); | 1133 genesis_deserialize(&state, gen); |
1128 free(state.data); | 1134 free(state.data); |
1135 #ifdef USE_NATIVE | |
1129 //HACK | 1136 //HACK |
1130 pc = gen->m68k->last_prefetch_address; | 1137 pc = gen->m68k->last_prefetch_address; |
1138 #endif | |
1131 ret = 1; | 1139 ret = 1; |
1132 } else { | 1140 } else { |
1133 #ifdef USE_NATIVE | 1141 #ifdef USE_NATIVE |
1134 strcpy(statepath + strlen(statepath)-strlen("state"), "gst"); | 1142 strcpy(statepath + strlen(statepath)-strlen("state"), "gst"); |
1135 pc = load_gst(gen, statepath); | 1143 pc = load_gst(gen, statepath); |
1181 deserialize_buffer state; | 1189 deserialize_buffer state; |
1182 uint32_t pc; | 1190 uint32_t pc; |
1183 if (load_from_file(&state, statefile)) { | 1191 if (load_from_file(&state, statefile)) { |
1184 genesis_deserialize(&state, gen); | 1192 genesis_deserialize(&state, gen); |
1185 free(state.data); | 1193 free(state.data); |
1194 #ifdef USE_NATIVE | |
1186 //HACK | 1195 //HACK |
1187 pc = gen->m68k->last_prefetch_address; | 1196 pc = gen->m68k->last_prefetch_address; |
1197 #endif | |
1188 } else { | 1198 } else { |
1189 #ifdef USE_NATIVE | 1199 #ifdef USE_NATIVE |
1190 pc = load_gst(gen, statefile); | 1200 pc = load_gst(gen, statefile); |
1191 if (!pc) { | 1201 if (!pc) { |
1192 fatal_error("Failed to load save state %s\n", statefile); | 1202 fatal_error("Failed to load save state %s\n", statefile); |