diff --git a/HISTORY.txt b/HISTORY.txt index 8e9c29c..046f62a 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -118,7 +118,7 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke) [Core/CPU] --------------- * added Z80 wait-states on 68k bus access (fixes Remute Red Eyes demo) -* improved 68k auto-vectored interrupts acknowledge cycle timing accuracy (Bubsy background color corruption during cutscenes) +* improved 68k auto-vectored interrupts acknowledge cycle timing accuracy (fixes Bubsy background color corruption during cutscenes & Pacman 2 - New Adventures crashes during Pac-Jr minigame levels transitions) * improved 68k MOVEM instruction accuracy (implements extra read cycle from memory as verified on real hardware) * fixed 68k undocumented behaviors for ABCD/SBCD/NBCD instructions (thanks to Flamewing for his test ROM) * fixed 68k timing of BTST Dn,#Imm instruction (verified by Flamewing in original microcode) diff --git a/builds/genesis_plus_gx_libretro.dll b/builds/genesis_plus_gx_libretro.dll index 0921c6f..1a4c065 100644 Binary files a/builds/genesis_plus_gx_libretro.dll and b/builds/genesis_plus_gx_libretro.dll differ diff --git a/builds/genplus_cube.dol b/builds/genplus_cube.dol index f6dbc89..640275d 100644 Binary files a/builds/genplus_cube.dol and b/builds/genplus_cube.dol differ diff --git a/builds/genplus_wii.dol b/builds/genplus_wii.dol index 8911950..3639a23 100644 Binary files a/builds/genplus_wii.dol and b/builds/genplus_wii.dol differ diff --git a/core/m68k/m68kcpu.h b/core/m68k/m68kcpu.h index f972c85..23db598 100644 --- a/core/m68k/m68kcpu.h +++ b/core/m68k/m68kcpu.h @@ -616,13 +616,13 @@ static const uint16 m68ki_exception_cycle_table[256] = 4*MUL, /* 22: RESERVED */ 4*MUL, /* 23: RESERVED */ 44*MUL, /* 24: Spurious Interrupt */ - 54*MUL, /* 25: Level 1 Interrupt Autovector */ - 54*MUL, /* 26: Level 2 Interrupt Autovector */ - 54*MUL, /* 27: Level 3 Interrupt Autovector */ - 54*MUL, /* 28: Level 4 Interrupt Autovector */ - 54*MUL, /* 29: Level 5 Interrupt Autovector */ - 54*MUL, /* 30: Level 6 Interrupt Autovector */ - 54*MUL, /* 31: Level 7 Interrupt Autovector */ + 44*MUL, /* 25: Level 1 Interrupt Autovector */ + 44*MUL, /* 26: Level 2 Interrupt Autovector */ + 44*MUL, /* 27: Level 3 Interrupt Autovector */ + 44*MUL, /* 28: Level 4 Interrupt Autovector */ + 44*MUL, /* 29: Level 5 Interrupt Autovector */ + 44*MUL, /* 30: Level 6 Interrupt Autovector */ + 44*MUL, /* 31: Level 7 Interrupt Autovector */ 34*MUL, /* 32: TRAP #0 -- ASG: chanaged from 38 */ 34*MUL, /* 33: TRAP #1 */ 34*MUL, /* 34: TRAP #2 */ @@ -1374,6 +1374,11 @@ INLINE void m68ki_exception_address_error(void) } #endif +/* See MC68000 User Manual appendix B for autovectors interrupts processing time */ +/* 44 cycles + N wait-state cycles where N depends on CPU clock alignement with internal E clock (corresponding to CPU clock / 10) when interrupt ack cycle starts */ +/* N minimal/maximal values are 6..15 cycles according to manual but real hardware measure apparently indicate 5..14 cycles (cf https://gendev.spritesmind.net/forum/viewtopic.php?f=2&t=2202&p=27485) */ +static uint m68ki_cycle_interrupts[10] = {50*MUL, 59*MUL, 58*MUL, 57*MUL, 56*MUL, 55*MUL, 54*MUL, 53*MUL, 52*MUL, 51*MUL}; + /* Service an interrupt request and start exception processing */ INLINE void m68ki_exception_interrupt(uint int_level) { @@ -1416,7 +1421,7 @@ INLINE void m68ki_exception_interrupt(uint int_level) m68ki_jump(new_pc); /* Update cycle count now */ - USE_CYCLES(CYC_EXCEPTION[vector]); + USE_CYCLES(m68ki_cycle_interrupts[(m68ki_cpu.cycles / MUL) % 10]); } /* ASG: Check for interrupts */