runs code in 1M wram, cell arrange, decode (untested)
[picodrive.git] / Pico / VideoPort.c
index e3643df..bb5fe4a 100644 (file)
@@ -8,6 +8,7 @@
 \r
 \r
 #include "PicoInt.h"\r
+#include "cd/gfx_cd.h"\r
 \r
 extern const unsigned char  hcounts_32[];\r
 extern const unsigned char  hcounts_40[];\r
@@ -98,25 +99,31 @@ static void DmaSlow(int len)
     pd=(u16 *)(Pico.ram+(source&0xfffe));\r
     pdend=(u16 *)(Pico.ram+0x10000);\r
   } else if(PicoMCD & 1) {\r
-    dprintf("DmaSlow CD");\r
+    dprintf("DmaSlow CD, r3=%02x", Pico_mcd->s68k_regs[3]);\r
     if(source<0x20000) { // Bios area\r
       pd=(u16 *)(Pico_mcd->bios+(source&~1));\r
       pdend=(u16 *)(Pico_mcd->bios+0x20000);\r
-    } else if ((source&0xfc0000)==0x200000 && (!(Pico_mcd->s68k_regs[3]&4))) { // Word Ram\r
+    } else if ((source&0xfc0000)==0x200000) { // Word Ram\r
+      source -= 2;\r
       if (!(Pico_mcd->s68k_regs[3]&4)) { // 2M mode\r
-        source -= 2;\r
-        pd=(u16 *)(Pico_mcd->word_ram+(source&0x3fffe));\r
-        pdend=(u16 *)(Pico_mcd->word_ram+0x40000);\r
+        pd=(u16 *)(Pico_mcd->word_ram2M+(source&0x3fffe));\r
+        pdend=(u16 *)(Pico_mcd->word_ram2M+0x40000);\r
       } else {\r
-        dprintf("DmaSlow: unsupported src");\r
-       return;\r
+        if (source < 0x220000) { // 1M mode\r
+          int bank = Pico_mcd->s68k_regs[3]&1;\r
+          pd=(u16 *)(Pico_mcd->word_ram1M[bank]+(source&0x1fffe));\r
+          pdend=(u16 *)(Pico_mcd->word_ram1M[bank]+0x20000);\r
+       } else {\r
+          DmaSlowCell(source, a, len, inc);\r
+          return;\r
+       }\r
       }\r
     } else if ((source&0xfe0000)==0x020000) { // Prg Ram\r
       u8 *prg_ram = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6];\r
       pd=(u16 *)(prg_ram+(source&0x1fffe));\r
       pdend=(u16 *)(prg_ram+0x20000);\r
     } else {\r
-      dprintf("DmaSlow: unsupported src");\r
+      dprintf("DmaSlow FIXME: unsupported src");\r
       return;\r
     }\r
   } else {\r
@@ -142,8 +149,8 @@ static void DmaSlow(int len)
       if (inc == 2 && !(a&1) && a+len*2 < 0x10000)\r
       {\r
         // most used DMA mode\r
-       memcpy16(r + (a>>1), pd, len);\r
-       a += len*2;\r
+        memcpy16(r + (a>>1), pd, len);\r
+        a += len*2;\r
       }\r
       else\r
       {\r