add 68k overclocking support

This commit is contained in:
notaz 2017-10-20 00:41:12 +03:00
parent 93f9619ed8
commit 35f2b65ef7
8 changed files with 33 additions and 2 deletions

View file

@ -96,6 +96,7 @@ typedef struct
unsigned short autoRgnOrder; // packed priority list of regions, for example 0x148 means this detection order: EUR, USA, JAP
unsigned short quirks; // game-specific quirks: PQUIRK_*
unsigned short overclockM68k; // overclock the emulated 68k, in %
} PicoInterface;
extern PicoInterface PicoIn;

View file

@ -81,7 +81,7 @@ static void do_timing_hacks_as(struct PicoVideo *pv, int vdp_slots)
static void do_timing_hacks_vb(void)
{
if (Pico.m.dma_xfers)
if (unlikely(Pico.m.dma_xfers))
SekCyclesBurn(CheckDMA());
}
@ -272,7 +272,7 @@ static int PicoFrameHints(void)
PAD_DELAY();
if ((pv->status & PVS_ACTIVE) && --hint < 0)
if (unlikely(pv->status & PVS_ACTIVE) && --hint < 0)
{
hint = pv->reg[10]; // Reload H-Int counter
do_hint(pv);
@ -287,6 +287,15 @@ static int PicoFrameHints(void)
pevt_log_m68k_o(EVT_NEXT_LINE);
}
if (unlikely(PicoIn.overclockM68k)) {
unsigned int l = PicoIn.overclockM68k * lines / 100;
while (l-- > 0) {
Pico.t.m68c_cnt -= CYCLES_M68K_LINE;
do_timing_hacks_vb();
SekSyncM68k();
}
}
pv->status &= ~(SR_VB | PVS_VB2);
pv->status |= ((pv->reg[1] >> 3) ^ SR_VB) & SR_VB; // forced blanking

View file

@ -10,9 +10,11 @@
#ifdef __GNUC__
#define NOINLINE __attribute__((noinline))
#define ALIGNED(n) __attribute__((aligned(n)))
#define unlikely(x) __builtin_expect((x), 0)
#else
#define NOINLINE
#define ALIGNED(n)
#define unlikely(x) (x)
#endif
#ifdef _MSC_VER