diff --git a/trunk/src/boards/coolboy.cpp b/trunk/src/boards/coolboy.cpp index 4c40eea8..67e4ae54 100644 --- a/trunk/src/boards/coolboy.cpp +++ b/trunk/src/boards/coolboy.cpp @@ -17,9 +17,14 @@ * 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 + * CoolBoy 400-in-1 FK23C-mimic mapper 16Mb/32Mb PROM + 128K/256K CHR RAM, optional SRAM, optional NTRAM * only MMC3 mode * + * 6000 (õõ76x210) | 0õÑ0 + * 6001 (õõõ354õõ) + * 6002 = 0 + * 6003 = 0 + * */ #include "mapinc.h" @@ -28,8 +33,15 @@ static void COOLBOYCW(uint32 A, uint8 V) { if(EXPREGS[3] & 0x10) setchr8(EXPREGS[2] & 0xF); - else - setchr1(A, V); + else { + uint32 mask = 0xFF; + switch(EXPREGS[0] & 0xC0) { + case 0xC0: + mask = 0x7F; + break; + } + setchr1(A, V & mask); + } } static void COOLBOYPW(uint32 A, uint8 V) { @@ -37,17 +49,12 @@ static void COOLBOYPW(uint32 A, uint8 V) { 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 = 0x01 | (EXPREGS[1] & 2); } else { @@ -56,19 +63,22 @@ static void COOLBOYPW(uint32 A, uint8 V) { break; } if(EXPREGS[3] & 0x10) - setprg8(A, (base << shift) | (V & mask) | ((EXPREGS[3] & (0x0E ^ (EXPREGS[1] & 2))) )); + setprg8(A, (base << 4) | (V & mask) | ((EXPREGS[3] & (0x0E ^ (EXPREGS[1] & 2))) )); else - setprg8(A, (base << shift) | (V & mask)); + setprg8(A, (base << 4) | (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); - } + if(A001B & 0x80) + CartBW(A,V); + else + 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) { @@ -88,7 +98,7 @@ static void COOLBOYPower(void) { } void COOLBOY_Init(CartInfo *info) { - GenMMC3_Init(info, 512, 128, 0, 0); + GenMMC3_Init(info, 512, 128, 8, 0); pwrap = COOLBOYPW; cwrap = COOLBOYCW; info->Power = COOLBOYPower; diff --git a/trunk/src/unif.cpp b/trunk/src/unif.cpp index 940e9bf3..198b7d4e 100644 --- a/trunk/src/unif.cpp +++ b/trunk/src/unif.cpp @@ -311,11 +311,11 @@ static int LoadCHR(FCEUFILE *fp) { return(1); } -#define BMCFLAG_FORCE4 1 -#define BMCFLAG_16KCHRR 2 -#define BMCFLAG_32KCHRR 4 -#define BMCFLAG_128KCHRR 8 -#define BMCFLAG_EXPCHRR 10 +#define BMCFLAG_FORCE4 0x01 +#define BMCFLAG_16KCHRR 0x02 +#define BMCFLAG_32KCHRR 0x04 +#define BMCFLAG_128KCHRR 0x08 +#define BMCFLAG_256KCHRR 0x10 static BMAPPING bmap[] = { { "11160", BMC11160_Init, 0 }, @@ -355,8 +355,8 @@ static BMAPPING bmap[] = { { "ELROM", ELROM_Init, 0 }, { "ETROM", ETROM_Init, 0 }, { "EWROM", EWROM_Init, 0 }, - { "FK23C", BMCFK23C_Init, BMCFLAG_EXPCHRR }, - { "FK23CA", BMCFK23CA_Init, BMCFLAG_EXPCHRR }, + { "FK23C", BMCFK23C_Init, BMCFLAG_256KCHRR }, + { "FK23CA", BMCFK23CA_Init, BMCFLAG_256KCHRR }, { "FS304", UNLFS304_Init, 0 }, { "G-146", BMCG146_Init, 0 }, { "GK-192", BMCGK192_Init, 0 }, @@ -457,7 +457,7 @@ static BMAPPING bmap[] = { { "VRC7", UNLVRC7_Init, 0 }, { "YOKO", UNLYOKO_Init, 0 }, { "SB-2000", UNLSB2000_Init, 0 }, - { "COOLBOY", COOLBOY_Init, BMCFLAG_128KCHRR }, + { "COOLBOY", COOLBOY_Init, BMCFLAG_256KCHRR }, { 0, 0, 0 } }; @@ -518,7 +518,7 @@ static int InitializeBoard(void) { CHRRAMSize = 32; else if (bmap[x].flags & BMCFLAG_128KCHRR) CHRRAMSize = 128; - else if (bmap[x].flags & BMCFLAG_EXPCHRR) + else if (bmap[x].flags & BMCFLAG_256KCHRR) CHRRAMSize = 256; else CHRRAMSize = 8;