summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--genesis.c2
-rw-r--r--m68k_core_x86.c11
-rw-r--r--trans.c2
3 files changed, 9 insertions, 6 deletions
diff --git a/genesis.c b/genesis.c
index 896e76b..8f1197b 100644
--- a/genesis.c
+++ b/genesis.c
@@ -83,7 +83,7 @@ static void adjust_int_cycle(m68k_context * context, vdp_context * v_context)
old_int_cycle = context->int_cycle;
}*/
- if (context->status & M68K_STATUS_TRACE) {
+ if (context->status & M68K_STATUS_TRACE || context->trace_pending) {
context->target_cycle = context->current_cycle;
return;
}
diff --git a/m68k_core_x86.c b/m68k_core_x86.c
index 9bcfd4d..7935c4f 100644
--- a/m68k_core_x86.c
+++ b/m68k_core_x86.c
@@ -2231,7 +2231,7 @@ void translate_m68k_eori_ccr_sr(m68k_options *opts, m68kinst *inst)
}
if (inst->op == M68K_EORI_SR) {
xor_irdisp(code, inst->src.params.immed >> 8, opts->gen.context_reg, offsetof(m68k_context, status), SZ_B);
- if (inst->src.params.immed & 0x700) {
+ if (inst->src.params.immed & 0x8700) {
//set int pending flag in case we trigger an interrupt as a result of the mask change
mov_irdisp(code, INT_PENDING_SR_CHANGE, opts->gen.context_reg, offsetof(m68k_context, int_pending), SZ_B);
call(code, opts->do_sync);
@@ -2929,17 +2929,20 @@ void init_m68k_opts(m68k_options * opts, memmap_chunk * memmap, uint32_t num_chu
add_ir(code, 16-sizeof(void*), RSP, SZ_PTR);
uint32_t adjust_size = code->cur - opts->gen.handle_cycle_limit_int;
code->cur = opts->gen.handle_cycle_limit_int;
- bt_irdisp(code, 7, opts->gen.context_reg, offsetof(m68k_context, status), SZ_B);
- code_ptr no_trace = code->cur + 1;
- jcc(code, CC_NC, no_trace);
+ //handle trace mode
cmp_irdisp(code, 0, opts->gen.context_reg, offsetof(m68k_context, trace_pending), SZ_B);
code_ptr do_trace = code->cur + 1;
jcc(code, CC_NZ, do_trace);
+ bt_irdisp(code, 7, opts->gen.context_reg, offsetof(m68k_context, status), SZ_B);
+ code_ptr no_trace = code->cur + 1;
+ jcc(code, CC_NC, no_trace);
mov_irdisp(code, 1, opts->gen.context_reg, offsetof(m68k_context, trace_pending), SZ_B);
*no_trace = code->cur - (no_trace + 1);
+ //handle interrupts
cmp_rdispr(code, opts->gen.context_reg, offsetof(m68k_context, int_cycle), opts->gen.cycles, SZ_D);
code_ptr do_int = code->cur + 2;
jcc(code, CC_NC, do_int+512);//force 32-bit displacement
+ //handle component synchronization
cmp_rdispr(code, opts->gen.context_reg, offsetof(m68k_context, sync_cycle), opts->gen.cycles, SZ_D);
skip_sync = code->cur + 1;
jcc(code, CC_C, code->cur + 2);
diff --git a/trans.c b/trans.c
index 9399a96..32193ca 100644
--- a/trans.c
+++ b/trans.c
@@ -24,7 +24,7 @@ m68k_context * sync_components(m68k_context * context, uint32_t address)
if (context->current_cycle > 0x80000000) {
context->current_cycle -= 0x80000000;
}
- if (context->status & 0x80) {
+ if (context->status & M68K_STATUS_TRACE || context->trace_pending) {
context->target_cycle = context->current_cycle;
}
return context;