merge mappers from FCEU-mm
[fceu.git] / boards / konami-qtai.c
index 83630a6..ab62e09 100644 (file)
@@ -1,7 +1,7 @@
 /* FCE Ultra - NES/Famicom Emulator\r
  *\r
  * Copyright notice for this file:\r
- *  Copyright (C) 2005-2008 CaH4e3\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
  *\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
+ * VRC-5 (CAI Shogakko no Sansu)\r
  *\r
- * CAI Shogakko no Sansu\r
  */\r
 \r
 #include "mapinc.h"\r
@@ -27,7 +28,7 @@ static writefunc old2007wrap;
 \r
 static uint16 CHRSIZE = 8192;\r
 static uint16 WRAMSIZE = 8192 + 4096;\r
-static uint8 *CHRRAM=NULL;\r
+static uint8 *CHRRAM = NULL;\r
 static uint8 *WRAM = NULL;\r
 \r
 static uint8 IRQa, K4IRQ;\r
@@ -40,7 +41,7 @@ static SFORMAT StateRegs[]=
   {&IRQCount, 1, "IRQC"},\r
   {&IRQLatch, 1, "IRQL"},\r
   {&IRQa, 1, "IRQA"},\r
-  {&K4IRQ, 1, "K4IRQ"},\r
+  {&K4IRQ, 1, "KIRQ"},\r
   {regs, 16, "REGS"},\r
   {0}\r
 };\r
@@ -136,10 +137,10 @@ static DECLFW(M190Write)
 \r
 static DECLFR(M190Read)\r
 {\r
-// FCEU_printf("read %04x:%04x %d, %d\n",A,regs[(A&0x0F00)>>8],scanline,timestamp);\r
+//  FCEU_printf("read  %04x:%04x %d, %d\n",A,regs[(A&0x0F00)>>8],scanline,timestamp);\r
   return regs[(A&0x0F00)>>8]+regs[0x0B];\r
 }\r
-static void VRC5IRQ(int a)\r
+static void FP_FASTAPASS(1) VRC5IRQ(int a)\r
 {\r
   if(IRQa)\r
   {\r
@@ -147,21 +148,18 @@ static void VRC5IRQ(int a)
     if(IRQCount&0x10000)\r
     {\r
       X6502_IRQBegin(FCEU_IQEXT);\r
-//      IRQCount=IRQLatch;\r
+      IRQCount=IRQLatch;\r
     }\r
   }\r
 }\r
 \r
-static void Mapper190_PPU(uint32 A)\r
-{\r
-  if(A>=0x2000)\r
-  {\r
-     setchr4r(0x10,0x0000,QTAINTRAM[A&0x1FFF]&1);\r
-     setchr4r(0x10,0x1000,QTAINTRAM[A&0x1FFF]&1);\r
-  }\r
+//static void FP_FASTAPASS(1) Mapper190_PPU(uint32 A)\r
+//{\r
+//  if(A<0x2000)\r
+//     setchr4r(0x10,0x1000,QTAINTRAM[A&0x1FFF]&1);\r
 //  else\r
 //     chrSync();\r
-}\r
+//}\r
 \r
 static DECLFW(M1902007Wrap)\r
 {\r
@@ -222,11 +220,11 @@ void Mapper190_Init(CartInfo *info)
   GameStateRestore=StateRestore;\r
 \r
   MapIRQHook=VRC5IRQ;\r
-  //PPU_hook=Mapper190_PPU;\r
+//  PPU_hook=Mapper190_PPU;\r
 \r
   CHRRAM=(uint8*)FCEU_gmalloc(CHRSIZE);\r
   SetupCartCHRMapping(0x10,CHRRAM,CHRSIZE,1);\r
-  AddExState(CHRRAM, CHRSIZE, 0, "CHRRAM");\r
+  AddExState(CHRRAM, CHRSIZE, 0, "CRAM");\r
 \r
   WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);\r
   SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);\r