asm code updated, Bass Masters fix
[picodrive.git] / Pico / VideoPort.c
index 62f487a..59a57b2 100644 (file)
@@ -370,19 +370,24 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d)
       {\r
         // Register write:\r
         int num=(d>>8)&0x1f;\r
-        if(num==00) elprintf(EL_INTSW, "hint_onoff: %i->%i [%i] pend=%i @ %06x", (pvid->reg[0]&0x10)>>4,\r
+        int dold=pvid->reg[num];\r
+        if (num > 0x0a && !(pvid->reg[1]&4)) {\r
+          elprintf(EL_ANOMALY, "%02x written to reg %02x in SMS mode @ %06x", d, num, SekPc);\r
+        } else\r
+         pvid->reg[num]=(unsigned char)d;\r
+        if (num==00) elprintf(EL_INTSW, "hint_onoff: %i->%i [%i] pend=%i @ %06x", (dold&0x10)>>4,\r
                         (d&0x10)>>4, SekCyclesDone(), (pvid->pending_ints&0x10)>>4, SekPc);\r
-        if(num==01) elprintf(EL_INTSW, "vint_onoff: %i->%i [%i] pend=%i @ %06x", (pvid->reg[1]&0x20)>>5,\r
+        if (num==01) elprintf(EL_INTSW, "vint_onoff: %i->%i [%i] pend=%i @ %06x", (dold&0x20)>>5,\r
                         (d&0x20)>>5, SekCyclesDone(), (pvid->pending_ints&0x20)>>5, SekPc);\r
-        //if(num==01) dprintf("set_blank: %i @ %06x [%i|%i]", !((d&0x40)>>6), SekPc, Pico.m.scanline, SekCyclesDone());\r
-        //if(num==10) dprintf("hint_set: %i @ %06x [%i|%i]", (unsigned char)d, SekPc, Pico.m.scanline, SekCyclesDone());\r
-        pvid->reg[num]=(unsigned char)d;\r
+        if      (num ==   5 && (d^dold)) rendstatus|=1;\r
+        // renderers should update their palettes if sh/hi mode is changed\r
+        else if (num == 0xc && ((d^dold)&8)) Pico.m.dirtyPal = 2;\r
 #ifndef EMU_CORE_DEBUG\r
         // update IRQ level (Lemmings, Wiz 'n' Liz intro, ... )\r
         // may break if done improperly:\r
         // International Superstar Soccer Deluxe (crash), Street Racer (logos), Burning Force (gfx),\r
         // Fatal Rewind (crash), Sesame Street Counting Cafe\r
-        if (num < 2)\r
+        else if (num < 2)\r
         {\r
           if (!SekShouldInterrupt) // hack\r
           {\r
@@ -396,10 +401,7 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d)
             if (irq) SekEndRun(24); // make it delayed\r
           }\r
         }\r
-        else\r
 #endif\r
-        if(num == 5) rendstatus|=1;\r
-        else if(num == 0xc) Pico.m.dirtyPal = 2; // renderers should update their palettes if sh/hi mode is changed\r
         pvid->type=0; // register writes clear command (else no Sega logo in Golden Axe II)\r
       } else {\r
         // High word of command:\r