r8map[i] = ar8, r16map[i] = ar16, w8map[i] = aw8, w16map[i] = aw16;\r
}\r
\r
+u32 PicoRead16_floating(u32 a)\r
+{\r
+ // faking open bus\r
+ u32 d = (Pico.m.rotate += 0x41);\r
+ d ^= (d << 5) ^ (d << 8);\r
+ if ((a & 0xff0000) == 0xa10000) d = 0; // MegaCD pulldowns don't work here curiously\r
+ return (PicoIn.AHW & PAHW_MCD) ? 0x00 : d; // pulldown if MegaCD2 attached\r
+}\r
+\r
static u32 m68k_unmapped_read8(u32 a)\r
{\r
elprintf(EL_UIO, "m68k unmapped r8 [%06x] @%06x", a, SekPc);\r
- return (PicoIn.AHW & PAHW_MCD) ? 0x00 : 0xff; // pulldown if MegaCD2 attached\r
+ return (u8)PicoRead16_floating(a);\r
}\r
\r
static u32 m68k_unmapped_read16(u32 a)\r
{\r
elprintf(EL_UIO, "m68k unmapped r16 [%06x] @%06x", a, SekPc);\r
- return (PicoIn.AHW & PAHW_MCD) ? 0x00 : 0xffff;\r
+ return PicoRead16_floating(a);\r
}\r
\r
static void m68k_unmapped_write8(u32 a, u32 d)\r
// TODO: verify mirrors VDP and bank reg (bank area mirroring verified)\r
static u32 PicoRead8_z80(u32 a)\r
{\r
- u32 d = 0xff;\r
+ u32 d;\r
if ((Pico.m.z80Run | Pico.m.z80_reset | (z80_cycles_from_68k() < Pico.t.z80c_cnt)) &&\r
!(PicoIn.quirks & PQUIRK_NO_Z80_BUS_LOCK)) {\r
elprintf(EL_ANOMALY, "68k z80 read with no bus! [%06x] @ %06x", a, SekPc);\r
- // open bus. Pulled down if MegaCD2 is attached.\r
- return (PicoIn.AHW & PAHW_MCD ? 0 : d);\r
+ return (u8)PicoRead16_floating(a);\r
}\r
SekCyclesBurnRun(1);\r
\r
d = PicoMem.zram[a & 0x1fff];\r
} else if ((a & 0x6000) == 0x4000) // 0x4000-0x5fff\r
d = ym2612_read_local_68k(); \r
- else\r
+ else {\r
elprintf(EL_UIO|EL_ANOMALY, "68k bad read [%06x] @%06x", a, SekPc);\r
+ d = (u8)PicoRead16_floating(a);\r
+ }\r
return d;\r
}\r
\r
goto end;\r
}\r
\r
- // faking open bus (MegaCD pulldowns don't work here curiously)\r
- d = Pico.m.rotate++;\r
- d ^= d << 6;\r
+ d = PicoRead16_floating(a);\r
\r
if ((a & 0xfc00) == 0x1000) {\r
if ((a & 0xff01) == 0x1100) { // z80 busreq (verified)\r
goto end;\r
}\r
\r
- // faking open bus\r
- d = (Pico.m.rotate += 0x41);\r
- d ^= (d << 5) ^ (d << 8);\r
+ d = PicoRead16_floating(a);\r
\r
// bit8 seems to be readable in this range\r
if ((a & 0xfc00) == 0x1000) {\r
// TODO: verify if lower byte goes to PSG on word writes\r
u32 PicoRead8_vdp(u32 a)\r
{\r
- u32 d = 0;\r
+ u32 d;\r
if ((a & 0x00f0) == 0x0000) {\r
switch (a & 0x0d)\r
{\r
case 0x0c: d = PicoVideoRead8HV_H(0); break;\r
case 0x09:\r
case 0x0d: d = PicoVideoRead8HV_L(0); break;\r
+ default: d = (u8)PicoRead16_floating(a); break;\r
}\r
- } else\r
+ } else {\r
elprintf(EL_UIO|EL_ANOMALY, "68k bad read [%06x] @%06x", a, SekPc);\r
+ d = (u8)PicoRead16_floating(a);\r
+ }\r
return d;\r
}\r
\r