some support for vdp debug reg
[picodrive.git] / pico / videoport.c
index b14e70f..fe96139 100644 (file)
@@ -361,8 +361,9 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d)
   //  elprintf(EL_STATUS, "PicoVideoWrite [%06x] %04x", a, d);\r
   a&=0x1c;\r
 \r
-  if (a==0x00) // Data port 0 or 2\r
+  switch (a)\r
   {\r
+  case 0x00: // Data port 0 or 2\r
     // try avoiding the sync..\r
     if (Pico.m.scanline < 224 && (pvid->reg[1]&0x40) &&\r
         !(!pvid->pending &&\r
@@ -392,11 +393,9 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d)
     if ((pvid->command&0x80) && (pvid->reg[1]&0x10) && (pvid->reg[0x17]>>6)==2)\r
       DmaFill(d);\r
 \r
-    return;\r
-  }\r
+    break;\r
 \r
-  if (a==0x04) // Control (command) port 4 or 6\r
-  {\r
+  case 0x04: // Control (command) port 4 or 6\r
     if (pvid->pending)\r
     {\r
       // Low word of command:\r
@@ -473,6 +472,35 @@ update_irq:
         pvid->pending=1;\r
       }\r
     }\r
+    break;\r
+\r
+  // case 0x08: // 08 0a - HV counter - lock up\r
+  // case 0x0c: // 0c 0e - HV counter - lock up\r
+  // case 0x10: // 10 12 - PSG - handled by caller\r
+  // case 0x14: // 14 16 - PSG - handled by caller\r
+  // case 0x18: // 18 1a - no effect?\r
+  case 0x1c: // 1c 1e - debug\r
+    pvid->debug = d;\r
+    pvid->debug_p = 0;\r
+    if (d & (1 << 6)) {\r
+      pvid->debug_p |= PVD_KILL_A | PVD_KILL_B;\r
+      pvid->debug_p |= PVD_KILL_S_LO | PVD_KILL_S_HI;\r
+    }\r
+    switch ((d >> 7) & 3) {\r
+      case 1:\r
+        pvid->debug_p &= ~(PVD_KILL_S_LO | PVD_KILL_S_HI);\r
+        pvid->debug_p |= PVD_FORCE_S;\r
+        break;\r
+      case 2:\r
+        pvid->debug_p &= ~PVD_KILL_A;\r
+        pvid->debug_p |= PVD_FORCE_A;\r
+        break;\r
+      case 3:\r
+        pvid->debug_p &= ~PVD_KILL_B;\r
+        pvid->debug_p |= PVD_FORCE_B;\r
+        break;\r
+    }\r
+    break;\r
   }\r
 }\r
 \r