/* Autor: Oscar Orallo Pelaez */\r
/* Fecha de comienzo: 03-10-2006 */\r
/* Ultima actualizacion: 08-10-2006 */\r
-/* Based on the excellent FAMEC emulator by Stèphane Dallongueville */\r
+/* Based on the excellent C68K emulator by Stèphane Dallongueville */\r
/****************************************************************************/\r
\r
#include <stdio.h>\r
#define FAMEC_CHECK_BRANCHES\r
#define FAMEC_EXTRA_INLINE\r
// #define FAMEC_DEBUG\r
-//#define FAMEC_NO_GOTOS\r
+#define FAMEC_NO_GOTOS\r
#define FAMEC_ADR_BITS 24\r
// #define FAMEC_FETCHBITS 8\r
#define FAMEC_DATABITS 8\r
\r
\r
#undef INLINE\r
-#ifndef INLINE\r
+#ifdef _MSC_VER\r
+#define INLINE\r
+#else\r
#define INLINE __inline__\r
#endif\r
\r
((u32)PC - BasePC)\r
\r
\r
+#ifdef FAMEC_CHECK_BRANCHES\r
+#define FORCE_ALIGNMENT(pc)\r
+#else\r
+#define FORCE_ALIGNMENT(pc) pc&=~1;\r
+#endif\r
+\r
#ifndef FAMEC_32BIT_PC\r
\r
#define SET_PC(A) \\r
{ \\r
u32 pc = A; \\r
+ FORCE_ALIGNMENT(pc); \\r
BasePC = m68kcontext.Fetch[(pc >> M68K_FETCHSFT) & M68K_FETCHMASK]; \\r
PC = (u16*)((pc & M68K_ADR_MASK) + BasePC); \\r
}\r
#define SET_PC(A) \\r
{ \\r
u32 pc = A; \\r
+ FORCE_ALIGNMENT(pc); \\r
BasePC = m68kcontext.Fetch[(pc >> M68K_FETCHSFT) & M68K_FETCHMASK]; \\r
BasePC -= pc & 0xFF000000; \\r
PC = (u16*)(pc + BasePC); \\r
#ifndef FAMEC_32BIT_PC\r
newPC&=M68K_ADR_MASK\r
#endif\r
+#ifdef FAMEC_CHECK_BRANCHES\r
newPC&=~1; // don't crash on games with bad vector tables\r
+#endif\r
\r
// SET_PC(newPC)\r
\r
#endif\r
if (cycles_needed != 0)\r
{\r
+ u32 line;\r
m68kcontext.io_cycle_counter = cycles_needed;\r
cycles_needed = 0;\r
- s32 line=interrupt_chk__();\r
+ line=interrupt_chk__();\r
if (line>0)\r
{\r
if (m68kcontext.iack_handler != NULL)\r
#ifdef PICODRIVE_HACK\r
dualcore_mode:\r
\r
+ while (1)\r
{\r
extern int SekCycleAim, SekCycleCnt, SekCycleAimS68k, SekCycleCntS68k;\r
#define PS_STEP_M68K ((488<<16)/20) // ~24\r
}\r
cycles = m68kcontext.io_cycle_counter = 0;\r
}\r
- goto dualcore_mode;\r
}\r
#endif\r
\r