sms, minor fixes
authorkub <derkub@gmail.com>
Thu, 21 Oct 2021 18:44:55 +0000 (20:44 +0200)
committerkub <derkub@gmail.com>
Thu, 21 Oct 2021 18:45:43 +0000 (20:45 +0200)
pico/mode4.c
pico/sms.c

index 9ed6341..c0327f9 100644 (file)
@@ -56,8 +56,8 @@ static void TileBGM4(u16 sx, int pal)
   pd[0] = pd[1] = pal * 0x01010101;
 }
 
-// 8 pixels are arranged are arranged in 4 bitplanes in a 32 bit word. To pull
-// the 4 bitplanes together multiply with each bit distance (multiples of 1<<7)
+// 8 pixels are arranged in 4 bitplane bytes in a 32 bit word. To pull the
+// 4 bitplanes together multiply with each bit distance (multiples of 1<<7)
 #define PLANAR_PIXELBG(x,p) \
   t = (pack>>(7-p)) & 0x01010101; \
   t = (t*0x10204080) >> 28; \
@@ -142,7 +142,7 @@ static void TileDoubleSprM4(int sx, unsigned int pack, int pal)
 static void DrawSpritesM4(int scanline)
 {
   struct PicoVideo *pv = &Pico.video;
-  unsigned char mb[256/8+2] = {0};
+  unsigned char mb[1+256/8+2] = {0}; // zoomed
   unsigned int sprites_addr[8];
   unsigned int sprites_x[8];
   unsigned int pack;
@@ -375,7 +375,7 @@ static void TileDoubleSprTMS(u16 sx, unsigned int pack, int pal)
 static void DrawSpritesTMS(int scanline)
 {
   struct PicoVideo *pv = &Pico.video;
-  unsigned char mb[256/8+2] = {0};
+  unsigned char mb[1+256/8+4] = {0}; // zoomed+doublesize
   unsigned int sprites_addr[4];
   unsigned int sprites_x[4];
   unsigned int pack;
index 765a0ae..6781342 100644 (file)
@@ -295,6 +295,7 @@ static void write_bank_sega(unsigned short a, unsigned char d)
 // 8KB ROM mapping for MSX mapper
 static void write_bank_msx(unsigned short a, unsigned char d)
 {
+  if (Pico.ms.mapper != 2 && (a|d) == 0) return;
   elprintf(EL_Z80BNK, "bank  8k %04x %02x @ %04x", a, d, z80_pc());
   Pico.ms.mapper = 2; // TODO define (more) mapper types
   Pico.ms.carthw[a] = d;
@@ -325,7 +326,7 @@ static void xwrite(unsigned int a, unsigned char d)
   if (a == 0xa000 && Pico.ms.mapper != 2)
     write_bank_sega(0xffff, d);
   // MSX. 4 selectable 8KB banks at the top
-  if (a <= 0x0003 && Pico.ms.mapper != 1 && (a|d))
+  if (a <= 0x0003 && Pico.ms.mapper != 1)
     write_bank_msx(a, d);
 }
 
@@ -476,15 +477,20 @@ void PicoFrameMS(void)
         if (pv->reg[0] & 0x10) {
           elprintf(EL_INTS, "hint");
           z80_int_assert(1);
-        }
+       }
+      } else if (pv->pending_ints & 2) {
+        pv->pending_ints &= ~2;
+        z80_int_assert(0);
       }
     }
     else if (y == lines_vis + 1) {
+      pv->pending_ints &= ~2;
       pv->pending_ints |= 1;
       if (pv->reg[1] & 0x20) {
         elprintf(EL_INTS, "vint");
         z80_int_assert(1);
-      }
+      } else
+        z80_int_assert(0);
     }
 
     cycles_aim += cycles_line;