32x: improved lockstep mode, allows compatibility over 50%
[picodrive.git] / pico / 32x / draw.c
index 7e0911e..e59fabb 100644 (file)
@@ -42,6 +42,10 @@ void FinalizeLine32xRGB555(int sh, int line)
   if ((Pico32x.vdp_regs[0] & P32XV_Mx) == 0)
     return; // blanking
 
+  // XXX: how is 32col mode hadled by real hardware?
+  if (!(Pico.video.reg[12] & 1))
+    return;
+
   if (!(PicoDrawMask & PDRAW_32X_ON))
     return;
 
@@ -79,7 +83,13 @@ void FinalizeLine32xRGB555(int sh, int line)
     }
   }
   else { // Run Length Mode
-
+    unsigned short len, t;
+    for (i = 320; i > 0; ps++) {
+      t = pal[*ps & 0xff];
+      for (len = (*ps >> 8) + 1; len > 0 && i > 0; len--, i--, pd++, pb++)
+        if (*pb == 0 || (t & 0x20))
+          *pd = t;
+    }
   }
 }