#include "PicoInt.h"\r
\r
-// note: set SPLIT_MOVEL_PD to 0\r
-\r
typedef unsigned char u8;\r
\r
static unsigned int pppc, ops=0;\r
#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)\r
\r
#if defined(EMU_C68K)\r
-#define other_get_sr() CycloneGetSr(&PicoCpuCM68k)\r
-#define other_dar(i) PicoCpuCM68k.d[i]\r
-#define other_osp PicoCpuCM68k.osp\r
-#define other_get_irq() PicoCpuCM68k.irq\r
-#define other_set_irq(irq) PicoCpuCM68k.irq=irq\r
-#define other_is_stopped() (PicoCpuCM68k.state_flags&1)\r
-#define other_is_tracing() ((PicoCpuCM68k.state_flags&2)?1:0)\r
+static struct Cyclone *currentC68k = NULL;\r
+#define other_set_sub(s) currentC68k=(s)?&PicoCpuCS68k:&PicoCpuCM68k;\r
+#define other_get_sr() CycloneGetSr(currentC68k)\r
+#define other_dar(i) currentC68k->d[i]\r
+#define other_osp currentC68k->osp\r
+#define other_get_irq() currentC68k->irq\r
+#define other_set_irq(i) currentC68k->irq=i\r
+#define other_is_stopped() (currentC68k->state_flags&1)\r
+#define other_is_tracing() ((currentC68k->state_flags&2)?1:0)\r
#elif defined(EMU_F68K)\r
#define other_set_sub(s) g_m68kcontext=(s)?&PicoCpuFS68k:&PicoCpuFM68k;\r
#define other_get_sr() g_m68kcontext->sr\r
static int otherRun(void)\r
{\r
#if defined(EMU_C68K)\r
- PicoCpuCM68k.cycles=1;\r
- CycloneRun(&PicoCpuCM68k);\r
- return 1-PicoCpuCM68k.cycles;\r
+ currentC68k->cycles=1;\r
+ CycloneRun(currentC68k);\r
+ return 1-currentC68k->cycles;\r
#elif defined(EMU_F68K)\r
- return fm68k_emulate(1);\r
+ return fm68k_emulate(1, 0);\r
#endif\r
}\r
\r
have_illegal = 0;\r
m68ki_cpu.pc += 2;\r
#ifdef EMU_C68K\r
- PicoCpuCM68k.pc=PicoCpuCM68k.checkpc(PicoCpuCM68k.pc + 2);\r
+ currentC68k->pc=currentC68k->checkpc(currentC68k->pc + 2);\r
#endif\r
}\r
// hacks for test_misc2\r
// get out of "priviledge violation" loop\r
have_illegal = 1;\r
//m68ki_cpu.s_flag = SFLAG_SET;\r
- //PicoCpuCM68k.srh|=0x20;\r
+ //currentC68k->srh|=0x20;\r
}\r
\r
pppc = is_sub ? SekPcS68k : SekPc;\r
dprintf("---");\r
m68k_disassemble(buff, pppc, M68K_CPU_TYPE_68000);\r
dprintf("PC: %06x: %04x: %s", pppc, ppop, buff);\r
- //dprintf("A7: %08x", PicoCpuCM68k.a[7]);\r
+ //dprintf("A7: %08x", currentC68k->a[7]);\r
}\r
#endif\r
\r
}\r
\r
cyc_other=otherRun();\r
+ // Musashi takes irq even if it hasn't got cycles left, let othercpu do it too\r
+ if (other_get_irq() && other_get_irq() > ((other_get_sr()>>8)&7))\r
+ cyc_other+=otherRun();\r
cyc_musashi=m68k_execute(1);\r
\r
if (cyc_other != cyc_musashi) {\r
if(err) dumpPCandExit(is_sub);\r
\r
#if 0\r
- if (PicoCpuCM68k.a[7] < 0x00ff0000 || PicoCpuCM68k.a[7] >= 0x01000000)\r
+ if (m68ki_cpu.dar[15] < 0x00ff0000 || m68ki_cpu.dar[15] >= 0x01000000)\r
{\r
- PicoCpuCM68k.a[7] = m68ki_cpu.dar[15] = 0xff8000;\r
+ other_dar(15) = m68ki_cpu.dar[15] = 0xff8000;\r
}\r
#endif\r
#if 0\r
m68k_set_reg(M68K_REG_SR, ((mu_sr-1)&~0x2000)|(mu_sr&0x2000)); // broken\r
- CycloneSetSr(&PicoCpuCM68k, ((mu_sr-1)&~0x2000)|(mu_sr&0x2000));\r
- PicoCpuCM68k.stopped = m68ki_cpu.stopped = 0;\r
- if(SekPc > 0x400 && (PicoCpuCM68k.a[7] < 0xff0000 || PicoCpuCM68k.a[7] > 0xffffff))\r
- PicoCpuCM68k.a[7] = m68ki_cpu.dar[15] = 0xff8000;\r
+ CycloneSetSr(currentC68k, ((mu_sr-1)&~0x2000)|(mu_sr&0x2000));\r
+ currentC68k->stopped = m68ki_cpu.stopped = 0;\r
+ if(SekPc > 0x400 && (currentC68k->a[7] < 0xff0000 || currentC68k->a[7] > 0xffffff))\r
+ currentC68k->a[7] = m68ki_cpu.dar[15] = 0xff8000;\r
#endif\r
\r
cyc_done += cyc_other;\r