cd: tweak the poll code further

This commit is contained in:
notaz 2013-09-05 01:09:17 +03:00
parent a4dfdb6de1
commit 30e8aac43f
2 changed files with 10 additions and 11 deletions

View file

@ -82,6 +82,9 @@ static __inline void SekRunS68k(unsigned int to)
if ((cyc_do = SekCycleAimS68k - SekCycleCntS68k) <= 0) if ((cyc_do = SekCycleAimS68k - SekCycleCntS68k) <= 0)
return; return;
if (SekShouldInterrupt())
Pico_mcd->m.s68k_poll_a = 0;
SekCycleCntS68k += cyc_do; SekCycleCntS68k += cyc_do;
#if defined(EMU_C68K) #if defined(EMU_C68K)
PicoCpuCS68k.cycles = cyc_do; PicoCpuCS68k.cycles = cyc_do;
@ -263,7 +266,7 @@ static void SekSyncM68k(void);
static inline void pcd_run_cpus_normal(int m68k_cycles) static inline void pcd_run_cpus_normal(int m68k_cycles)
{ {
SekCycleAim += m68k_cycles; SekCycleAim += m68k_cycles;
if (SekShouldInterrupt()) if (SekShouldInterrupt() || Pico_mcd->m.m68k_poll_cnt < 12)
Pico_mcd->m.m68k_poll_cnt = 0; Pico_mcd->m.m68k_poll_cnt = 0;
else if (Pico_mcd->m.m68k_poll_cnt >= 16) { else if (Pico_mcd->m.m68k_poll_cnt >= 16) {
int s68k_left = pcd_sync_s68k(SekCycleAim, 1); int s68k_left = pcd_sync_s68k(SekCycleAim, 1);

View file

@ -70,7 +70,7 @@ static void remap_word_ram(u32 r3);
// poller detection // poller detection
#define POLL_LIMIT 16 #define POLL_LIMIT 16
#define POLL_CYCLES 124 #define POLL_CYCLES 64
void m68k_comm_check(u32 a) void m68k_comm_check(u32 a)
{ {
@ -143,9 +143,6 @@ void m68k_reg_write8(u32 a, u32 d)
u32 dold; u32 dold;
a &= 0x3f; a &= 0x3f;
Pico_mcd->m.m68k_poll_a =
Pico_mcd->m.m68k_poll_cnt = 0;
switch (a) { switch (a) {
case 0: case 0:
d &= 1; d &= 1;
@ -230,18 +227,17 @@ write_comm:
if (d == Pico_mcd->s68k_regs[a]) if (d == Pico_mcd->s68k_regs[a])
return; return;
Pico_mcd->s68k_regs[a] = d;
pcd_sync_s68k(SekCyclesDone(), 0); pcd_sync_s68k(SekCyclesDone(), 0);
if (Pico_mcd->m.s68k_poll_a == a && Pico_mcd->m.s68k_poll_cnt > POLL_LIMIT) { Pico_mcd->s68k_regs[a] = d;
if (Pico_mcd->m.s68k_poll_a == (a & ~1)
&& Pico_mcd->m.s68k_poll_cnt > POLL_LIMIT)
{
SekSetStopS68k(0); SekSetStopS68k(0);
Pico_mcd->m.s68k_poll_a = 0; Pico_mcd->m.s68k_poll_a = 0;
elprintf(EL_CDPOLL, "s68k poll release, a=%02x", a); elprintf(EL_CDPOLL, "s68k poll release, a=%02x", a);
} }
} }
#ifndef _ASM_CD_MEMORY_C
static
#endif
u32 s68k_poll_detect(u32 a, u32 d) u32 s68k_poll_detect(u32 a, u32 d)
{ {
#ifdef USE_POLL_DETECT #ifdef USE_POLL_DETECT
@ -807,7 +803,7 @@ static u32 PicoReadS68k8_pr(u32 a)
a &= 0x1ff; a &= 0x1ff;
if (a >= 0x0e && a < 0x30) { if (a >= 0x0e && a < 0x30) {
d = Pico_mcd->s68k_regs[a]; d = Pico_mcd->s68k_regs[a];
s68k_poll_detect(a, d); s68k_poll_detect(a & ~1, d);
goto regs_done; goto regs_done;
} }
else if (a >= 0x58 && a < 0x68) else if (a >= 0x58 && a < 0x68)