diff --git a/trunk/src/boards/coolboy.cpp b/trunk/src/boards/coolboy.cpp
new file mode 100644
index 00000000..11c05bd3
--- /dev/null
+++ b/trunk/src/boards/coolboy.cpp
@@ -0,0 +1,98 @@
+/* FCE Ultra - NES/Famicom Emulator
+ *
+ * Copyright notice for this file:
+ * Copyright (C) 2015 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * CoolBoy 400-in-1 FK23C-mimic mapper 32Mb PROM + 128K CHR RAM, no wram, no CROM
+ * only MMC3 mode
+ *
+ */
+
+#include "mapinc.h"
+#include "mmc3.h"
+
+static void COOLBOYCW(uint32 A, uint8 V) {
+ if(EXPREGS[3] & 0x10)
+ setchr8(EXPREGS[2] & 0xF);
+ else
+ setchr1(A, V);
+}
+
+static void COOLBOYPW(uint32 A, uint8 V) {
+ uint32 mask, shift;
+ uint32 base = ((EXPREGS[0] & 0x07) >> 0) | ((EXPREGS[1] & 0x10) >> 1) | ((EXPREGS[1] & 0x0C) << 2) | ((EXPREGS[0] & 0x30) << 2);
+ switch(EXPREGS[0] & 0xC0) {
+ case 0x00:
+ base >>= 2;
+ mask = 0x3F;
+ shift = 6;
+ break;
+ case 0x80:
+ base >>= 1;
+ mask = 0x1F;
+ shift = 5;
+ break;
+ case 0xC0:
+ shift = 4;
+ if(EXPREGS[3] & 0x10) {
+ mask = 0x03;
+ } else {
+ mask = 0x0F;
+ }
+ break;
+ }
+ if(EXPREGS[3] & 0x10)
+ setprg8(A, (base << shift) | (V & mask) | (EXPREGS[3] & 0x0C));
+ else
+ setprg8(A, (base << shift) | (V & mask));
+}
+
+static DECLFW(COOLBOYWrite) {
+ if((EXPREGS[3] & 0x80) == 0) {
+ EXPREGS[A & 3] = V;
+ FixMMC3PRG(MMC3_cmd);
+ FixMMC3CHR(MMC3_cmd);
+ uint32 base = ((EXPREGS[0] & 0x07) >> 0) | ((EXPREGS[1] & 0x10) >> 1) | ((EXPREGS[1] & 0x0C) << 2) | ((EXPREGS[0] & 0x30) << 2);
+ FCEU_printf("exp %02x %02x (base %03d)\n",A,V,base);
+ }
+}
+
+static void COOLBOYReset(void) {
+ MMC3RegReset();
+ EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = 0;
+ FixMMC3PRG(MMC3_cmd);
+ FixMMC3CHR(MMC3_cmd);
+}
+
+static void COOLBOYPower(void) {
+ GenMMC3Power();
+ EXPREGS[0] = EXPREGS[1] = EXPREGS[2] = EXPREGS[3] = 0;
+ FixMMC3PRG(MMC3_cmd);
+ FixMMC3CHR(MMC3_cmd);
+ SetWriteHandler(0x5000, 0x5fff, CartBW); // some games access random unmapped areas and crashes because of KT-008 PCB hack in MMC3 source lol
+ SetWriteHandler(0x6000, 0x6fff, COOLBOYWrite);
+}
+
+void COOLBOY_Init(CartInfo *info) {
+ GenMMC3_Init(info, 512, 128, 0, 0);
+ pwrap = COOLBOYPW;
+ cwrap = COOLBOYCW;
+ info->Power = COOLBOYPower;
+ info->Reset = COOLBOYReset;
+ AddExState(EXPREGS, 4, 0, "EXPR");
+}
+
diff --git a/trunk/src/boards/ks7010.cpp b/trunk/src/boards/ks7010.cpp
new file mode 100644
index 00000000..7adbe89c
--- /dev/null
+++ b/trunk/src/boards/ks7010.cpp
@@ -0,0 +1,85 @@
+/* FCE Ultra - NES/Famicom Emulator
+ *
+ * Copyright notice for this file:
+ * Copyright (C) 2007 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "mapinc.h"
+
+static uint8 preg[4], creg, mirr;
+
+static SFORMAT StateRegs[] =
+{
+ { preg, 4, "PREG" },
+ { &creg, 1, "CREG" },
+ { &mirr, 1, "MIRR" },
+ { 0 }
+};
+
+static void Sync(void) {
+ setprg8(0x6000, preg[0]);
+ setprg8(0x8000, 0xa);
+ setprg8(0xa000, 0xb);
+ setprg8(0xc000, 0x6);
+ setprg8(0xe000, 0x7);
+ setchr8(0x0c);
+ setmirror(mirr);
+}
+
+static DECLFW(UNLKS7010Write) {
+ switch (A) {
+ case 0x4025: mirr = (((V >> 3) & 1) ^ 1); Sync(); break;
+ default:
+ FCEU_printf("bs %04x %02x\n",A,V);
+ break;
+ }
+}
+
+static void UNLKS7010Reset(void) {
+ preg[0]++;
+ if(preg[0] == 0x10) {
+ preg[0] = 0;
+ preg[1]++;
+ if(preg[1] == 0x10) {
+ preg[1] = 0;
+ preg[2]++;
+ }
+ }
+ FCEU_printf("preg %02x %02x %02x\n",preg[0], preg[1], preg[2]);
+ Sync();
+}
+
+static void UNLKS7010Power(void) {
+ preg[0] = preg[1] = preg[2] = 0;
+ Sync();
+ SetReadHandler(0x6000, 0x7fff, CartBR);
+ SetWriteHandler(0x6000, 0x7fff, CartBW);
+ SetReadHandler(0x8000, 0xffff, CartBR);
+ SetWriteHandler(0x4020, 0xffff, UNLKS7010Write);
+}
+
+static void StateRestore(int version) {
+ Sync();
+}
+
+void UNLKS7010_Init(CartInfo *info) {
+ info->Power = UNLKS7010Power;
+ info->Reset = UNLKS7010Reset;
+
+ GameStateRestore = StateRestore;
+ AddExState(&StateRegs, ~0, 0, 0);
+}
diff --git a/trunk/src/boards/mmc3.cpp b/trunk/src/boards/mmc3.cpp
index afa3734c..ebd2db4c 100644
--- a/trunk/src/boards/mmc3.cpp
+++ b/trunk/src/boards/mmc3.cpp
@@ -28,6 +28,7 @@
#include "mmc3.h"
uint8 MMC3_cmd;
+uint8 kt_extra;
uint8 *WRAM;
uint32 WRAMSIZE;
uint8 *CHRRAM;
@@ -186,7 +187,7 @@ DECLFW(MMC3_IRQWrite) {
DECLFW(KT008HackWrite) {
// FCEU_printf("%04x:%04x\n",A,V);
switch (A & 3) {
- case 0: EXPREGS[0] = V; FixMMC3PRG(MMC3_cmd); break;
+ case 0: kt_extra = V; FixMMC3PRG(MMC3_cmd); break;
case 1: break; // unk
case 2: break; // unk
case 3: break; // unk
@@ -233,7 +234,7 @@ static void GENCWRAP(uint32 A, uint8 V) {
static void GENPWRAP(uint32 A, uint8 V) {
// [NJ102] Mo Dao Jie (C) has 1024Mb MMC3 BOARD, maybe something other will be broken
// also HengGe BBC-2x boards enables this mode as default board mode at boot up
- setprg8(A, (V & 0x7F) | ((EXPREGS[0] & 4) << 4));
+ setprg8(A, (V & 0x7F) | ((kt_extra & 4) << 4));
// KT-008 boards hack 2-in-1, TODO assign to new ines mapper, most dump of KT-boards on the net are mapper 4, so need database or goodnes fix support
}
@@ -318,7 +319,7 @@ void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery) {
}
// KT-008 boards hack 2-in-1, TODO assign to new ines mapper, most dump of KT-boards on the net are mapper 4, so need database or goodnes fix support
- AddExState(EXPREGS, 1, 0, "EXPR");
+ AddExState(&kt_extra, 1, 0, "KTEX");
AddExState(MMC3_StateRegs, ~0, 0, 0);
info->Power = GenMMC3Power;
diff --git a/trunk/src/boards/sb-2000.cpp b/trunk/src/boards/sb-2000.cpp
new file mode 100644
index 00000000..995135e8
--- /dev/null
+++ b/trunk/src/boards/sb-2000.cpp
@@ -0,0 +1,195 @@
+/* FCE Ultra - NES/Famicom Emulator
+ *
+ * Copyright notice for this file:
+ * Copyright (C) 2014 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "mapinc.h"
+
+static uint8 preg[8];
+static uint8 IRQa;
+static int16 IRQCount, IRQLatch;
+static uint8 *WRAM = NULL;
+static uint32 WRAMSIZE;
+/*
+static uint8 *CHRRAM = NULL;
+static uint32 CHRRAMSIZE;
+*/
+
+static SFORMAT StateRegs[] =
+{
+ { preg, 8, "PREG" },
+ { &IRQa, 1, "IRQA" },
+ { &IRQCount, 2, "IRQC" },
+ { &IRQLatch, 2, "IRQL" },
+ { 0 }
+};
+
+static void Sync(void) {
+ setchr8(0);
+ setprg8r(0x10, 0x6000, 0);
+ if(preg[0] & 0x80)
+ setprg4r(0x10,0x8000,preg[0] & 0x7f);
+ else
+ setprg4(0x8000,preg[0] & 0x7f);
+ if(preg[1] & 0x80)
+ setprg4r(0x10,0x9000,preg[1] & 0x7f);
+ else
+ setprg4(0x9000,preg[1] & 0x7f);
+ if(preg[2] & 0x80)
+ setprg4r(0x10,0xa000,preg[2] & 0x7f);
+ else
+ setprg4(0xa000,preg[2] & 0x7f);
+ if(preg[3] & 0x80)
+ setprg4r(0x10,0xb000,preg[3] & 0x7f);
+ else
+ setprg4(0xb000,preg[3] & 0x7f);
+/*
+ if(preg[4] & 0x80)
+ setprg4r(0x10,0xc000,preg[4] & 0x7f);
+ else
+ setprg4(0xc000,preg[4] & 0x7f);
+ if(preg[5] & 0x80)
+ setprg4r(0x10,0xd000,preg[5] & 0x7f);
+ else
+ setprg4(0xd000,preg[5] & 0x7f);
+ if(preg[6] & 0x80)
+ setprg4r(0x10,0xe000,preg[6] & 0x7f);
+ else
+ setprg4(0xe000,preg[6] & 0x7f);
+ if(preg[7] & 0x80)
+ setprg4r(0x10,0xf000,preg[7] & 0x7f);
+ else
+ setprg4(0xf000,preg[7] & 0x7f);
+*/
+ setprg16(0xC000,1);
+}
+
+static DECLFR(UNLSB2000Read) {
+ switch(A) {
+ case 0x4033: // IRQ flags
+ X6502_IRQEnd(FCEU_IQFCOUNT);
+ return 0xff;
+// case 0x4204: // unk
+// return 0xff;
+// case 0x4205: // unk
+// return 0xff;
+ default:
+ FCEU_printf("unk read: %04x\n",A);
+// break;
+// return 0xff;
+ }
+}
+
+static DECLFW(UNLSB2000Write) {
+ switch(A) {
+ case 0x4027: // PCM output
+ BWrite[0x4015](0x4015, 0x10);
+ BWrite[0x4011](0x4011, V >> 1);
+ break;
+ case 0x4032: // IRQ mask
+ IRQa &= ~V;
+// X6502_IRQEnd(FCEU_IQEXT);
+ break;
+ case 0x4040:
+ case 0x4041:
+ case 0x4042:
+ case 0x4043:
+ case 0x4044:
+ case 0x4045:
+ case 0x4046:
+ case 0x4047:
+// FCEU_printf("bank write: %04x:%02x\n",A,V);
+ preg[A&7] = V;
+ Sync();
+ break;
+ default:
+// FCEU_printf("unk write: %04x:%02x\n",A,V);
+ break;
+ }
+}
+
+static void UNLSB2000Reset(void) {
+ preg[0] = 0;
+ preg[1] = 1;
+ preg[2] = 2;
+ preg[3] = 3;
+ preg[4] = 4;
+ preg[5] = 5;
+ preg[6] = 6;
+ preg[7] = 7;
+ IRQa = 0;
+// BWrite[0x4017](0x4017,0xC0);
+// BWrite[0x4015](0x4015,0x1F);
+}
+
+static void UNLSB2000Power(void) {
+ UNLSB2000Reset();
+ Sync();
+ SetReadHandler(0x6000, 0x7fff, CartBR);
+ SetWriteHandler(0x6000, 0x7fff, CartBW);
+ SetReadHandler(0x8000, 0xffff, CartBR);
+ SetWriteHandler(0x8000, 0xbfff, CartBW);
+ SetWriteHandler(0x4020, 0x5fff, UNLSB2000Write);
+ SetReadHandler(0x4020, 0x5fff, UNLSB2000Read);
+}
+
+static void UNLSB2000Close(void)
+{
+ if (WRAM)
+ FCEU_gfree(WRAM);
+/*
+ if (CHRRAM)
+ FCEU_gfree(CHRRAM);
+*/
+ WRAM = /*CHRRAM = */NULL;
+}
+/*
+static void UNLSB2000IRQHook() {
+ X6502_IRQBegin(FCEU_IQEXT);
+}
+*/
+static void StateRestore(int version) {
+ Sync();
+}
+
+void UNLSB2000_Init(CartInfo *info) {
+ info->Reset = UNLSB2000Reset;
+ info->Power = UNLSB2000Power;
+ info->Close = UNLSB2000Close;
+// GameHBIRQHook = UNLSB2000IRQHook;
+ GameStateRestore = StateRestore;
+/*
+ CHRRAMSIZE = 8192;
+ CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
+ SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
+ AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
+*/
+
+// SetupCartCHRMapping(0, PRGptr[0], PRGsize[0], 0);
+
+ WRAMSIZE = 512 * 1024;
+ WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
+ SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
+ AddExState(WRAM, WRAMSIZE, 0, "WRAM");
+ if (info->battery) {
+ info->SaveGame[0] = WRAM;
+ info->SaveGameLen[0] = WRAMSIZE;
+ }
+
+ AddExState(&StateRegs, ~0, 0, 0);
+}
diff --git a/trunk/src/unif.cpp b/trunk/src/unif.cpp
index d204ee39..940e9bf3 100644
--- a/trunk/src/unif.cpp
+++ b/trunk/src/unif.cpp
@@ -314,7 +314,8 @@ static int LoadCHR(FCEUFILE *fp) {
#define BMCFLAG_FORCE4 1
#define BMCFLAG_16KCHRR 2
#define BMCFLAG_32KCHRR 4
-#define BMCFLAG_EXPCHRR 8
+#define BMCFLAG_128KCHRR 8
+#define BMCFLAG_EXPCHRR 10
static BMAPPING bmap[] = {
{ "11160", BMC11160_Init, 0 },
@@ -366,6 +367,7 @@ static BMAPPING bmap[] = {
{ "HKROM", HKROM_Init, 0 },
{ "KOF97", UNLKOF97_Init, 0 },
{ "KONAMI-QTAI", Mapper190_Init, 0 },
+ { "KS7010", UNLKS7010_Init, 0 },
{ "KS7012", UNLKS7012_Init, 0 },
{ "KS7013B", UNLKS7013B_Init, 0 },
{ "KS7017", UNLKS7017_Init, 0 },
@@ -454,6 +456,8 @@ static BMAPPING bmap[] = {
{ "UOROM", UNROM_Init, 0 },
{ "VRC7", UNLVRC7_Init, 0 },
{ "YOKO", UNLYOKO_Init, 0 },
+ { "SB-2000", UNLSB2000_Init, 0 },
+ { "COOLBOY", COOLBOY_Init, BMCFLAG_128KCHRR },
{ 0, 0, 0 }
};
@@ -509,14 +513,16 @@ static int InitializeBoard(void) {
if (!strcmp((char*)sboardname, (char*)bmap[x].name)) {
if (!malloced[16]) {
if (bmap[x].flags & BMCFLAG_16KCHRR)
- CHRRAMSize = 16384;
+ CHRRAMSize = 16;
else if (bmap[x].flags & BMCFLAG_32KCHRR)
- CHRRAMSize = 32768;
+ CHRRAMSize = 32;
+ else if (bmap[x].flags & BMCFLAG_128KCHRR)
+ CHRRAMSize = 128;
else if (bmap[x].flags & BMCFLAG_EXPCHRR)
- CHRRAMSize = 128 * 1024;
+ CHRRAMSize = 256;
else
- CHRRAMSize = 8192;
- UNIFCart.vram_size = CHRRAMSize;
+ CHRRAMSize = 8;
+ CHRRAMSize <<= 10;
if ((UNIFchrrama = (uint8*)FCEU_malloc(CHRRAMSize))) {
SetupCartCHRMapping(0, UNIFchrrama, CHRRAMSize, 1);
AddExState(UNIFchrrama, CHRRAMSize, 0, "CHRR");
diff --git a/trunk/src/unif.h b/trunk/src/unif.h
index fcc5e18d..1b690c38 100644
--- a/trunk/src/unif.h
+++ b/trunk/src/unif.h
@@ -143,6 +143,9 @@ void UNLVRC7_Init(CartInfo *info);
void UNLYOKO_Init(CartInfo *info);
void UNROM_Init(CartInfo *info);
void UNROM512_Init(CartInfo *info);
+void UNLSB2000_Init(CartInfo *info);
+void UNLKS7010_Init(CartInfo *info);
+void COOLBOY_Init(CartInfo *info);
extern uint8 *UNIFchrrama; // Meh. So I can stop CHR RAM
// bank switcherooing with certain boards...
diff --git a/trunk/vc/vc10_fceux.vcxproj b/trunk/vc/vc10_fceux.vcxproj
index 32614d8e..7962e308 100644
--- a/trunk/vc/vc10_fceux.vcxproj
+++ b/trunk/vc/vc10_fceux.vcxproj
@@ -311,9 +311,11 @@
+
+
@@ -329,6 +331,7 @@
+
diff --git a/trunk/vc/vc10_fceux.vcxproj.filters b/trunk/vc/vc10_fceux.vcxproj.filters
index 5072d879..cdf6da46 100644
--- a/trunk/vc/vc10_fceux.vcxproj.filters
+++ b/trunk/vc/vc10_fceux.vcxproj.filters
@@ -1036,6 +1036,15 @@
input
+
+ boards
+
+
+ boards
+
+
+ boards
+