some irq hacks
[picodrive.git] / pico / videoport.c
index 072a941..22b8385 100644 (file)
@@ -357,10 +357,10 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d)
 {\r
   struct PicoVideo *pvid=&Pico.video;\r
 \r
-  //if (Pico.m.scanline < 224)\r
-  //  elprintf(EL_STATUS, "PicoVideoWrite [%06x] %04x", a, d);\r
-  a&=0x1c;\r
+  //elprintf(EL_STATUS, "PicoVideoWrite [%06x] %04x [%u] @ %06x",\r
+  //  a, d, SekCyclesDone(), SekPc);\r
 \r
+  a &= 0x1c;\r
   switch (a)\r
   {\r
   case 0x00: // Data port 0 or 2\r
@@ -383,8 +383,8 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d)
       pvid->lwrite_cnt -= use;\r
       if (pvid->lwrite_cnt < 0)\r
         SekCyclesLeft = 0;\r
-      elprintf(EL_ASVDP, "VDP data write: %04x [%06x] {%i} #%i @ %06x", d, Pico.video.addr,\r
-               Pico.video.type, pvid->lwrite_cnt, SekPc);\r
+      elprintf(EL_ASVDP, "VDP data write: [%04x] %04x [%u] {%i} #%i @ %06x",\r
+        Pico.video.addr, d, SekCyclesDone(), Pico.video.type, pvid->lwrite_cnt, SekPc);\r
     }\r
     VideoWrite(d);\r
 \r
@@ -451,14 +451,15 @@ update_irq:
         // update IRQ level\r
         if (!SekShouldInterrupt()) // hack\r
         {\r
-          int lines, pints, irq=0;\r
+          int lines, pints, irq = 0;\r
           lines = (pvid->reg[1] & 0x20) | (pvid->reg[0] & 0x10);\r
-          pints = (pvid->pending_ints&lines);\r
+          pints = pvid->pending_ints & lines;\r
                if (pints & 0x20) irq = 6;\r
           else if (pints & 0x10) irq = 4;\r
           SekInterrupt(irq); // update line\r
 \r
-          if (irq) SekEndRun(24); // make it delayed\r
+          // this is broken because cost of current insn isn't known here\r
+          if (irq) SekEndRun(21); // make it delayed\r
         }\r
 #endif\r
       }\r
@@ -521,7 +522,7 @@ PICO_INTERNAL_ASM unsigned int PicoVideoRead(unsigned int a)
 \r
     pv->pending = 0; // ctrl port reads clear write-pending flag (Charles MacDonald)\r
 \r
-    elprintf(EL_SR, "SR read: %04x @ %06x", d, SekPc);\r
+    elprintf(EL_SR, "SR read: %04x [%u] @ %06x", d, SekCyclesDone(), SekPc);\r
     return d;\r
   }\r
 \r