-// (c) Copyright 2007 notaz, All rights reserved.
-
+/*
+ * PicoDrive
+ * (C) notaz, 2007
+ *
+ * This work is licensed under the terms of MAME license.
+ * See COPYING file in the top-level directory.
+ */
#include "../pico_int.h"
-int SekCycleCntS68k=0; // cycles done in this frame
-int SekCycleAimS68k=0; // cycle aim
+unsigned int SekCycleCntS68k;
+unsigned int SekCycleAimS68k;
/* context */
static int SekUnrecognizedOpcodeS68k(void)
{
- unsigned int pc, op;
- pc = SekPcS68k;
- op = PicoCpuCS68k.read16(pc);
- elprintf(EL_ANOMALY, "Unrecognized Opcode %04x @ %06x", op, pc);
+ elprintf(EL_ANOMALY, "Unrecognized Opcode @ %06x", SekPcS68k);
//exit(1);
return 0;
}
}
#endif
#ifdef EMU_F68K
- {
- void *oldcontext = g_m68kcontext;
- g_m68kcontext = &PicoCpuFS68k;
- memset(&PicoCpuFS68k, 0, sizeof(PicoCpuFS68k));
- fm68k_init();
- PicoCpuFS68k.iack_handler = SekIntAckFS68k;
- PicoCpuFS68k.sr = 0x2704; // Z flag
- g_m68kcontext = oldcontext;
- }
+ memset(&PicoCpuFS68k, 0, sizeof(PicoCpuFS68k));
+ fm68k_init();
+ PicoCpuFS68k.iack_handler = SekIntAckFS68k;
+ PicoCpuFS68k.sr = 0x2704; // Z flag
#endif
}
if (Pico.rom==NULL) return 1;
#ifdef EMU_C68K
- PicoCpuCS68k.state_flags=0;
- PicoCpuCS68k.osp=0;
- PicoCpuCS68k.srh =0x27; // Supervisor mode
- PicoCpuCS68k.flags=4; // Z set
- PicoCpuCS68k.irq=0;
- PicoCpuCS68k.a[7]=PicoCpuCS68k.read32(0); // Stack Pointer
- PicoCpuCS68k.membase=0;
- PicoCpuCS68k.pc=PicoCpuCS68k.checkpc(PicoCpuCS68k.read32(4)); // Program Counter
+ CycloneReset(&PicoCpuCS68k);
#endif
#ifdef EMU_M68K
{
}
#endif
#ifdef EMU_F68K
- {
- void *oldcontext = g_m68kcontext;
- g_m68kcontext = &PicoCpuFS68k;
- fm68k_reset();
- g_m68kcontext = oldcontext;
- }
+ fm68k_reset(&PicoCpuFS68k);
#endif
return 0;
PicoCpuCS68k.irq=real_irq;
#endif
#ifdef EMU_M68K
- void *oldcontext = m68ki_cpu_p;
- m68k_set_context(&PicoCpuMS68k);
- m68k_set_irq(real_irq);
- m68k_set_context(oldcontext);
+ // avoid m68k_set_irq() for delaying to work
+ PicoCpuMS68k.int_level = real_irq << 8;
#endif
#ifdef EMU_F68K
PicoCpuFS68k.interrupts[0]=real_irq;
return 0;
}
+void SekInterruptClearS68k(int irq)
+{
+ int level_new = new_irq_level(irq);
+
+#ifdef EMU_C68K
+ PicoCpuCS68k.irq = level_new;
+#endif
+#ifdef EMU_M68K
+ CPU_INT_LEVEL = level_new << 8;
+#endif
+#ifdef EMU_F68K
+ PicoCpuFS68k.interrupts[0] = level_new;
+#endif
+}