From: notaz Date: Tue, 30 Oct 2007 21:49:39 +0000 (+0000) Subject: bugfixes, famec tuning X-Git-Tag: v1.85~631 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0ae0cb4bb73e6e2fc10e7b19a5a72a012db6d6a;p=picodrive.git bugfixes, famec tuning git-svn-id: file:///home/notaz/opt/svn/PicoDrive@287 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/Pico/Cart.c b/Pico/Cart.c index cf33580..cf16951 100644 --- a/Pico/Cart.c +++ b/Pico/Cart.c @@ -48,7 +48,7 @@ pm_file *pm_open(const char *path) ext = zipentry->name+strlen(zipentry->name)-3; for (i = 0; i < sizeof(rom_exts)/sizeof(rom_exts[0]); i++) - if (!strcasecmp(ext, rom_exts[i]) == 0) goto found_rom_zip; + if (strcasecmp(ext, rom_exts[i]) == 0) goto found_rom_zip; } /* zipfile given, but nothing found suitable for us inside */ diff --git a/cpu/fame/famec.c b/cpu/fame/famec.c index 76965fa..11d2cb2 100644 --- a/cpu/fame/famec.c +++ b/cpu/fame/famec.c @@ -17,12 +17,10 @@ // Options // #define FAMEC_ROLL_INLINE #define FAMEC_EMULATE_TRACE -#define FAMEC_IRQ_CYCLES #define FAMEC_CHECK_BRANCHES -// #define FAMEC_USE_DATA_BANKS -// #define FAMEC_EXTRA_INLINE +#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 @@ -41,6 +39,7 @@ #ifndef FAMEC_EXTRA_INLINE #define FAMEC_EXTRA_INLINE #else +#undef FAMEC_EXTRA_INLINE #define FAMEC_EXTRA_INLINE INLINE #endif @@ -84,17 +83,6 @@ typedef unsigned int u32; typedef signed int s32; */ -#ifdef FAMEC_EMULATE_TRACE -static u32 flag_T; -#endif -static u32 flag_C; -static u32 flag_V; -static u32 flag_NotZ; -static u32 flag_N; -static u32 flag_X; // 16 bytes aligned -static u32 flag_S; -static u32 flag_I; - #ifndef M68K_OK #define M68K_OK 0 #endif @@ -288,22 +276,27 @@ static u32 flag_I; #define M68K_PPL (m68kcontext.sr >> 8) & 7 #define GET_PC \ - (u32)PC - BasePC; + ((u32)PC - BasePC) #ifndef FAMEC_32BIT_PC #define SET_PC(A) \ - BasePC = g_m68kcontext->Fetch[((A) >> M68K_FETCHSFT) & M68K_FETCHMASK]; \ - /* BasePC -= (A) & 0xFF000000; */ \ - PC = (u16*)(((A) & M68K_ADR_MASK) + BasePC); +{ \ + u32 pc = A; \ + BasePC = m68kcontext.Fetch[(pc >> M68K_FETCHSFT) & M68K_FETCHMASK]; \ + PC = (u16*)((pc & M68K_ADR_MASK) + BasePC); \ +} #else #define SET_PC(A) \ - BasePC = g_m68kcontext->Fetch[((A) >> M68K_FETCHSFT) & M68K_FETCHMASK]; \ - BasePC -= (A) & 0xFF000000; \ - PC = (u16*)((A) + BasePC); +{ \ + u32 pc = A; \ + BasePC = m68kcontext.Fetch[(pc >> M68K_FETCHSFT) & M68K_FETCHMASK]; \ + BasePC -= pc & 0xFF000000; \ + PC = (u16*)(pc + BasePC); \ +} #endif @@ -473,7 +466,7 @@ static u32 flag_I; if (interrupt_chk__()) \ { \ cycles_needed=m68kcontext.io_cycle_counter-(CLK); \ - m68kcontext.io_cycle_counter= (CLK); \ + m68kcontext.io_cycle_counter=(CLK); \ } @@ -488,9 +481,10 @@ static u32 flag_I; #define CHECK_BRANCH_EXCEPTION(_PC_) \ if ((_PC_)&1) \ { \ - u32 pr_PC=GET_PC; \ + u32 new_PC, pr_PC=GET_PC; \ m68kcontext.execinfo |= FM68K_EMULATE_GROUP_0; \ - execute_exception_group_0(M68K_ADDRESS_ERROR_EX, 0, pr_PC, 0x12 ); \ + new_PC = execute_exception_group_0(M68K_ADDRESS_ERROR_EX, 0, pr_PC, 0x12 ); \ + SET_PC(new_PC); \ CHECK_BRANCH_EXCEPTION_GOTO_END \ } #else @@ -500,9 +494,6 @@ static u32 flag_I; static int init_jump_table(void); -/* Custom function handler */ -typedef void (*icust_handler_func)(u32 vector); - // global variable /////////////////// @@ -510,20 +501,30 @@ typedef void (*icust_handler_func)(u32 vector); M68K_CONTEXT *g_m68kcontext; #define m68kcontext (*g_m68kcontext) -/* static s32 io_cycle_counter; */ -static s32 cycles_needed=0; +#ifdef FAMEC_NO_GOTOS +static u32 Opcode; +static s32 cycles_needed; static u16 *PC; static u32 BasePC; -// static u32 Fetch[M68K_FETCHBANK]; +static u32 flag_V; +static u32 flag_NotZ; +static u32 flag_N; +static u32 flag_X; +#endif + +#ifdef FAMEC_EMULATE_TRACE +static u32 flag_T; +#endif +static u32 flag_S; +static u32 flag_I; + +static u32 initialised = 0; /* Custom function handler */ typedef void (*opcode_func)(void); static opcode_func JumpTable[0x10000]; - -static u32 initialised = 0; - // exception cycle table (taken from musashi core) static const s32 exception_cycle_table[256] = { @@ -673,7 +674,11 @@ 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; +#else + return context->pc; // approximate PC in this mode +#endif } @@ -692,64 +697,62 @@ int fm68k_would_interrupt(void) return interrupt_chk__(); } -static FAMEC_EXTRA_INLINE void execute_exception(s32 vect) +static FAMEC_EXTRA_INLINE u32 execute_exception(s32 vect, u32 oldPC, u32 oldSR) { - extern u32 flag_S; -#ifndef FAMEC_IRQ_CYCLES - if ((vect<24)||(vect>31)) -#endif + u32 newPC; + //u32 oldSR = GET_SR; + m68kcontext.io_cycle_counter -= exception_cycle_table[vect]; - { - u32 newPC; - u32 oldPC; - u32 oldSR = GET_SR; - PRE_IO + PRE_IO - READ_LONG_F(vect * 4, newPC) + READ_LONG_F(vect * 4, newPC) - /* swap A7 and USP */ - if (!flag_S) - { - u32 tmpSP; + /* swap A7 and USP */ + if (!flag_S) + { + u32 tmpSP; - tmpSP = ASP; - ASP = AREG(7); - AREG(7) = tmpSP; - } + tmpSP = ASP; + ASP = AREG(7); + AREG(7) = tmpSP; + } - oldPC = (u32)(PC) - BasePC; - PUSH_32_F(oldPC) - PUSH_16_F(oldSR) + //oldPC = GET_PC; + PUSH_32_F(oldPC) + PUSH_16_F(oldSR) - /* adjust SR */ - flag_S = M68K_SR_S; + /* adjust SR */ + flag_S = M68K_SR_S; #ifndef FAMEC_32BIT_PC - newPC&=M68K_ADR_MASK + newPC&=M68K_ADR_MASK #endif - newPC&=~1; // don't crash on games with bad vector tables + newPC&=~1; // don't crash on games with bad vector tables - SET_PC(newPC) + // SET_PC(newPC) - POST_IO - } + POST_IO + + return newPC; } -static FAMEC_EXTRA_INLINE void execute_exception_group_0(s32 vect, u16 inst_reg, s32 addr, u16 spec_info) +static FAMEC_EXTRA_INLINE u32 execute_exception_group_0(s32 vect, s32 addr, u16 spec_info, u32 oldSR) { - execute_exception(vect); + u32 newPC; + u16 inst_reg = 0; + newPC = execute_exception(vect, addr, oldSR); //if (!(m68kcontext.icust_handler && m68kcontext.icust_handler[vect])) { PUSH_16_F(inst_reg); PUSH_32_F(addr); PUSH_16_F(spec_info); } + return newPC; } static void setup_jumptable(void); -static u32 Opcode; #ifdef FAMEC_NO_GOTOS @@ -764,6 +767,18 @@ static u32 Opcode; int fm68k_emulate(s32 cycles) { +#ifndef FAMEC_NO_GOTOS + u32 Opcode; + s32 cycles_needed; + u16 *PC; + u32 BasePC; + u32 flag_C; + u32 flag_V; + u32 flag_NotZ; + u32 flag_N; + u32 flag_X; +#endif + if (!initialised) { #ifdef FAMEC_NO_GOTOS @@ -824,7 +839,7 @@ int fm68k_emulate(s32 cycles) else m68kcontext.interrupts[0] = 0; - execute_exception(line + 0x18); + SET_PC(execute_exception(line + 0x18, GET_PC, GET_SR)); flag_I = (u32)line; if (m68kcontext.io_cycle_counter <= 0) goto famec_End; } @@ -833,7 +848,7 @@ int fm68k_emulate(s32 cycles) if (flag_T) { m68kcontext.execinfo |= FM68K_EMULATE_TRACE; - cycles_needed= m68kcontext.io_cycle_counter; + cycles_needed = m68kcontext.io_cycle_counter; m68kcontext.io_cycle_counter=0; } #endif @@ -862,22 +877,25 @@ famec_Exec: #ifdef FAMEC_EMULATE_TRACE if (m68kcontext.execinfo & FM68K_EMULATE_TRACE) { - m68kcontext.io_cycle_counter= cycles_needed; + m68kcontext.io_cycle_counter = cycles_needed; + cycles_needed = 0; m68kcontext.execinfo &= ~FM68K_EMULATE_TRACE; m68kcontext.execinfo |= FM68K_DO_TRACE; - execute_exception(M68K_TRACE_EX); + SET_PC(execute_exception(M68K_TRACE_EX, GET_PC, GET_SR)); flag_T=0; if (m68kcontext.io_cycle_counter > 0) { - NEXT + //NEXT + goto famec_Exec; } } else #endif if (cycles_needed != 0) { + m68kcontext.io_cycle_counter = cycles_needed; + cycles_needed = 0; s32 line=interrupt_chk__(); - m68kcontext.io_cycle_counter= cycles_needed; if (line>0) { if (m68kcontext.iack_handler != NULL) @@ -885,11 +903,11 @@ famec_Exec: else m68kcontext.interrupts[0] = 0; - execute_exception(line + 0x18); + SET_PC(execute_exception(line + 0x18, GET_PC, GET_SR)); flag_I = (u32)line; } #ifdef FAMEC_EMULATE_TRACE - else if (!(flag_T)) + if (!(flag_T)) #endif if (m68kcontext.io_cycle_counter > 0) { diff --git a/cpu/fame/famec_opcodes.h b/cpu/fame/famec_opcodes.h index eeb3c2b..8586603 100644 --- a/cpu/fame/famec_opcodes.h +++ b/cpu/fame/famec_opcodes.h @@ -638,9 +638,7 @@ OPCODE(0x007C) } else { - u32 newPC = (u32)(PC) - BasePC; - SET_PC(newPC-2); - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); #ifdef USE_CYCLONE_TIMING RET(0) #else @@ -1298,9 +1296,7 @@ OPCODE(0x027C) } else { - u32 newPC = (u32)(PC) - BasePC; - SET_PC(newPC-2); - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } RET(20) @@ -1950,9 +1946,7 @@ OPCODE(0x0A7C) } else { - u32 newPC = (u32)(PC) - BasePC; - SET_PC(newPC-2); - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(0) } RET(20) @@ -16570,9 +16564,7 @@ OPCODE(0x46C0) } else { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } RET(12) @@ -16601,9 +16593,7 @@ OPCODE(0x46D0) } else { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } RET(16) @@ -16633,9 +16623,7 @@ OPCODE(0x46D8) } else { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } RET(16) @@ -16665,9 +16653,7 @@ OPCODE(0x46E0) } else { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } RET(18) @@ -16697,9 +16683,7 @@ OPCODE(0x46E8) } else { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } RET(20) @@ -16729,9 +16713,7 @@ OPCODE(0x46F0) } else { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } RET(22) @@ -16761,9 +16743,7 @@ OPCODE(0x46F8) } else { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } RET(20) @@ -16792,9 +16772,7 @@ OPCODE(0x46F9) } else { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } RET(24) @@ -16820,13 +16798,11 @@ OPCODE(0x46FA) ASP = res; } POST_IO - CHECK_INT_TO_JUMP(24) + CHECK_INT_TO_JUMP(20) } else { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } RET(20) @@ -16856,9 +16832,7 @@ OPCODE(0x46FB) } else { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } RET(22) @@ -16884,9 +16858,7 @@ OPCODE(0x46FC) } else { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } RET(16) @@ -16916,9 +16888,7 @@ OPCODE(0x46DF) } else { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } RET(16) @@ -16948,9 +16918,7 @@ OPCODE(0x46E7) } else { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } RET(18) @@ -18473,27 +18441,21 @@ RET(10) // ILLEGAL OPCODE(0x4AFC) { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_ILLEGAL_INSTRUCTION_EX); + SET_PC(execute_exception(M68K_ILLEGAL_INSTRUCTION_EX, GET_PC-2, GET_SR)); RET(0) } // ILLEGAL A000-AFFF OPCODE(0xA000) { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_1010_EX); + SET_PC(execute_exception(M68K_1010_EX, GET_PC-2, GET_SR)); RET(0) } // ILLEGAL F000-FFFF OPCODE(0xF000) { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_1111_EX); + SET_PC(execute_exception(M68K_1111_EX, GET_PC-2, GET_SR)); RET(0) // 4 already taken by exc. handler } @@ -19054,7 +19016,7 @@ RET(12) // TRAP OPCODE(0x4E40) { - execute_exception(M68K_TRAP_BASE_EX + (Opcode & 0xF)); + SET_PC(execute_exception(M68K_TRAP_BASE_EX + (Opcode & 0xF), GET_PC, GET_SR)); RET(4) } @@ -19125,9 +19087,7 @@ OPCODE(0x4E60) if (!flag_S) { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } res = AREGu32((Opcode >> 0) & 7); @@ -19143,9 +19103,7 @@ OPCODE(0x4E68) if (!flag_S) { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } res = ASP; @@ -19161,9 +19119,7 @@ OPCODE(0x4E70) if (!flag_S) { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } PRE_IO @@ -19187,9 +19143,7 @@ OPCODE(0x4E72) if (!flag_S) { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } FETCH_WORD(res); @@ -19214,9 +19168,7 @@ OPCODE(0x4E73) if (!flag_S) { - u32 oldPC=GET_PC; - SET_PC(oldPC-2) - execute_exception(M68K_PRIVILEGE_VIOLATION_EX); + SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR)); RET(4) } PRE_IO @@ -19254,7 +19206,7 @@ RET(16) OPCODE(0x4E76) { if (flag_V & 0x80) - execute_exception(M68K_TRAPV_EX); + SET_PC(execute_exception(M68K_TRAPV_EX, GET_PC, GET_SR)); RET(4) } @@ -19517,7 +19469,7 @@ OPCODE(0x4180) if (((s32)res < 0) || (res > src)) { flag_N = res >> 8; - execute_exception(M68K_CHK_EX); + SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR)); } RET(10) } @@ -19535,7 +19487,7 @@ OPCODE(0x4190) if (((s32)res < 0) || (res > src)) { flag_N = res >> 8; - execute_exception(M68K_CHK_EX); + SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR)); } POST_IO RET(14) @@ -19555,7 +19507,7 @@ OPCODE(0x4198) if (((s32)res < 0) || (res > src)) { flag_N = res >> 8; - execute_exception(M68K_CHK_EX); + SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR)); } POST_IO RET(14) @@ -19575,7 +19527,7 @@ OPCODE(0x41A0) if (((s32)res < 0) || (res > src)) { flag_N = res >> 8; - execute_exception(M68K_CHK_EX); + SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR)); } POST_IO RET(16) @@ -19595,7 +19547,7 @@ OPCODE(0x41A8) if (((s32)res < 0) || (res > src)) { flag_N = res >> 8; - execute_exception(M68K_CHK_EX); + SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR)); } POST_IO RET(18) @@ -19615,7 +19567,7 @@ OPCODE(0x41B0) if (((s32)res < 0) || (res > src)) { flag_N = res >> 8; - execute_exception(M68K_CHK_EX); + SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR)); } POST_IO RET(20) @@ -19634,7 +19586,7 @@ OPCODE(0x41B8) if (((s32)res < 0) || (res > src)) { flag_N = res >> 8; - execute_exception(M68K_CHK_EX); + SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR)); } POST_IO RET(18) @@ -19653,7 +19605,7 @@ OPCODE(0x41B9) if (((s32)res < 0) || (res > src)) { flag_N = res >> 8; - execute_exception(M68K_CHK_EX); + SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR)); } POST_IO RET(22) @@ -19673,7 +19625,7 @@ OPCODE(0x41BA) if (((s32)res < 0) || (res > src)) { flag_N = res >> 8; - execute_exception(M68K_CHK_EX); + SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR)); } POST_IO RET(18) @@ -19693,7 +19645,7 @@ OPCODE(0x41BB) if (((s32)res < 0) || (res > src)) { flag_N = res >> 8; - execute_exception(M68K_CHK_EX); + SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR)); } POST_IO RET(20) @@ -19710,7 +19662,7 @@ OPCODE(0x41BC) if (((s32)res < 0) || (res > src)) { flag_N = res >> 8; - execute_exception(M68K_CHK_EX); + SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR)); } POST_IO RET(14) @@ -19730,7 +19682,7 @@ OPCODE(0x419F) if (((s32)res < 0) || (res > src)) { flag_N = res >> 8; - execute_exception(M68K_CHK_EX); + SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR)); } POST_IO RET(14) @@ -19750,7 +19702,7 @@ OPCODE(0x41A7) if (((s32)res < 0) || (res > src)) { flag_N = res >> 8; - execute_exception(M68K_CHK_EX); + SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR)); } POST_IO RET(16) @@ -26983,7 +26935,7 @@ OPCODE(0x80C0) src = DREGu16((Opcode >> 0) & 7); if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV RET(140) #else @@ -27031,7 +26983,7 @@ OPCODE(0x80D0) READ_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV RET(144) #else @@ -27080,7 +27032,7 @@ OPCODE(0x80D8) READ_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV RET(144) #else @@ -27129,7 +27081,7 @@ OPCODE(0x80E0) READ_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV RET(146) #else @@ -27178,7 +27130,7 @@ OPCODE(0x80E8) READ_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV RET(148) #else @@ -27227,7 +27179,7 @@ OPCODE(0x80F0) READ_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV RET(150) #else @@ -27275,7 +27227,7 @@ OPCODE(0x80F8) READ_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV RET(148) #else @@ -27323,7 +27275,7 @@ OPCODE(0x80F9) READ_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV RET(162) #else @@ -27372,7 +27324,7 @@ OPCODE(0x80FA) READ_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV RET(148) #else @@ -27421,7 +27373,7 @@ OPCODE(0x80FB) READ_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV RET(160) #else @@ -27467,7 +27419,7 @@ OPCODE(0x80FC) FETCH_WORD(src); if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV RET(144) #else @@ -27516,7 +27468,7 @@ OPCODE(0x80DF) READ_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV RET(144) #else @@ -27565,7 +27517,7 @@ OPCODE(0x80E7) READ_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV RET(146) #else @@ -27611,7 +27563,7 @@ OPCODE(0x81C0) src = (s32)DREGs16((Opcode >> 0) & 7); if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV goto end81C0; #endif @@ -27667,7 +27619,7 @@ OPCODE(0x81D0) READSX_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV goto end81D0; #endif @@ -27724,7 +27676,7 @@ OPCODE(0x81D8) READSX_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV goto end81D8; #endif @@ -27781,7 +27733,7 @@ OPCODE(0x81E0) READSX_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV goto end81E0; #endif @@ -27838,7 +27790,7 @@ OPCODE(0x81E8) READSX_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV goto end81E8; #endif @@ -27895,7 +27847,7 @@ OPCODE(0x81F0) READSX_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV goto end81F0; #endif @@ -27951,7 +27903,7 @@ OPCODE(0x81F8) READSX_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV goto end81F8; #endif @@ -28007,7 +27959,7 @@ OPCODE(0x81F9) READSX_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV goto end81F9; #endif @@ -28064,7 +28016,7 @@ OPCODE(0x81FA) READSX_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV goto end81FA; #endif @@ -28121,7 +28073,7 @@ OPCODE(0x81FB) READSX_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV goto end81FB; #endif @@ -28175,7 +28127,7 @@ OPCODE(0x81FC) FETCH_SWORD(src); if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV goto end81FC; #endif @@ -28232,7 +28184,7 @@ OPCODE(0x81DF) READSX_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV goto end81DF; #endif @@ -28289,7 +28241,7 @@ OPCODE(0x81E7) READSX_WORD_F(adr, src) if (src == 0) { - execute_exception(M68K_ZERO_DIVIDE_EX); + SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR)); #ifdef USE_CYCLONE_TIMING_DIV goto end81E7; #endif