Some mapper fixes, new UNIF board SL1632 was added.

This commit is contained in:
CaH4e3 2006-08-02 19:24:21 +00:00
parent af143cdfeb
commit 777dc074bc
6 changed files with 106 additions and 62 deletions

View File

@ -25,6 +25,7 @@ static uint8 IRQCount, IRQPre;
static uint8 IRQa;
static uint8 prg_reg[2];
static uint8 chr_reg[8];
static uint8 mirr;
static SFORMAT StateRegs[]=
{
@ -32,6 +33,7 @@ static SFORMAT StateRegs[]=
{&IRQa, 1, "IRQA"},
{prg_reg, 2, "PRG"},
{chr_reg, 8, "CHR"},
{&mirr, 1, "MIRR"},
{0}
};
@ -40,7 +42,7 @@ static void M222IRQ(void)
if(IRQa)
{
IRQCount++;
if((IRQCount)>=240)
if(IRQCount>=240)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQa=0;
@ -50,11 +52,12 @@ static void M222IRQ(void)
static void Sync(void)
{
int i;
setprg8(0x8000,prg_reg[0]);
setprg8(0xA000,prg_reg[1]);
int i;
for(i=0; i<8; i++)
setchr1(i<<10,chr_reg[i]);
setmirror(mirr^1);
}
static DECLFW(M222Write)
@ -62,6 +65,7 @@ static DECLFW(M222Write)
switch(A&0xF003)
{
case 0x8000: prg_reg[0]=V; break;
case 0x9000: mirr=V&1; break;
case 0xA000: prg_reg[1]=V; break;
case 0xB000: chr_reg[0]=V; break;
case 0xB002: chr_reg[1]=V; break;
@ -75,9 +79,8 @@ static DECLFW(M222Write)
// / case 0xF001: FCEU_printf("%04x:%02x %d\n",A,V,scanline); IRQCount=V; break;
// case 0xF002: FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
// case 0xD001: IRQa=V; X6502_IRQEnd(FCEU_IQEXT); FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
case 0xC001: IRQPre=0; FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
case 0xF000: IRQPre=8; IRQCount=V; IRQa=V; X6502_IRQEnd(FCEU_IQEXT); FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
default: FCEU_printf("%04x:%02x %d\n",A,V,scanline);
// case 0xC001: IRQPre=16; FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
case 0xF000: IRQCount=V; IRQa=V; X6502_IRQEnd(FCEU_IQEXT); break;
}
Sync();
}

View File

