mappers updated to 0.98.16
[fceu.git] / boards / h2288.c
index c2c6621..22bc7c2 100644 (file)
@@ -1,89 +1,89 @@
-/* FCE Ultra - NES/Famicom Emulator\r
- *\r
- * Copyright notice for this file:\r
- *  Copyright (C) 2005 CaH4e3\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- */\r
-\r
-#include "mapinc.h"\r
-#include "mmc3.h"\r
-\r
-extern uint8 m114_perm[8];\r
-\r
-static void H2288PW(uint32 A, uint8 V)\r
-{\r
-  if(EXPREGS[0]&0x40)\r
-  {\r
-    uint8 bank=(EXPREGS[0]&5)|((EXPREGS[0]&8)>>2)|((EXPREGS[0]&0x20)>>2);\r
-    if(EXPREGS[0]&2)\r
-      setprg32(0x8000,bank>>1);\r
-    else\r
-    {\r
-      setprg16(0x8000,bank);\r
-      setprg16(0xC000,bank);\r
-    }\r
-  }\r
-  else\r
-    setprg8(A,V&0x3F);\r
-}\r
-\r
-static DECLFW(H2288WriteHi)\r
-{\r
-  switch (A&0x8001)\r
-  {\r
-    case 0x8000: MMC3_CMDWrite(0x8000,(V&0xC0)|(m114_perm[V&7])); break;\r
-    case 0x8001: MMC3_CMDWrite(0x8001,V); break;\r
-  }\r
-}\r
-\r
-static DECLFW(H2288WriteLo)\r
-{\r
-  if(A&0x800)\r
-  {\r
-    if(A&1)\r
-      EXPREGS[1]=V;\r
-    else\r
-      EXPREGS[0]=V;\r
-    FixMMC3PRG(MMC3_cmd);\r
-  }\r
-}\r
-\r
-static DECLFR(H2288Read)\r
-{\r
-  int bit;\r
-  bit=(A&1)^1;\r
-  bit&=((A>>8)&1);\r
-  bit^=1;\r
-  return((X.DB&0xFE)|bit);\r
-}\r
-\r
-static void H2288Power(void)\r
-{\r
-  EXPREGS[0]=EXPREGS[1]=0;\r
-  GenMMC3Power();\r
-  SetReadHandler(0x5000,0x5FFF,H2288Read);\r
-  SetReadHandler(0x8000,0xFFFF,CartBR);\r
-  SetWriteHandler(0x5000,0x5FFF,H2288WriteLo);\r
-  SetWriteHandler(0x8000,0x8FFF,H2288WriteHi);\r
-}\r
-\r
-void UNLH2288_Init(CartInfo *info)\r
-{\r
-  GenMMC3_Init(info, 256, 256, 0, 0);\r
-  pwrap=H2288PW;\r
-  info->Power=H2288Power;\r
-  AddExState(EXPREGS, 2, 0, "EXPR");\r
-}\r
+/* FCE Ultra - NES/Famicom Emulator
+ *
+ * Copyright notice for this file:
+ *  Copyright (C) 2005 CaH4e3
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "mapinc.h"
+#include "mmc3.h"
+
+extern uint8 m114_perm[8];
+
+static void H2288PW(uint32 A, uint8 V)
+{
+  if(EXPREGS[0]&0x40)
+  {
+    uint8 bank=(EXPREGS[0]&5)|((EXPREGS[0]&8)>>2)|((EXPREGS[0]&0x20)>>2);
+    if(EXPREGS[0]&2)
+      setprg32(0x8000,bank>>1);
+    else
+    {
+      setprg16(0x8000,bank);
+      setprg16(0xC000,bank);
+    }
+  }
+  else
+    setprg8(A,V&0x3F);
+}
+
+static DECLFW(H2288WriteHi)
+{
+  switch (A&0x8001)
+  {
+    case 0x8000: MMC3_CMDWrite(0x8000,(V&0xC0)|(m114_perm[V&7])); break;
+    case 0x8001: MMC3_CMDWrite(0x8001,V); break;
+  }
+}
+
+static DECLFW(H2288WriteLo)
+{
+  if(A&0x800)
+  {
+    if(A&1)
+      EXPREGS[1]=V;
+    else
+      EXPREGS[0]=V;
+    FixMMC3PRG(MMC3_cmd);
+  }
+}
+
+static DECLFR(H2288Read)
+{
+  int bit;
+  bit=(A&1)^1;
+  bit&=((A>>8)&1);
+  bit^=1;
+  return((X.DB&0xFE)|bit);
+}
+
+static void H2288Power(void)
+{
+  EXPREGS[0]=EXPREGS[1]=0;
+  GenMMC3Power();
+  SetReadHandler(0x5000,0x5FFF,H2288Read);
+  SetReadHandler(0x8000,0xFFFF,CartBR);
+  SetWriteHandler(0x5000,0x5FFF,H2288WriteLo);
+  SetWriteHandler(0x8000,0x8FFF,H2288WriteHi);
+}
+
+void UNLH2288_Init(CartInfo *info)
+{
+  GenMMC3_Init(info, 256, 256, 0, 0);
+  pwrap=H2288PW;
+  info->Power=H2288Power;
+  AddExState(EXPREGS, 2, 0, "EXPR");
+}