support BKF23C unif and BKF23CA (big m176 multicarts)
This commit is contained in:
parent
bc347d475b
commit
887c93733e
|
@ -22,22 +22,33 @@
|
|||
#include "mmc3.h"
|
||||
#include "../ines.h"
|
||||
|
||||
static bool is_BMCFK23CA;
|
||||
static uint8 unromchr;
|
||||
static uint32 dipswitch;
|
||||
static uint8 *CHRRAM=NULL;
|
||||
static uint32 CHRRAMSize;
|
||||
|
||||
static void BMCFK23CCW(uint32 A, uint8 V)
|
||||
{
|
||||
if(EXPREGS[0]&0x40)
|
||||
setchr8(EXPREGS[2]|unromchr);
|
||||
else if(EXPREGS[0]&0x20) {
|
||||
setchr1r(0x10, A, V);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16 base=(EXPREGS[2]&0x7F)<<3;
|
||||
setchr1(A,V|base);
|
||||
if(EXPREGS[3]&2)
|
||||
{
|
||||
setchr1(0x0400,EXPREGS[6]|base);
|
||||
setchr1(0x0C00,EXPREGS[7]|base);
|
||||
int cbase=(MMC3_cmd&0x80)<<5;
|
||||
setchr1(A,V|base);
|
||||
setchr1(0x0000^cbase,DRegBuf[0]|base);
|
||||
setchr1(0x0400^cbase,EXPREGS[6]|base);
|
||||
setchr1(0x0800^cbase,DRegBuf[1]|base);
|
||||
setchr1(0x0c00^cbase,EXPREGS[7]|base);
|
||||
}
|
||||
else
|
||||
setchr1(A,V|base);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,6 +86,11 @@ static int prg_mask;
|
|||
//PRG wrapper
|
||||
static void BMCFK23CPW(uint32 A, uint8 V)
|
||||
{
|
||||
uint32 bank = (EXPREGS[1] & 0x1F);
|
||||
uint32 hiblock = ((EXPREGS[0] & 8) << 4)|((EXPREGS[0] & 0x80) << 1)|(UNIFchrrama?((EXPREGS[2] & 0x40)<<3):0);
|
||||
uint32 block = (EXPREGS[1] & 0x60) | hiblock;
|
||||
uint32 extra = (EXPREGS[3] & 2);
|
||||
|
||||
if((EXPREGS[0]&7)==4)
|
||||
setprg32(0x8000,EXPREGS[1]>>1);
|
||||
else if ((EXPREGS[0]&7)==3)
|
||||
|
@ -86,7 +102,7 @@ static void BMCFK23CPW(uint32 A, uint8 V)
|
|||
{
|
||||
if(EXPREGS[0]&3)
|
||||
{
|
||||
uint32 blocksize = (6+prg_bonus)-(EXPREGS[0]&3);
|
||||
uint32 blocksize = (6)-(EXPREGS[0]&3);
|
||||
uint32 mask = (1<<blocksize)-1;
|
||||
V &= mask;
|
||||
//V &= 63; //? is this a good idea?
|
||||
|
@ -102,6 +118,7 @@ static void BMCFK23CPW(uint32 A, uint8 V)
|
|||
setprg8(0xE000,EXPREGS[5]);
|
||||
}
|
||||
}
|
||||
setprg8r(0x10,0x6000,A001B&3);
|
||||
}
|
||||
|
||||
//PRG handler ($8000-$FFFF)
|
||||
|
@ -126,8 +143,17 @@ static DECLFW(BMCFK23CHiWrite)
|
|||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
else
|
||||
if(A<0xC000)
|
||||
if(A<0xC000) {
|
||||
if(UNIFchrrama) { // hacky... strange behaviour, must be bit scramble due to pcb layot restrictions
|
||||
// check if it not interfer with other dumps
|
||||
if((A==0x8000)&&(V==0x46))
|
||||
V=0x47;
|
||||
else if((A==0x8000)&&(V==0x47))
|
||||
V=0x46;
|
||||
}
|
||||
MMC3_CMDWrite(A,V);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
else
|
||||
MMC3_IRQWrite(A,V);
|
||||
}
|
||||
|
@ -160,18 +186,24 @@ static DECLFW(BMCFK23CWrite)
|
|||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
}
|
||||
//else printf("- ");
|
||||
//printf("%04X = $%02X\n",A,V);
|
||||
|
||||
if(is_BMCFK23CA)
|
||||
{
|
||||
if(EXPREGS[3]&2)
|
||||
EXPREGS[0] &= ~7; // hacky hacky! if someone wants extra banking, then for sure doesn't want mode 4 for it! (allow to run A version boards on normal mapper)
|
||||
}
|
||||
|
||||
//printf("%04X = $%02X\n",A,V);
|
||||
//printf("%02X %02X %02X %02X\n",EXPREGS[0],EXPREGS[1],EXPREGS[2],EXPREGS[3]);
|
||||
}
|
||||
|
||||
static void BMCFK23CReset(void)
|
||||
{
|
||||
//NOT NECESSARY ANYMORE
|
||||
//this little hack makes sure that we try all the dip switch settings eventually, if we reset enough
|
||||
dipswitch++;
|
||||
dipswitch&=7;
|
||||
printf("BMCFK23C dipswitch set to %d\n",dipswitch);
|
||||
// dipswitch++;
|
||||
// dipswitch&=7;
|
||||
//printf("BMCFK23C dipswitch set to %d\n",dipswitch);
|
||||
|
||||
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
|
||||
EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
|
||||
|
@ -191,11 +223,31 @@ static void BMCFK23CPower(void)
|
|||
SetWriteHandler(0x8000,0xFFFF,BMCFK23CHiWrite);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void BMCFK23CAPower(void)
|
||||
{
|
||||
GenMMC3Power();
|
||||
dipswitch = 0;
|
||||
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
|
||||
EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
|
||||
SetWriteHandler(0x5000,0x5fff,BMCFK23CWrite);
|
||||
SetWriteHandler(0x8000,0xFFFF,BMCFK23CHiWrite);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void BMCFK23CAClose(void)
|
||||
{
|
||||
if(CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
CHRRAM=NULL;
|
||||
}
|
||||
|
||||
void BMCFK23C_Init(CartInfo *info)
|
||||
{
|
||||
is_BMCFK23CA = false;
|
||||
|
||||
GenMMC3_Init(info, 512, 256, 8, 0);
|
||||
cwrap=BMCFK23CCW;
|
||||
pwrap=BMCFK23CPW;
|
||||
|
@ -211,3 +263,29 @@ void BMCFK23C_Init(CartInfo *info)
|
|||
|
||||
prg_mask = 0x7F>>(prg_bonus);
|
||||
}
|
||||
|
||||
void BMCFK23CA_Init(CartInfo *info)
|
||||
{
|
||||
is_BMCFK23CA = true;
|
||||
|
||||
GenMMC3_Init(info, 512, 256, 8, 0);
|
||||
cwrap=BMCFK23CCW;
|
||||
pwrap=BMCFK23CPW;
|
||||
info->Power=BMCFK23CAPower;
|
||||
info->Reset=BMCFK23CReset;
|
||||
info->Close=BMCFK23CAClose;
|
||||
|
||||
CHRRAMSize=8192;
|
||||
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
|
||||
AddExState(CHRRAM, CHRRAMSize, 0, "CRAM");
|
||||
|
||||
AddExState(EXPREGS, 8, 0, "EXPR");
|
||||
AddExState(&unromchr, 1, 0, "UNCHR");
|
||||
AddExState(&dipswitch, 1, 0, "DIPSW");
|
||||
|
||||
prg_bonus = 1;
|
||||
if(MasterRomInfoParams.find("bonus") != MasterRomInfoParams.end())
|
||||
prg_bonus = atoi(MasterRomInfoParams["bonus"].c_str());
|
||||
prg_mask = 0x7F>>(prg_bonus);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
extern uint8 MMC3_cmd;
|
||||
extern uint8 A000B;
|
||||
extern uint8 A001B;
|
||||
extern uint8 EXPREGS[8];
|
||||
extern uint8 DRegBuf[8];
|
||||
|
||||
|
|
|
@ -313,6 +313,7 @@ static int LoadCHR(FCEUFILE *fp)
|
|||
#define BMCFLAG_FORCE4 1
|
||||
#define BMCFLAG_16KCHRR 2
|
||||
#define BMCFLAG_32KCHRR 4
|
||||
#define BMCFLAG_EXPCHRR 8
|
||||
|
||||
static BMAPPING bmap[] = {
|
||||
|
||||
|
@ -438,6 +439,9 @@ static BMAPPING bmap[] = {
|
|||
|
||||
{ "TEK90", Mapper90_Init,0},
|
||||
|
||||
{ "FK23C", BMCFK23C_Init,BMCFLAG_EXPCHRR},
|
||||
{ "FK23CA", BMCFK23CA_Init,BMCFLAG_EXPCHRR},
|
||||
|
||||
{0,0,0}
|
||||
};
|
||||
|
||||
|
@ -503,6 +507,10 @@ static int InitializeBoard(void)
|
|||
{
|
||||
if(bmap[x].flags & BMCFLAG_16KCHRR)
|
||||
CHRRAMSize = 16384;
|
||||
else if(bmap[x].flags & BMCFLAG_32KCHRR)
|
||||
CHRRAMSize = 32768;
|
||||
else if(bmap[x].flags & BMCFLAG_EXPCHRR)
|
||||
CHRRAMSize = 128 * 1024;
|
||||
else
|
||||
CHRRAMSize = 8192;
|
||||
if((UNIFchrrama=(uint8 *)FCEU_malloc(CHRRAMSize)))
|
||||
|
|
|
@ -89,6 +89,7 @@ void BMC70in1B_Init(CartInfo *info);
|
|||
void BMC13in1JY110_Init(CartInfo *info);
|
||||
void BMCT262_Init(CartInfo *info);
|
||||
void BMCFK23C_Init(CartInfo *info);
|
||||
void BMCFK23CA_Init(CartInfo *info);
|
||||
void BMCD1038_Init(CartInfo *info);
|
||||
void BMCA65AS_Init(CartInfo *info);
|
||||
void BMCGK192_Init(CartInfo *info);
|
||||
|
|
|
@ -592,6 +592,14 @@
|
|||
<File
|
||||
RelativePath="..\src\mappers\156.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release Fastbuild|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
WarningLevel="4"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\boards\164.cpp"
|
||||
|
|
Loading…
Reference in New Issue