X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=cpu%2Ffame%2Ffamec_opcodes.h;h=551d7571c3f3a7355c233a4394c33f9ac205e84b;hb=3cf9570bacd8952713106a2a2e3176852d811d18;hp=e1e1e4511ecdad3c26d8622b26965ac82f89ada5;hpb=c060a9ab9c428e1ed9c4159b56529a2a36031e44;p=picodrive.git diff --git a/cpu/fame/famec_opcodes.h b/cpu/fame/famec_opcodes.h index e1e1e45..551d757 100644 --- a/cpu/fame/famec_opcodes.h +++ b/cpu/fame/famec_opcodes.h @@ -19263,8 +19263,7 @@ OPCODE(0x4E72) ASP = res; } m68kcontext.execinfo |= FM68K_HALTED; - m68kcontext.io_cycle_counter = 0; -RET(4) +RET0() } // RTE @@ -39962,6 +39961,15 @@ RET(14) } #ifdef PICODRIVE_HACK +#if 0 +#define UPDATE_IDLE_COUNT { \ + extern int idle_hit_counter; \ + idle_hit_counter++; \ +} +#else +#define UPDATE_IDLE_COUNT +#endif + // BRA OPCODE(0x6001_idle) { @@ -39974,12 +39982,8 @@ OPCODE(0x6001_idle) #else PC += ((s8)(Opcode & 0xFE)) >> 1; #endif - { - extern int idle_hit_counter; - idle_hit_counter++; - } - m68kcontext.io_cycle_counter = 10; -RET(10) + UPDATE_IDLE_COUNT +RET0() } // BCC @@ -39987,10 +39991,10 @@ OPCODE(0x6601_idle) { if (flag_NotZ) { - extern int idle_hit_counter; - idle_hit_counter++; + UPDATE_IDLE_COUNT PC += ((s8)(Opcode & 0xFE)) >> 1; - m68kcontext.io_cycle_counter = 8; + //if (idle_hit) + RET0() } RET(8) } @@ -39999,17 +40003,17 @@ OPCODE(0x6701_idle) { if (!flag_NotZ) { - extern int idle_hit_counter; - idle_hit_counter++; + UPDATE_IDLE_COUNT PC += ((s8)(Opcode & 0xFE)) >> 1; - m68kcontext.io_cycle_counter = 8; + //if (idle_hit) + RET0() } RET(8) } extern int SekIsIdleCode(unsigned short *dst, int bytes); -extern int SekRegisterIdlePatch(unsigned int pc, int oldop, int newop); +extern int SekRegisterIdlePatch(unsigned int pc, int oldop, int newop, void *ctx); OPCODE(idle_detector_bcc8) { @@ -40028,18 +40032,22 @@ OPCODE(idle_detector_bcc8) ret = SekIsIdleCode(dest_pc, bytes); newop = (Opcode & 0xfe) | 0x7100; if (!ret) newop |= 0x200; - if (Opcode & 0x0100) newop |= 0x400; // beq + if ( Opcode & 0x0100) newop |= 0x400; // beq + if (!(Opcode & 0x0f00)) newop |= 0xc00; // bra - ret = SekRegisterIdlePatch(GET_PC - 2, Opcode, newop); + ret = SekRegisterIdlePatch(GET_PC - 2, Opcode, newop, &m68kcontext); switch (ret) { case 0: PC[-1] = newop; break; case 1: break; - case 2: JumpTable[Opcode] = (Opcode & 0x0100) ? CAST_OP(0x6701) : CAST_OP(0x6601); break; + case 2: JumpTable[Opcode] = (Opcode & 0x0f00) ? + ((Opcode & 0x0100) ? CAST_OP(0x6701) : CAST_OP(0x6601)) : + CAST_OP(0x6001); break; } end: - cond_true = (Opcode & 0x0100) ? !flag_NotZ : flag_NotZ; // beq? + if ((Opcode & 0xff00) == 0x6000) cond_true = 1; + else cond_true = (Opcode & 0x0100) ? !flag_NotZ : flag_NotZ; // beq? if (cond_true) { PC = dest_pc; @@ -40048,14 +40056,4 @@ end: RET(8) } -OPCODE(idle_detector_dead) -{ - // patch without further questions - int newop = 0x7d00 | (Opcode & 0xff); - PC[-1] = newop; - SekRegisterIdlePatch(GET_PC - 2, Opcode, newop); - - PC += ((s8)(Opcode & 0xFE)) >> 1; -RET(10) -} #endif // PICODRIVE_HACK