//if ((Pico_mcd->s68k_regs[3]&2) != (d&2)) dprintf("m68k: %s", (d&4) ? ((d&2) ? "word swap req" : "noop?") :\r
// ((d&2) ? "word ram to s68k" : "word ram to m68k"));\r
d |= Pico_mcd->s68k_regs[3]&0x1d;\r
- if (d & 2) d &= ~1; // returning word RAM to s68k\r
+ if (!(d & 4) && (d & 2)) d &= ~1; // return word RAM to s68k in 2M mode\r
Pico_mcd->s68k_regs[3] = d; // really use s68k side register\r
return;\r
case 0xe:\r
return; // only m68k can change WP\r
case 3:\r
d &= 0x1d;\r
- d |= Pico_mcd->s68k_regs[3]&0xc2;\r
- if (d&1) d &= ~2; // returning word RAM to m68k\r
+ if (d&4) {\r
+ d |= Pico_mcd->s68k_regs[3]&0xc2;\r
+ if ((d ^ Pico_mcd->s68k_regs[3]) & 5) d &= ~2; // in case of mode or bank change we clear DMNA (m68k req) bit\r
+ } else {\r
+ d |= Pico_mcd->s68k_regs[3]&0xc3;\r
+ if (d&1) d &= ~2; // return word RAM to m68k in 2M mode\r
+ }\r
break;\r
case 4:\r
dprintf("s68k CDC dest: %x", d&7);\r
goto end;\r
}\r
\r
+ // word RAM\r
+ if ((a&0xfc0000)==0x200000) {\r
+ dprintf("m68k_wram r8: [%06x] @%06x", a, SekPc);\r
+ if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
+ // TODO\r
+ } else {\r
+ // allow access in any mode, like Gens does\r
+ d = Pico_mcd->word_ram[(a^1)&0x3ffff];\r
+ }\r
+ dprintf("ret = %02x", (u8)d);\r
+ goto end;\r
+ }\r
+\r
if ((a&0xff4000)==0xa00000) { d=z80Read8(a); goto end; } // Z80 Ram\r
\r
if ((a&0xffffc0)==0xa12000)\r
goto end;\r
}\r
\r
+ // word RAM\r
+ if ((a&0xfc0000)==0x200000) {\r
+ dprintf("m68k_wram r16: [%06x] @%06x", a, SekPc);\r
+ if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
+ // TODO\r
+ } else {\r
+ // allow access in any mode, like Gens does\r
+ d = *(u16 *)(Pico_mcd->word_ram+(a&0x3fffe));\r
+ }\r
+ dprintf("ret = %04x", d);\r
+ goto end;\r
+ }\r
+\r
if ((a&0xffffc0)==0xa12000)\r
dprintf("m68k_regs r16: [%02x] @%06x", a&0x3f, SekPc);\r
\r
goto end;\r
}\r
\r
+ // word RAM\r
+ if ((a&0xfc0000)==0x200000) {\r
+ dprintf("m68k_wram r32: [%06x] @%06x", a, SekPc);\r
+ if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
+ // TODO\r
+ } else {\r
+ // allow access in any mode, like Gens does\r
+ u16 *pm=(u16 *)(Pico_mcd->word_ram+(a&0x3fffe)); d = (pm[0]<<16)|pm[1];\r
+ }\r
+ dprintf("ret = %08x", d);\r
+ goto end;\r
+ }\r
+\r
if ((a&0xffffc0)==0xa12000)\r
dprintf("m68k_regs r32: [%02x] @%06x", a&0x3f, SekPc);\r
\r
return;\r
}\r
\r
+ // word RAM\r
+ if ((a&0xfc0000)==0x200000) {\r
+ dprintf("m68k_wram w8: [%06x] %02x @%06x", a, d, SekPc);\r
+ if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
+ // TODO\r
+ } else {\r
+ // allow access in any mode, like Gens does\r
+ u8 *pm=(u8 *)(Pico_mcd->word_ram+((a^1)&0x3ffff));\r
+ *pm=d;\r
+ }\r
+ return;\r
+ }\r
+\r
if ((a&0xffffc0)==0xa12000)\r
dprintf("m68k_regs w8: [%02x] %02x @%06x", a&0x3f, d, SekPc);\r
\r
return;\r
}\r
\r
+ // word RAM\r
+ if ((a&0xfc0000)==0x200000) {\r
+ dprintf("m68k_wram w16: [%06x] %04x @%06x", a, d, SekPc);\r
+ if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
+ // TODO\r
+ } else {\r
+ // allow access in any mode, like Gens does\r
+ *(u16 *)(Pico_mcd->word_ram+(a&0x3fffe))=d;\r
+ }\r
+ return;\r
+ }\r
+\r
if ((a&0xffffc0)==0xa12000)\r
dprintf("m68k_regs w16: [%02x] %04x @%06x", a&0x3f, d, SekPc);\r
\r
}\r
\r
// word RAM\r
- if (a!=0x200000 && (a&0xfc0000)==0x200000) // tmp hack\r
+ if ((a&0xfc0000)==0x200000) {\r
+ if (d != 0) // don't log clears\r
+ dprintf("m68k_wram w32: [%06x] %08x @%06x", a, d, SekPc);\r
+ if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
+ // TODO\r
+ } else {\r
+ // allow access in any mode, like Gens does\r
+ u16 *pm=(u16 *)(Pico_mcd->word_ram+(a&0x3fffe));\r
+ pm[0]=(u16)(d>>16); pm[1]=(u16)d;\r
+ }\r
return;\r
-\r
+ }\r
\r
if ((a&0xffffc0)==0xa12000)\r
dprintf("m68k_regs w32: [%02x] %08x @%06x", a&0x3f, d, SekPc);\r
goto end;\r
}\r
\r
+ // word RAM (2M area)\r
+ if ((a&0xfc0000)==0x080000) { // 080000-0bffff\r
+ dprintf("s68k_wram2M r8: [%06x] @%06x", a, SekPc);\r
+ if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
+ // TODO (decode)\r
+ dprintf("(decode)");\r
+ } else {\r
+ // allow access in any mode, like Gens does\r
+ d = Pico_mcd->word_ram[(a^1)&0x3ffff];\r
+ }\r
+ dprintf("ret = %02x", (u8)d);\r
+ goto end;\r
+ }\r
+\r
+ // word RAM (1M area)\r
+ if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff\r
+ dprintf("s68k_wram1M r8: [%06x] @%06x", a, SekPc);\r
+ // TODO\r
+ goto end;\r
+ }\r
+\r
dprintf("s68k r8 : %06x, %02x @%06x", a&0xffffff, (u8)d, SekPcS68k);\r
\r
end:\r
goto end;\r
}\r
\r
+ // word RAM (2M area)\r
+ if ((a&0xfc0000)==0x080000) { // 080000-0bffff\r
+ dprintf("s68k_wram2M r16: [%06x] @%06x", a, SekPc);\r
+ if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
+ // TODO (decode)\r
+ dprintf("(decode)");\r
+ } else {\r
+ // allow access in any mode, like Gens does\r
+ d = *(u16 *)(Pico_mcd->word_ram+(a&0x3fffe));\r
+ }\r
+ dprintf("ret = %04x", (u8)d);\r
+ goto end;\r
+ }\r
+\r
+ // word RAM (1M area)\r
+ if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff\r
+ dprintf("s68k_wram1M r16: [%06x] @%06x", a, SekPc);\r
+ // TODO\r
+ goto end;\r
+ }\r
+\r
dprintf("s68k r16: %06x, %04x @%06x", a&0xffffff, d, SekPcS68k);\r
\r
end:\r
goto end;\r
}\r
\r
+ // word RAM (2M area)\r
+ if ((a&0xfc0000)==0x080000) { // 080000-0bffff\r
+ dprintf("s68k_wram2M r32: [%06x] @%06x", a, SekPc);\r
+ if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
+ // TODO (decode)\r
+ dprintf("(decode)");\r
+ } else {\r
+ // allow access in any mode, like Gens does\r
+ u16 *pm=(u16 *)(Pico_mcd->word_ram+(a&0x3fffe)); d = (pm[0]<<16)|pm[1];\r
+ }\r
+ dprintf("ret = %08x", (u8)d);\r
+ goto end;\r
+ }\r
+\r
+ // word RAM (1M area)\r
+ if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff\r
+ dprintf("s68k_wram1M 32: [%06x] @%06x", a, SekPc);\r
+ // TODO\r
+ goto end;\r
+ }\r
+\r
dprintf("s68k r32: %06x, %08x @%06x", a&0xffffff, d, SekPcS68k);\r
\r
end:\r
return;\r
}\r
\r
+ // word RAM (2M area)\r
+ if ((a&0xfc0000)==0x080000) { // 080000-0bffff\r
+ dprintf("s68k_wram2M w8: [%06x] %02x @%06x", a, d, SekPc);\r
+ if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
+ // TODO (decode)\r
+ dprintf("(decode)");\r
+ } else {\r
+ // allow access in any mode, like Gens does\r
+ u8 *pm=(u8 *)(Pico_mcd->word_ram+((a^1)&0x3ffff));\r
+ *pm=d;\r
+ }\r
+ return;\r
+ }\r
+\r
+ // word RAM (1M area)\r
+ if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff\r
+ if (d)\r
+ dprintf("s68k_wram1M w8: [%06x] %02x @%06x", a, d, SekPc);\r
+ // TODO\r
+ return;\r
+ }\r
+\r
dprintf("s68k w8 : %06x, %02x @%06x", a&0xffffff, d, SekPcS68k);\r
}\r
\r
return;\r
}\r
\r
+ // word RAM (2M area)\r
+ if ((a&0xfc0000)==0x080000) { // 080000-0bffff\r
+ dprintf("s68k_wram2M w16: [%06x] %04x @%06x", a, d, SekPc);\r
+ if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
+ // TODO (decode)\r
+ dprintf("(decode)");\r
+ } else {\r
+ // allow access in any mode, like Gens does\r
+ *(u16 *)(Pico_mcd->word_ram+(a&0x3fffe))=d;\r
+ }\r
+ return;\r
+ }\r
+\r
+ // word RAM (1M area)\r
+ if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff\r
+ if (d)\r
+ dprintf("s68k_wram1M w16: [%06x] %04x @%06x", a, d, SekPc);\r
+ // TODO\r
+ return;\r
+ }\r
+\r
dprintf("s68k w16: %06x, %04x @%06x", a&0xffffff, d, SekPcS68k);\r
}\r
\r
return;\r
}\r
\r
+ // word RAM (2M area)\r
+ if ((a&0xfc0000)==0x080000) { // 080000-0bffff\r
+ dprintf("s68k_wram2M w32: [%06x] %08x @%06x", a, d, SekPc);\r
+ if (Pico_mcd->s68k_regs[3]&4) { // 1M mode?\r
+ // TODO (decode)\r
+ dprintf("(decode)");\r
+ } else {\r
+ // allow access in any mode, like Gens does\r
+ u16 *pm=(u16 *)(Pico_mcd->word_ram+(a&0x3fffe));\r
+ pm[0]=(u16)(d>>16); pm[1]=(u16)d;\r
+ }\r
+ return;\r
+ }\r
+\r
+ // word RAM (1M area)\r
+ if ((a&0xfe0000)==0x0c0000 && (Pico_mcd->s68k_regs[3]&4)) { // 0c0000-0dffff\r
+ if (d)\r
+ dprintf("s68k_wram1M w32: [%06x] %08x @%06x", a, d, SekPc);\r
+ // TODO\r
+ return;\r
+ }\r
dprintf("s68k w32: %06x, %08x @%06x", a&0xffffff, d, SekPcS68k);\r
}\r
\r