u32 cycles, cnt = 0;\r
if (Pico_mcd->m.state_flags & (PCD_ST_S68K_POLL|PCD_ST_S68K_SLEEP))\r
return d;\r
- SekEndRunS68k(8);\r
\r
cycles = SekCyclesDoneS68k();\r
if (!SekNotPollingS68k && a == Pico_mcd->m.s68k_poll_a) {\r
Pico_mcd->m.state_flags &= ~PCD_ST_S68K_POLL;\r
if (cnt > POLL_LIMIT) {\r
Pico_mcd->m.state_flags |= PCD_ST_S68K_POLL;\r
+ SekEndRunS68k(8);\r
elprintf(EL_CDPOLL, "s68k poll detected @%06x, a=%02x",\r
SekPcS68k, a);\r
- }\r
+ } else if (cnt > 2)\r
+ SekEndRunS68k(80);\r
}\r
}\r
Pico_mcd->m.s68k_poll_a = a;\r
}\r
}\r
\r
-// if main or sub CPU accesses Word-RAM while it is assigned to the other CPU\r
+// if sub CPU accesses Word-RAM while it is assigned to the main CPU,\r
// GA doesn't assert DTACK, which means the CPU is blocked until the Word_RAM\r
// is reassigned to it (e.g. Mega Race).\r
-static u32 m68k_wordram_read8(u32 a)\r
+// since DTACK isn't on the expansion port, main cpu accesses are not blocked.\r
+// XXX is data read/written if main is accessing Word_RAM while not owning it?\r
+static u32 m68k_wordram_sub_read8(u32 a)\r
{\r
- Pico_mcd->m.state_flags |= PCD_ST_M68K_SLEEP;\r
- SekEndRun(0);\r
- return Pico_mcd->word_ram2M[MEM_BE2(a) & 0x3ffff];\r
+ return 0xff;\r
+// return Pico_mcd->word_ram2M[MEM_BE2(a) & 0x3ffff];\r
}\r
\r
-static u32 m68k_wordram_read16(u32 a)\r
+static u32 m68k_wordram_sub_read16(u32 a)\r
{\r
- Pico_mcd->m.state_flags |= PCD_ST_M68K_SLEEP;\r
- SekEndRun(0);\r
- return ((u16 *)Pico_mcd->word_ram2M)[(a >> 1) & 0x1ffff];\r
+ return 0xffff;\r
+// return ((u16 *)Pico_mcd->word_ram2M)[(a >> 1) & 0x1ffff];\r
}\r
\r
-static void m68k_wordram_write8(u32 a, u32 d)\r
+static void m68k_wordram_sub_write8(u32 a, u32 d)\r
{\r
- Pico_mcd->m.state_flags |= PCD_ST_M68K_SLEEP;\r
- SekEndRun(0);\r
- Pico_mcd->word_ram2M[MEM_BE2(a) & 0x3ffff] = d;\r
+// Pico_mcd->word_ram2M[MEM_BE2(a) & 0x3ffff] = d;\r
}\r
\r
-static void m68k_wordram_write16(u32 a, u32 d)\r
+static void m68k_wordram_sub_write16(u32 a, u32 d)\r
{\r
- Pico_mcd->m.state_flags |= PCD_ST_M68K_SLEEP;\r
- SekEndRun(0);\r
- ((u16 *)Pico_mcd->word_ram2M)[(a >> 1) & 0x1ffff] = d;\r
+// ((u16 *)Pico_mcd->word_ram2M)[(a >> 1) & 0x1ffff] = d;\r
}\r
\r
-static u32 s68k_wordram_read8(u32 a)\r
+static u32 s68k_wordram_main_read8(u32 a)\r
{\r
Pico_mcd->m.state_flags |= PCD_ST_S68K_SLEEP;\r
SekEndRunS68k(0);\r
return Pico_mcd->word_ram2M[MEM_BE2(a) & 0x3ffff];\r
}\r
\r
-static u32 s68k_wordram_read16(u32 a)\r
+static u32 s68k_wordram_main_read16(u32 a)\r
{\r
Pico_mcd->m.state_flags |= PCD_ST_S68K_SLEEP;\r
SekEndRunS68k(0);\r
return ((u16 *)Pico_mcd->word_ram2M)[(a >> 1) & 0x1ffff];\r
}\r
\r
-static void s68k_wordram_write8(u32 a, u32 d)\r
+static void s68k_wordram_main_write8(u32 a, u32 d)\r
{\r
Pico_mcd->m.state_flags |= PCD_ST_S68K_SLEEP;\r
SekEndRunS68k(0);\r
Pico_mcd->word_ram2M[MEM_BE2(a) & 0x3ffff] = d;\r
}\r
\r
-static void s68k_wordram_write16(u32 a, u32 d)\r
+static void s68k_wordram_main_write16(u32 a, u32 d)\r
{\r
Pico_mcd->m.state_flags |= PCD_ST_S68K_SLEEP;\r
SekEndRunS68k(0);\r
// 2M mode.\r
bank = Pico_mcd->word_ram2M;\r
if (r3 & 1) {\r
- Pico_mcd->m.state_flags &= ~PCD_ST_M68K_SLEEP;\r
cpu68k_map_all_ram(0x200000, 0x23ffff, bank, 0);\r
cpu68k_map_all_funcs(0x80000, 0xbffff,\r
- s68k_wordram_read8, s68k_wordram_read16,\r
- s68k_wordram_write8, s68k_wordram_write16, 1);\r
+ s68k_wordram_main_read8, s68k_wordram_main_read16,\r
+ s68k_wordram_main_write8, s68k_wordram_main_write16, 1);\r
} else {\r
Pico_mcd->m.state_flags &= ~PCD_ST_S68K_SLEEP;\r
cpu68k_map_all_ram(0x080000, 0x0bffff, bank, 1);\r
cpu68k_map_all_funcs(0x200000, 0x23ffff,\r
- m68k_wordram_read8, m68k_wordram_read16,\r
- m68k_wordram_write8, m68k_wordram_write16, 0);\r
+ m68k_wordram_sub_read8, m68k_wordram_sub_read16,\r
+ m68k_wordram_sub_write8, m68k_wordram_sub_write16, 0);\r
}\r
// TODO: handle 0x0c0000\r
}\r
else {\r
int b0 = r3 & 1;\r
int m = (r3 & 0x18) >> 3;\r
- Pico_mcd->m.state_flags &= ~(PCD_ST_M68K_SLEEP|PCD_ST_S68K_SLEEP);\r
+ Pico_mcd->m.state_flags &= ~PCD_ST_S68K_SLEEP;\r
bank = Pico_mcd->word_ram1M[b0];\r
cpu68k_map_all_ram(0x200000, 0x21ffff, bank, 0);\r
bank = Pico_mcd->word_ram1M[b0 ^ 1];\r