experiment to combine fk23c and the chinese 176

This commit is contained in:
zeromus 2012-06-06 19:32:16 +00:00
parent ab64af6e87
commit 385dd471d1
3 changed files with 26 additions and 16 deletions

View File

@ -48,7 +48,7 @@ static void Sync(void)
static DECLFW(M176Write_5001) static DECLFW(M176Write_5001)
{ {
if(sbw) if(sbw)
{ {
prg[0] = V*4; prg[0] = V*4;
prg[1] = V*4+1; prg[1] = V*4+1;
@ -120,17 +120,8 @@ static void M176Power(void)
sbw = 0; sbw = 0;
prg[0] = 0; prg[0] = 0;
prg[1] = 1; prg[1] = 1;
if(ROM_size > 32) prg[2] = (ROM_size-2)&63;
{ prg[3] = (ROM_size-1)&63;
prg[2] = ROM_size-2;
prg[3] = ROM_size-1;
}
else
{
prg[2] = ROM_size*2-2;
prg[3] = ROM_size*2-1;
}
Sync(); Sync();
} }

View File

@ -40,6 +40,12 @@ static void BMCFK23CCW(uint32 A, uint8 V)
} }
} }
//some games are wired differently, and this will need to be changed.
//for instance, WAIXING176 needs prg_bonus=1, and cah4e3's 4-in-1's need prg_bonus=0
static int prg_bonus = 0;
static int prg_mask = 0x7F>>(prg_bonus);
//PRG wrapper
static void BMCFK23CPW(uint32 A, uint8 V) static void BMCFK23CPW(uint32 A, uint8 V)
{ {
if((EXPREGS[0]&7)==4) if((EXPREGS[0]&7)==4)
@ -52,9 +58,17 @@ static void BMCFK23CPW(uint32 A, uint8 V)
else else
{ {
if(EXPREGS[0]&3) if(EXPREGS[0]&3)
setprg8(A,(V&(0x3F>>(EXPREGS[0]&3)))|(EXPREGS[1]<<1)); {
else uint32 blocksize = (6+prg_bonus)-(EXPREGS[0]&3);
uint32 mask = (1<<blocksize)-1;
V &= mask;
V &= 63;
V |= (EXPREGS[1]<<1);
setprg8(A,V); setprg8(A,V);
}
else
setprg8(A,V & prg_mask);
if(EXPREGS[3]&2) if(EXPREGS[3]&2)
{ {
setprg8(0xC000,EXPREGS[4]); setprg8(0xC000,EXPREGS[4]);
@ -63,6 +77,7 @@ static void BMCFK23CPW(uint32 A, uint8 V)
} }
} }
//PRG handler ($8000-$FFFF)
static DECLFW(BMCFK23CHiWrite) static DECLFW(BMCFK23CHiWrite)
{ {
if(EXPREGS[0]&0x40) if(EXPREGS[0]&0x40)
@ -91,8 +106,10 @@ static DECLFW(BMCFK23CHiWrite)
} }
} }
//EXP handler ($5000-$5FFF)
static DECLFW(BMCFK23CWrite) static DECLFW(BMCFK23CWrite)
{ {
printf("%04X = $%02X\n",A,V);
if(A&(1<<(dipswitch+4))) if(A&(1<<(dipswitch+4)))
{ {
EXPREGS[A&3]=V; EXPREGS[A&3]=V;
@ -103,8 +120,10 @@ static DECLFW(BMCFK23CWrite)
static void BMCFK23CReset(void) static void BMCFK23CReset(void)
{ {
//this little hack makes sure that we try all the dip switch settings eventually, if we reset enough
dipswitch++; dipswitch++;
dipswitch&=7; dipswitch&=7;
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0; EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF; EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
MMC3RegReset(); MMC3RegReset();

View File

@ -586,8 +586,8 @@ static BMAPPINGLocal bmap[] = {
{"", 172, Mapper172_Init}, {"", 172, Mapper172_Init},
{"", 173, Mapper173_Init}, {"", 173, Mapper173_Init},
{"", 175, Mapper175_Init}, {"", 175, Mapper175_Init},
//{"BMCFK23C", 176, BMCFK23C_Init}, //zero 26-may-2012 - well, i have some WXN junk games that use 176 for instance 水浒神兽. i dont know what game uses this BMCFK23C as mapper 176. we'll have to make a note when we find it. {"BMCFK23C", 176, BMCFK23C_Init}, //zero 26-may-2012 - well, i have some WXN junk games that use 176 for instance 水浒神兽. i dont know what game uses this BMCFK23C as mapper 176. we'll have to make a note when we find it.
{"BMCFK23C", 176, Mapper176_Init}, //{"BMCFK23C", 176, Mapper176_Init},
{"", 177, Mapper177_Init}, {"", 177, Mapper177_Init},
{"", 178, Mapper178_Init}, {"", 178, Mapper178_Init},
{"", 180, Mapper180_Init}, {"", 180, Mapper180_Init},