@ -20,7 +20,7 @@
*/
#include "mapinc.h"
#define DEBUG90
//#define DEBUG90
// Mapper 090 is simpliest mapper hardware and have not extended nametable control and latched chr banks in 4k mode
// Mapper 209 much compicated hardware with decribed above features disabled by default and switchable by command
@ -38,7 +38,6 @@ static uint8 IRQa; // $c002, $c003, and $c000
static uint8 mul[2];
static uint8 regie;
static uint8 regie2;
static uint8 tkcom[4];
static uint8 prgb[4];
@ -185,54 +184,50 @@ static void tekvrom(void)
static DECLFW(M90TekWrite)
{
FCEU_printf("bs %04x %02x\n",A,V);
switch(A&0x5805)
switch(A&0x5C03)
{
case 0x5800: mul[0]=V; break;
case 0x5801: mul[1]=V; break;
case 0x5803: regie=V; break;
// case 0x5803: regie2=V; break;
// default: regie=V; break;
}
}
static DECLFR(M90TekRead)
{
switch(A&0x5805)
switch(A&0x5C03)
{
case 0x5000: return tekker;
case 0x5800: return (mul[0]*mul[1]);
case 0x5801: return((mul[0]*mul[1])>>8);
case 0x5803: return (regie);
// case 0x5804: return (regie2);
default: return tekker;
}
return(0xff);
}
static DECLFW(M90PRGWrite)
{
FCEU_printf("bs %04x %02x\n",A,V);
// FCEU_printf("bs %04x %02x\n",A,V);
prgb[A&3]=V;
tekprom();
}
static DECLFW(M90CHRlowWrite)
{
FCEU_printf("bs %04x %02x\n",A,V);
// FCEU_printf("bs %04x %02x\n",A,V);
chrlow[A&7]=V;
tekvrom();
}
static DECLFW(M90CHRhiWrite)
{
FCEU_printf("bs %04x %02x\n",A,V);
// FCEU_printf("bs %04x %02x\n",A,V);
chrhigh[A&7]=V;
tekvrom();
}
static DECLFW(M90NTWrite)
{
FCEU_printf("bs %04x %02x\n",A,V);
// FCEU_printf("bs %04x %02x\n",A,V);
if(A&4)
{
names[A&3]&=0x00FF;
@ -248,7 +243,7 @@ static DECLFW(M90NTWrite)
static DECLFW(M90IRQWrite)
{
FCEU_printf("bs %04x %02x\n",A,V);
// FCEU_printf("bs %04x %02x\n",A,V);
switch(A&7)
{
case 00: //FCEU_printf("%s IRQ (C000)\n",V&1?"Enable":"Disable");
@ -287,7 +282,7 @@ static DECLFW(M90IRQWrite)
static DECLFW(M90ModeWrite)
{
FCEU_printf("bs %04x %02x\n",A,V);
// FCEU_printf("bs %04x %02x\n",A,V);
tkcom[A&3]=V;
tekprom();
tekvrom();
@ -328,7 +323,7 @@ static DECLFW(M90ModeWrite)
static DECLFW(M90DummyWrite)
{
FCEU_printf("bs %04x %02x\n",A,V);
// FCEU_printf("bs %04x %02x\n",A,V);
}
static void CCL(void)

View File

@ -25,16 +25,20 @@ static uint8 m_perm[8] = {0, 1, 0, 3, 0, 5, 6, 7};
static void UNLA9711PW(uint32 A, uint8 V)
{
if(EXPREGS[0]&0x20)
if((EXPREGS[0]&0xFF) == 0x37)
{
uint8 bank=EXPREGS[0]&0x1F;
if(EXPREGS[0]&0x20)
setprg32(0x8000,bank>>2);
else
{
setprg8(0x8000, 0x13);
setprg8(0xA000, 0x13);
setprg8(0xC000, 0x13);
setprg8(0xE000, 0x0);
// uint8 bank=EXPREGS[0]&0x1F;
// if(EXPREGS[0]&0x20)
// setprg32(0x8000,bank>>2);
// else
// {
// setprg16(0x8000,bank);
setprg16(0xC000,bank);
}
// setprg16(0xC000,bank);
// }
}
else
setprg8(A,V&0x3F);
@ -47,7 +51,7 @@ static DECLFW(UNLA9711Write8000)
// MMC3_CMDWrite(A,V);
// else
// MMC3_CMDWrite(A,m_perm[V&7]);
if(V!=0x86) MMC3_CMDWrite(A,V);
// if(V!=0x86) MMC3_CMDWrite(A,V);
}
static DECLFW(UNLA9711WriteLo)

View File

@ -628,7 +628,7 @@ static void M47Power(void)
void Mapper47_Init(CartInfo *info)
{
GenMMC3_Init(info, 512, 256, 8, info->battery);
GenMMC3_Init(info, 512, 256, 8, 0);
pwrap=M47PW;
cwrap=M47CW;
info->Power=M47Power;
@ -1159,6 +1159,24 @@ void Mapper195_Init(CartInfo *info)
AddExState(wramtw, wramsize, 0, "WRAMTW");
}
// ---------------------------- Mapper 197 -------------------------------
static void M197CW(uint32 A, uint8 V)
{
if(A==0x0000)
setchr4(0x0000,V>>1);
else if(A==0x1000)
setchr2(0x1000,V);
else if(A==0x1400)
setchr2(0x1800,V);
}
void Mapper197_Init(CartInfo *info)
{
GenMMC3_Init(info, 128, 512, 8, 0);
cwrap=M197CW;
}
// ---------------------------- Mapper 198 -------------------------------
static void M198PW(uint32 A, uint8 V)
@ -1169,21 +1187,10 @@ static void M198PW(uint32 A, uint8 V)
setprg8(A,V);
}
static void M198CW(uint32 A, uint8 V)
{
if(A==0x0000)
setchr4(0x0000,V>>1);
else if(A==0x1000)
setchr2(0x1000,V);
else if(A==0x1400)
setchr2(0x1800,V);
}
void Mapper198_Init(CartInfo *info)
{
GenMMC3_Init(info, 1024, 256, 8, info->battery);
pwrap=M198PW;
cwrap=M198CW;
info->Power=M195Power;
info->Close=M195Close;
wramsize=4096;
@ -1292,17 +1299,17 @@ static DECLFW(M215ExWrite)
// FCEU_printf("bs %04x %02x (%04x)\n",A,V,A&0x5007);
switch(A)
{
case 0x6000:
// case 0x6000:
case 0x5000:
EXPREGS[0]=V;
FixMMC3PRG(MMC3_cmd);
break;
case 0x6001:
// case 0x6001:
case 0x5001:
EXPREGS[1]=V;
FixMMC3CHR(MMC3_cmd);
break;
case 0x6007:
// case 0x6007:
case 0x5007:
EXPREGS[2]=V;
MMC3RegReset();

View File

@ -21,24 +21,24 @@
#include "mapinc.h"
#include "mmc3.h"
static uint8 chrcmd[8], prg0, prg1, brck, mirr;
static uint8 chrcmd[8], prg0, prg1, brk, latc, mirr;
static SFORMAT StateRegs[]=
{
{chrcmd, 8, "CHRCMD"},
{&prg0, 1, "PRG0"},
{&prg1, 1, "PRG1"},
{&brck, 1, "BRK"},
{&brk, 1, "BRK"},
{&mirr, 1, "MIRR"},
{0}
};
static void Sync(void)
{
int i;
setprg8(0x8000,prg0);
setprg8(0xA000,prg1);
setprg8(0xC000,~1);
setprg8(0xE000,~0);
int i;
for(i=0; i<8; i++)
setchr1(i<<10,chrcmd[i]);
setmirror(mirr^1);
@ -46,22 +46,35 @@ static void Sync(void)
static void UNLSL1632CW(uint32 A, uint8 V)
{
setchr1(A,V);
int cbase=(MMC3_cmd&0x80)<<5;
int page0=(brk&0x08)<<5;
int page1=(brk&0x20)<<3;
int page2=(brk&0x80)<<1;
setchr1(cbase^0x0000,page0|(DRegBuf[0]&(~1)));
setchr1(cbase^0x0400,page0|DRegBuf[0]|1);
setchr1(cbase^0x0800,page0|(DRegBuf[1]&(~1)));
setchr1(cbase^0x0C00,page0|DRegBuf[1]|1);
setchr1(cbase^0x1000,page1|DRegBuf[2]);
setchr1(cbase^0x1400,page1|DRegBuf[3]);
setchr1(cbase^0x1800,page2|DRegBuf[4]);
setchr1(cbase^0x1c00,page2|DRegBuf[5]);
}
static DECLFW(UNLSL1632CMDWrite)
{
// FCEU_printf("bs %04x %02x %3d\n",A,V,scanline);
if((A&0xA131)==0xA131)
{
brck=V;
brk=V;
latc = brk;
}
if(brck&2)
if(brk&2)
{
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
if(A<0xC000)
{
MMC3_CMDWrite(A,V);
}
else
MMC3_IRQWrite(A,V);
}
@ -86,7 +99,7 @@ static DECLFW(UNLSL1632CMDWrite)
static void StateRestore(int version)
{
if(brck&2)
if(brk&2)
{
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
@ -104,7 +117,7 @@ static void UNLSL1632Power(void)
void UNLSL1632_Init(CartInfo *info)
{
GenMMC3_Init(info, 256, 256, 0, 0);
GenMMC3_Init(info, 256, 512, 0, 0);
cwrap=UNLSL1632CW;
info->Power=UNLSL1632Power;
GameStateRestore=StateRestore;

View File

@ -43,7 +43,7 @@
{0x1500e835,48,8}, /* Jetsons (J) */
{0x637134e8,193,1}, /* Fighting Hero */
{0xcbf4366f,158,8}, /* Alien Syndrome (U.S. unlicensed) */
{0xcbf4366f,118,8}, /* Alien Syndrome (U.S. unlicensed) */
{0xb19a55dd,64,8}, /* Road Runner */
//{0x3eafd012,116,-1}, /* AV Girl Fighting */
{0x1d0f4d6b,2,1}, /* Black Bass thinging */
@ -199,15 +199,37 @@
{0x555a555e,191,-1},
{0x98c1cd4b,192,-1},/* Ying Lie Qun Xia Zhuan (Chinese) */
{0x442f1a29,192,-1},/* Young chivalry */
{0xa9115bc1,192,-1},
{0x4c7bbb0e,192,-1},
{0xa145fae6,192,-1},
{0xa925226c,194,-1},/* Dai-2-Ji - Super Robot Taisen (As) */
{0xd5224fde,198,-1},/* [074]Crystalis (c) */
{0x1bc0be6c,198,-1},/* Captain Tsubasa Vol 2 - Super Striker (C) */
{0xdd431ba7,199,-1},/* Tenchi wo kurau 2 (c) */
{0x28192599,199,-1},
{0x700705f4,199,-1},
{0x9a2cf02c,199,-1},
{0xd8b401a7,199,-1},
{0xd5224fde,195,-1},/* Crystalis (c) */
{0x1bc0be6c,195,-1},/* Captain Tsubasa Vol 2 - Super Striker (C) */
{0x33c5df92,195,-1},
{0xdd431ba7,198,-1},/* Tenchi wo kurau 2 (c) */
{0x28192599,198,-1},
{0x700705f4,198,-1},
{0x9a2cf02c,198,-1},
{0xd8b401a7,198,-1},
{0x19b9e732,198,-1},
{0xd871d3e6,199,-1},/* Dragon Ball Z 2 - Gekishin Freeza! (C) */
{0xed481b7c,199,-1},/* Dragon Ball Z Gaiden - Saiya Jin Zetsumetsu Keikaku (C) */
{0x44c20420,199,-1},/* San Guo Zhi 2 (C) */
{0x1f1326d4,218,-1},
{0xa1dc16c0,116,-1},
{0xcc868d4e,149,-1}, /* 16 Mahjong [p1][!] */
{0x48239b42,146,-1}, /* Mahjong Companion (Sachen) [!] */
{0xb6a727fa,146,-1}, /* Papillion (As) [!] */
{0xa62b79e1,146,-1}, /* Side Winder (HES) [!] */
{0x73fb55ac,150,-1}, /* 2-in-1 Cosmo Cop + Cyber Monster (Sachen) [!] */
{0xddcbda16,150,-1}, /* 2-in-1 Tough Cop + Super Tough Cop (Sachen) [!] */
{0x29582ca1,150,-1},
{0x40dbf7a2,150,-1},
{0x5aefbc94,133,-1}, /* Jovial Race (Sachen) [a1][!] */
{0x22d6d5bd,4,1},
{0x6a03d3f3,114,-1},
{0,-1,-1}