X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=cpu%2Ffame%2Ffamec.c;h=1aba794f3f889e1458cb2d085b5661b28ec3c2ca;hb=8b78786e0f68a1e0e4331dc5f02eac468c99df11;hp=ba1c893c3c879b098dde9f9cb35ac435af8786f5;hpb=c060a9ab9c428e1ed9c4159b56529a2a36031e44;p=picodrive.git diff --git a/cpu/fame/famec.c b/cpu/fame/famec.c index ba1c893..1aba794 100644 --- a/cpu/fame/famec.c +++ b/cpu/fame/famec.c @@ -11,6 +11,10 @@ #include #include +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif + #include "fame.h" @@ -70,12 +74,17 @@ #undef s32 #endif +#ifdef uptr +#undef uptr +#endif + #define u8 unsigned char #define s8 signed char #define u16 unsigned short #define s16 signed short #define u32 unsigned int #define s32 signed int +#define uptr unsigned long /* typedef unsigned char u8; @@ -262,6 +271,10 @@ typedef signed int s32; goto famec_Exec; #endif +#define RET0() \ + m68kcontext.io_cycle_counter = -6; \ + goto famec_End; + #else #define NEXT \ @@ -274,12 +287,16 @@ typedef signed int s32; m68kcontext.io_cycle_counter -= (A); \ return; +#define RET0() \ + m68kcontext.io_cycle_counter = -6; \ + return; + #endif #define M68K_PPL (m68kcontext.sr >> 8) & 7 #define GET_PC \ - ((u32)PC - BasePC) + (u32)((uptr)PC - BasePC) #ifdef FAMEC_CHECK_BRANCHES @@ -514,7 +531,7 @@ M68K_CONTEXT *g_m68kcontext; static u32 Opcode; static s32 cycles_needed; static u16 *PC; -static u32 BasePC; +static uptr BasePC; static u32 flag_C; static u32 flag_V; static u32 flag_NotZ; @@ -689,7 +706,7 @@ int fm68k_reset(void) u32 fm68k_get_pc(M68K_CONTEXT *context) { #ifdef FAMEC_NO_GOTOS - return (context->execinfo & M68K_RUNNING)?(u32)PC-BasePC:context->pc; + return (context->execinfo & M68K_RUNNING)?(uptr)PC-BasePC:context->pc; #else return context->pc; // approximate PC in this mode #endif @@ -768,8 +785,6 @@ static FAMEC_EXTRA_INLINE u32 execute_exception_group_0(s32 vect, s32 addr, u16 } -static void setup_jumptable(void); - #ifdef FAMEC_NO_GOTOS #define OPCODE(N_OP) static void OP_##N_OP(void) @@ -787,7 +802,7 @@ int fm68k_emulate(s32 cycles, int dualcore, int idle_mode) u32 Opcode; s32 cycles_needed; u16 *PC; - u32 BasePC; + uptr BasePC; u32 flag_C; u32 flag_V; u32 flag_NotZ; @@ -914,6 +929,7 @@ famec_Exec: u32 line; m68kcontext.io_cycle_counter = cycles_needed; cycles_needed = 0; + if (m68kcontext.io_cycle_counter <= 0) goto famec_End; line=interrupt_chk__(); if (line>0) { @@ -5032,7 +5048,7 @@ init_jump_table: JumpTable[real_op] = CAST_OP(normal_handler) idle_install: - printf("install..\n"); + // printf("install..\n"); INSTALL_IDLE(0x71fa, 0x66fa, idle_detector_bcc8, 0x6601_idle, 0x6601); INSTALL_IDLE(0x71f8, 0x66f8, idle_detector_bcc8, 0x6601_idle, 0x6601); INSTALL_IDLE(0x71f6, 0x66f6, idle_detector_bcc8, 0x6601_idle, 0x6601); @@ -5041,12 +5057,12 @@ idle_install: INSTALL_IDLE(0x75f8, 0x67f8, idle_detector_bcc8, 0x6701_idle, 0x6701); INSTALL_IDLE(0x75f6, 0x67f6, idle_detector_bcc8, 0x6701_idle, 0x6701); INSTALL_IDLE(0x75f2, 0x67f2, idle_detector_bcc8, 0x6701_idle, 0x6701); - INSTALL_IDLE(0x7dfe, 0x60fe, idle_detector_dead, 0x6001_idle, 0x6001); - INSTALL_IDLE(0x7dfc, 0x60fc, idle_detector_dead, 0x6001_idle, 0x6001); + INSTALL_IDLE(0x7dfe, 0x60fe, idle_detector_bcc8, 0x6001_idle, 0x6001); + INSTALL_IDLE(0x7dfc, 0x60fc, idle_detector_bcc8, 0x6001_idle, 0x6001); return 0; idle_remove: - printf("remove..\n"); + // printf("remove..\n"); UNDO_IDLE(0x71fa, 0x66fa, 0x6601); UNDO_IDLE(0x71f8, 0x66f8, 0x6601); UNDO_IDLE(0x71f6, 0x66f6, 0x6601);