summaryrefslogtreecommitdiff
path: root/m68k_to_x86.c
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2013-01-01 09:40:17 -0800
committerMike Pavone <pavone@retrodev.com>2013-01-01 09:40:17 -0800
commit430233f56146d636d85bf8240b092132b4fb898c (patch)
tree343699f3c3f0fdeceec255500dc3341e9d5caffb /m68k_to_x86.c
parent88d0d276444ed44b8dbfb29eebf14e87ebf0e403 (diff)
Do a sync when interrupt mask changes so we can recompute the next interrupt cycle. Also fix a bug in which the SR part of ORI to SR was not being performed.
Diffstat (limited to 'm68k_to_x86.c')
-rw-r--r--m68k_to_x86.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/m68k_to_x86.c b/m68k_to_x86.c
index 3699fb9..340427a 100644
--- a/m68k_to_x86.c
+++ b/m68k_to_x86.c
@@ -42,6 +42,7 @@ void m68k_native_addr_and_sync();
void set_sr();
void set_ccr();
void get_sr();
+void do_sync();
void m68k_start_context(uint8_t * addr, m68k_context * context);
uint8_t * cycles(uint8_t * dst, uint32_t num)
@@ -2247,6 +2248,9 @@ uint8_t * translate_m68k(uint8_t * dst, m68kinst * inst, x86_68k_options * opts)
dst = mov_rdisp8r(dst, CONTEXT, offsetof(m68k_context, aregs) + sizeof(uint32_t) * 8, opts->aregs[7], SZ_B);
dst = mov_rrdisp8(dst, SCRATCH1, CONTEXT, offsetof(m68k_context, aregs) + sizeof(uint32_t) * 8, SZ_B);
}
+ if (inst->src.params.immed & 0x700) {
+ dst = call(dst, (uint8_t *)do_sync);
+ }
}
break;
case M68K_ASL:
@@ -2447,6 +2451,7 @@ uint8_t * translate_m68k(uint8_t * dst, m68kinst * inst, x86_68k_options * opts)
dst = mov_rdisp8r(dst, CONTEXT, offsetof(m68k_context, aregs) + sizeof(uint32_t) * 8, opts->aregs[7], SZ_D);
dst = mov_rrdisp8(dst, SCRATCH1, CONTEXT, offsetof(m68k_context, aregs) + sizeof(uint32_t) * 8, SZ_D);
}
+ dst = call(dst, (uint8_t *)do_sync);
}
dst = cycles(dst, 12);
} else {
@@ -2557,8 +2562,11 @@ uint8_t * translate_m68k(uint8_t * dst, m68kinst * inst, x86_68k_options * opts)
if (inst->src.params.immed & 0x10) {
dst = mov_irind(dst, 1, CONTEXT, SZ_B);
}
- if (inst->op == M68K_ANDI_SR) {
+ if (inst->op == M68K_ORI_SR) {
dst = or_irdisp8(dst, inst->src.params.immed >> 8, CONTEXT, offsetof(m68k_context, status), SZ_B);
+ if (inst->src.params.immed & 0x700) {
+ dst = call(dst, (uint8_t *)do_sync);
+ }
}
break;
/*case M68K_RESET:*/
@@ -2921,8 +2929,8 @@ uint8_t * translate_m68k_stream(uint32_t address, m68k_context * context)
next = m68k_decode(encoded, &instbuf, address);
address += (next-encoded)*2;
encoded = next;
- m68k_disasm(&instbuf, disbuf);
- printf("%X: %s\n", instbuf.address, disbuf);
+ //m68k_disasm(&instbuf, disbuf);
+ //printf("%X: %s\n", instbuf.address, disbuf);
dst = translate_m68k(dst, &instbuf, opts);
} while(instbuf.op != M68K_ILLEGAL && instbuf.op != M68K_RTS && instbuf.op != M68K_RTE && !(instbuf.op == M68K_BCC && instbuf.extra.cond == COND_TRUE) && instbuf.op != M68K_JMP);
process_deferred(opts);