merge mappers from FCEU-mm
[fceu.git] / boards / 253.c
index 6e3b569..908897a 100644 (file)
  *\r
  * You should have received a copy of the GNU General Public License\r
  * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ * TODO: cram disable cases! (Shen Hua Jian Yun III cannot boot with CRAM enabled)\r
  */\r
 \r
 #include "mapinc.h"\r
 \r
-static uint8 chrlo[8], chrhi[8], prg[2], mirr, vlock;\r
-static int32 IRQa, IRQCount, IRQLatch, IRQClock; \r
+static uint8 chrlo[8], chrhi[8], prg[2], mirr;\r
+static int32 IRQa, IRQCount, IRQLatch, IRQClock;\r
 static uint8 *WRAM=NULL;\r
 static uint32 WRAMSIZE;\r
 static uint8 *CHRRAM=NULL;\r
@@ -29,11 +31,10 @@ static uint32 CHRRAMSIZE;
 \r
 static SFORMAT StateRegs[]=\r
 {\r
-  {chrlo, 8, "CHRLO"},\r
-  {chrhi, 8, "CHRHI"},\r
+  {chrlo, 8, "CHRL"},\r
+  {chrhi, 8, "CHRH"},\r
   {prg, 2, "PRGR"},\r
   {&mirr, 1, "MIRR"},\r
-  {&vlock, 1, "VLOCK"},\r
   {&IRQa, 4, "IRQA"},\r
   {&IRQCount, 4, "IRQC"},\r
   {&IRQLatch, 4, "IRQL"},\r
@@ -52,17 +53,7 @@ static void Sync(void)
   for(i=0; i<8; i++)\r
   {\r
     uint32 chr = chrlo[i]|(chrhi[i]<<8);\r
-    if(chrlo[i]==0xc8)\r
-    {\r
-      vlock = 0;\r
-      continue;\r
-    }\r
-    else if(chrlo[i]==0x88)\r
-    {\r
-      vlock = 1;\r
-      continue;\r
-    }\r
-    if(((chrlo[i]==4)||(chrlo[i]==5))&&!vlock)\r
+    if((chr==4)||(chr==5))\r
       setchr1r(0x10,i<<10,chr&1);\r
     else\r
       setchr1(i<<10,chr);\r
@@ -127,18 +118,18 @@ static void M253Close(void)
 \r
 static void M253IRQ(int cycles)\r
 {\r
-  if(IRQa&2) \r
+  if(IRQa&2)\r
   {\r
-    if((IRQClock+=cycles)>=0x72) \r
+    if((IRQClock+=cycles)>=0x71)\r
     {\r
-      IRQClock -= 0x72;\r
-      if(IRQCount==0xFF)  \r
+      IRQClock -= 0x71;\r
+      if(IRQCount==0xFF)\r
       {\r
         IRQCount = IRQLatch;\r
         IRQa = IRQa|((IRQa&1)<<1);\r
         X6502_IRQBegin(FCEU_IQEXT);\r
       }\r
-      else \r
+      else\r
         IRQCount++;\r
     }\r
   }\r