UNIF KS-7057

UNIF CITYFIGHTER fceumm sync
This commit is contained in:
CaH4e3 2012-10-20 19:06:42 +00:00
parent ebc4253036
commit 53aa936635
7 changed files with 244 additions and 11 deletions

134
src/boards/cityfighter.cpp Normal file
View File

@ -0,0 +1,134 @@
/* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* City Fighter IV sith Sound VRC4 hacked
*/
#include "mapinc.h"
static int32 IRQCount;
static uint8 IRQa;
static uint8 prg_reg, prg_mode, mirr;
static uint8 chr_reg[8];
static writefunc pcmwrite;
static SFORMAT StateRegs[]=
{
{&IRQCount, 4, "IRQC"},
{&IRQa, 1, "IRQA"},
{&prg_reg, 1, "PREG"},
{&prg_mode, 1, "PMOD"},
{&mirr, 1, "MIRR"},
{chr_reg, 8, "CREG"},
{0}
};
static void Sync(void)
{
setprg32(0x8000,prg_reg>>2);
if(!prg_mode)
setprg8(0xC000,prg_reg);
int i;
for(i=0; i<8; i++)
setchr1(i<<10,chr_reg[i]);
switch (mirr)
{
case 0: setmirror(MI_V); break;
case 1: setmirror(MI_H); break;
case 2: setmirror(MI_0); break;
case 3: setmirror(MI_1); break;
}
}
static DECLFW(UNLCITYFIGHTWrite)
{
//FCEU_printf("%04x %02x",A,V);
switch(A&0xF00C)
{
case 0x9000: prg_reg=V&0xC; mirr=V&3; break;
case 0x9004:
case 0x9008:
case 0x900C:
if(A&0x800)
pcmwrite(0x4011,(V&0xf)<<3);
else
prg_reg=V&0xC;
break;
case 0xC000:
case 0xC004:
case 0xC008:
case 0xC00C: prg_mode=V&1; /*FCEU_printf(" mode %d\n", prg_mode);*/ break;
case 0xD000: chr_reg[0]=(chr_reg[0]&0xF0)|(V&0x0F); /*FCEU_printf(" chr0 lo\n");*/ break;
case 0xD004: chr_reg[0]=(chr_reg[0]&0x0F)|(V<<4); /*FCEU_printf(" chr0 hi %x\n", chr_reg[0]);*/ break;
case 0xD008: chr_reg[1]=(chr_reg[1]&0xF0)|(V&0x0F); /*FCEU_printf(" chr1 lo\n");*/ break;
case 0xD00C: chr_reg[1]=(chr_reg[1]&0x0F)|(V<<4); /*FCEU_printf(" chr1 hi %x\n", chr_reg[1]);*/ break;
case 0xA000: chr_reg[2]=(chr_reg[2]&0xF0)|(V&0x0F); /*FCEU_printf(" chr2 lo\n");*/ break;
case 0xA004: chr_reg[2]=(chr_reg[2]&0x0F)|(V<<4); /*FCEU_printf(" chr2 hi %x\n", chr_reg[2]);*/ break;
case 0xA008: chr_reg[3]=(chr_reg[3]&0xF0)|(V&0x0F); /*FCEU_printf(" chr3 lo\n");*/ break;
case 0xA00C: chr_reg[3]=(chr_reg[3]&0x0F)|(V<<4); /*FCEU_printf(" chr3 hi %x\n", chr_reg[3]);*/ break;
case 0xB000: chr_reg[4]=(chr_reg[4]&0xF0)|(V&0x0F); /*FCEU_printf(" chr4 lo\n");*/ break;
case 0xB004: chr_reg[4]=(chr_reg[4]&0x0F)|(V<<4); /*FCEU_printf(" chr4 hi %x\n", chr_reg[4]);*/ break;
case 0xB008: chr_reg[5]=(chr_reg[5]&0xF0)|(V&0x0F); /*FCEU_printf(" chr5 lo\n");*/ break;
case 0xB00C: chr_reg[5]=(chr_reg[5]&0x0F)|(V<<4); /*FCEU_printf(" chr5 hi %x\n", chr_reg[5]);*/ break;
case 0xE000: chr_reg[6]=(chr_reg[6]&0xF0)|(V&0x0F); /*FCEU_printf(" chr6 lo\n");*/ break;
case 0xE004: chr_reg[6]=(chr_reg[6]&0x0F)|(V<<4); /*FCEU_printf(" chr6 hi %x\n", chr_reg[6]);*/ break;
case 0xE008: chr_reg[7]=(chr_reg[7]&0xF0)|(V&0x0F); /*FCEU_printf(" chr7 lo\n");*/ break;
case 0xE00C: chr_reg[7]=(chr_reg[7]&0x0F)|(V<<4); /*FCEU_printf(" chr7 hi %x\n", chr_reg[7]);*/ break;
case 0xF000: IRQCount=((IRQCount&0x1E0)|((V&0xF)<<1)); break;
case 0xF004: IRQCount=((IRQCount&0x1E)|((V&0xF)<<5)); break;
case 0xF008: IRQa=V&2; X6502_IRQEnd(FCEU_IQEXT); break;
default:
break;
}
Sync();
}
static void UNLCITYFIGHTIRQ(int a)
{
if(IRQa)
{
IRQCount-=a;
if(IRQCount<=0)
{
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
static void UNLCITYFIGHTPower(void)
{
prg_reg = 0;
Sync();
pcmwrite=GetWriteHandler(0x4011);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,UNLCITYFIGHTWrite);
}
static void StateRestore(int version)
{
Sync();
}
void UNLCITYFIGHT_Init(CartInfo *info)
{
info->Power=UNLCITYFIGHTPower;
MapIRQHook=UNLCITYFIGHTIRQ;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

97
src/boards/ks7057.cpp Normal file
View File

@ -0,0 +1,97 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2011 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* FDS Conversion
*
*/
#include "mapinc.h"
static uint8 reg[8], mirror;
static SFORMAT StateRegs[]=
{
{reg, 8, "PRG"},
{&mirror, 1, "MIRR"},
{0}
};
static void Sync(void)
{
setprg2(0x6000,reg[4]);
setprg2(0x6800,reg[5]);
setprg2(0x7000,reg[6]);
setprg2(0x7800,reg[7]);
setprg2(0x8000,reg[0]);
setprg2(0x8800,reg[1]);
setprg2(0x9000,reg[2]);
setprg2(0x9800,reg[3]);
setprg8(0xA000,0xd);
setprg16(0xC000,7);
setchr8(0);
setmirror(mirror);
}
static DECLFW(UNLKS7057Write)
{
switch(A&0xF003) {
case 0x8000:
case 0x8001:
case 0x8002:
case 0x8003:
case 0x9000:
case 0x9001:
case 0x9002:
case 0x9003: mirror = V & 1; Sync(); break;
case 0xB000: reg[0] = (reg[0] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xB001: reg[0] = (reg[0] & 0x0F) | (V << 4); Sync(); break;
case 0xB002: reg[1] = (reg[1] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xB003: reg[1] = (reg[1] & 0x0F) | (V << 4); Sync(); break;
case 0xC000: reg[2] = (reg[2] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xC001: reg[2] = (reg[2] & 0x0F) | (V << 4); Sync(); break;
case 0xC002: reg[3] = (reg[3] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xC003: reg[3] = (reg[3] & 0x0F) | (V << 4); Sync(); break;
case 0xD000: reg[4] = (reg[4] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xD001: reg[4] = (reg[4] & 0x0F) | (V << 4); Sync(); break;
case 0xD002: reg[5] = (reg[5] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xD003: reg[5] = (reg[5] & 0x0F) | (V << 4); Sync(); break;
case 0xE000: reg[6] = (reg[6] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xE001: reg[6] = (reg[6] & 0x0F) | (V << 4); Sync(); break;
case 0xE002: reg[7] = (reg[7] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xE003: reg[7] = (reg[7] & 0x0F) | (V << 4); Sync(); break;
}
}
static void UNLKS7057Power(void)
{
Sync();
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,UNLKS7057Write);
}
static void UNLKS7057Reset(void)
{
Sync();
}
void UNLKS7057_Init(CartInfo *info)
{
info->Power=UNLKS7057Power;
info->Reset=UNLKS7057Reset;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -655,16 +655,7 @@ static BMAPPINGLocal bmap[] = {
{"", 216, Mapper216_Init},
// {"", 217, Mapper217_Init},
{"UNLA9746", 219, UNLA9746_Init},
{"OneBus", 220, UNLOneBus_Init},
// {220, BMCFK23C_Init},
// {220, UNL3DBlock_Init},
// {220, UNLTF1201_Init},
// {220, TCU02_Init},
// {220, UNLCN22M_Init},
// {220, BMCT2271_Init},
// {220, UNLDANCE_Init},
{"Debug Mapper", 220, UNLKS7057_Init},
{"UNLN625092", 221, UNLN625092_Init},
{"", 222, Mapper222_Init},
{"", 226, Mapper226_Init},

View File

@ -422,7 +422,9 @@ static BMAPPING bmap[] = {
{ "GS-2004", BMCGS2004_Init, 0},
{ "GS-2013", BMCGS2013_Init, 0},
{ "KS7032", UNLKS7032_Init, 0},
{ "KS7057", UNLKS7057_Init, 0},
{ "T-230", UNLT230_Init, 0},
{ "CITYFIGHT", UNLCITYFIGHT_Init, 0},
{ "190in1", BMC190in1_Init, 0},
{ "Ghostbusters63in1", BMCGhostbusters63in1_Init, 0},
{ "BS-5",BMCBS5_Init, 0},

View File

@ -114,7 +114,9 @@ void UNL8157_Init(CartInfo *info);
void UNL22211_Init(CartInfo *info);
void UNLTF1201_Init(CartInfo *info);
void UNLKS7032_Init(CartInfo *info);
void UNLKS7057_Init(CartInfo *info);
void UNLT230_Init(CartInfo *info);
void UNLCITYFIGHT_Init(CartInfo *info);
void UNLAX5705_Init(CartInfo *info);
void UNLDANCE_Init(CartInfo *info);
void UNLOneBus_Init(CartInfo *info);

View File

@ -265,6 +265,8 @@
<ClCompile Include="..\src\boards\88.cpp" />
<ClCompile Include="..\src\boards\90.cpp" />
<ClCompile Include="..\src\boards\95.cpp" />
<ClCompile Include="..\src\boards\cityfighter.cpp" />
<ClCompile Include="..\src\boards\ks7057.cpp" />
<ClCompile Include="..\src\boards\onebus.cpp" />
<ClCompile Include="..\src\boards\__dummy_mapper.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>

View File

@ -973,6 +973,12 @@
<ClCompile Include="..\src\mappers\156.cpp">
<Filter>mappers</Filter>
</ClCompile>
<ClCompile Include="..\src\boards\cityfighter.cpp">
<Filter>boards</Filter>
</ClCompile>
<ClCompile Include="..\src\boards\ks7057.cpp">
<Filter>boards</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\cart.h">
@ -1488,7 +1494,6 @@
<Filter>drivers\win\res</Filter>
</None>
<None Include="..\src\pputile.inc" />
<None Include="ClassDiagram1.cd" />
<None Include="..\src\drivers\win\res\branch_spritesheet.bmp">
<Filter>pix</Filter>
</None>