X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=cpu%2Ffame%2Ffamec.c;h=0bb0f9ba1dd625dc1698e3942c518d3e4f43f9f1;hb=8b99ab90aa519639a87c302c9a26fef526febde9;hp=6b147b28b0b9fa7f125c9a51bfefd57a31611e4e;hpb=8022f53da61b8e70420a3bac97250119bbe26457;p=picodrive.git diff --git a/cpu/fame/famec.c b/cpu/fame/famec.c index 6b147b2..0bb0f9b 100644 --- a/cpu/fame/famec.c +++ b/cpu/fame/famec.c @@ -4,7 +4,7 @@ /* Autor: Oscar Orallo Pelaez */ /* Fecha de comienzo: 03-10-2006 */ /* Ultima actualizacion: 08-10-2006 */ -/* Based on the excellent FAMEC emulator by Stèphane Dallongueville */ +/* Based on the excellent C68K emulator by Stèphane Dallongueville */ /****************************************************************************/ #include @@ -20,7 +20,7 @@ #define FAMEC_CHECK_BRANCHES #define FAMEC_EXTRA_INLINE // #define FAMEC_DEBUG -//#define FAMEC_NO_GOTOS +#define FAMEC_NO_GOTOS #define FAMEC_ADR_BITS 24 // #define FAMEC_FETCHBITS 8 #define FAMEC_DATABITS 8 @@ -280,11 +280,18 @@ typedef signed int s32; ((u32)PC - BasePC) +#ifdef FAMEC_CHECK_BRANCHES +#define FORCE_ALIGNMENT(pc) +#else +#define FORCE_ALIGNMENT(pc) pc&=~1; +#endif + #ifndef FAMEC_32BIT_PC #define SET_PC(A) \ { \ u32 pc = A; \ + FORCE_ALIGNMENT(pc); \ BasePC = m68kcontext.Fetch[(pc >> M68K_FETCHSFT) & M68K_FETCHMASK]; \ PC = (u16*)((pc & M68K_ADR_MASK) + BasePC); \ } @@ -294,6 +301,7 @@ typedef signed int s32; #define SET_PC(A) \ { \ u32 pc = A; \ + FORCE_ALIGNMENT(pc); \ BasePC = m68kcontext.Fetch[(pc >> M68K_FETCHSFT) & M68K_FETCHMASK]; \ BasePC -= pc & 0xFF000000; \ PC = (u16*)(pc + BasePC); \ @@ -734,7 +742,9 @@ static FAMEC_EXTRA_INLINE u32 execute_exception(s32 vect, u32 oldPC, u32 oldSR) #ifndef FAMEC_32BIT_PC newPC&=M68K_ADR_MASK #endif +#ifdef FAMEC_CHECK_BRANCHES newPC&=~1; // don't crash on games with bad vector tables +#endif // SET_PC(newPC) @@ -948,6 +958,7 @@ famec_End: #ifdef PICODRIVE_HACK dualcore_mode: + while (1) { extern int SekCycleAim, SekCycleCnt, SekCycleAimS68k, SekCycleCntS68k; #define PS_STEP_M68K ((488<<16)/20) // ~24 @@ -989,7 +1000,6 @@ dualcore_mode: } cycles = m68kcontext.io_cycle_counter = 0; } - goto dualcore_mode; } #endif