update mapper 156 from fceu-mm sources

This commit is contained in:
zeromus 2012-08-31 18:34:36 +00:00
parent a4bcfa8599
commit 525deb4c65
8 changed files with 127 additions and 18 deletions

View File

@ -607,6 +607,7 @@ static BMAPPINGLocal bmap[] = {
{"", 153, Mapper153_Init},
{"", 154, Mapper154_Init},
{"", 155, Mapper155_Init},
{"", 156, Mapper156_Init},
{"", 159, Mapper159_Init},
{"SA009", 160, SA009_Init},
{"", 163, Mapper163_Init},
@ -1217,7 +1218,7 @@ void (*MapInitTab[256])(void)=
0, //Mapper153_init,
0, //Mapper154_init,
0,
Mapper156_init,
0,
Mapper157_init,
0, //Mapper158_init, removed
0,

View File

@ -281,7 +281,6 @@ void Mapper151_init(void);
//void Mapper152_init(void);
//void Mapper153_init(void);
void Mapper154_init(void);
void Mapper156_init(void);
void Mapper157_init(void);
//void Mapper158_init(void);
void Mapper159_init(void);
@ -421,6 +420,7 @@ void Mapper152_Init(CartInfo *);
void Mapper153_Init(CartInfo *);
void Mapper154_Init(CartInfo *);
void Mapper155_Init(CartInfo *);
void Mapper156_Init(CartInfo *);
void Mapper159_Init(CartInfo *);
void Mapper163_Init(CartInfo *);
void Mapper164_Init(CartInfo *);

112
src/mappers/156.cpp Normal file
View File

@ -0,0 +1,112 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2009 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
*
* DIS23C01 DAOU ROM CONTROLLER, Korea
* Metal Force (K)
* Buzz and Waldog (K)
* General's Son (K)
*
*/
#include "mapinc.h"
static uint8 chrlo[8], chrhi[8], prg, mirr, mirrisused = 0;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&prg, 1, "PREG"},
{chrlo, 8, "CRLO"},
{chrhi, 8, "CRHI"},
{&mirr, 1, "MIRR"},
{0}
};
static void Sync(void)
{
uint32 i;
for(i=0; i<8; i++)
setchr1(i<<10, chrlo[i]|(chrhi[i] << 8));
setprg8r(0x10,0x6000,0);
setprg16(0x8000,prg);
setprg16(0xC000,~0);
if(mirrisused)
setmirror(mirr ^ 1);
else
setmirror(MI_0);
}
static DECLFW(M156Write)
{
switch(A) {
case 0xC000:
case 0xC001:
case 0xC002:
case 0xC003: chrlo[A&3] = V; Sync(); break;
case 0xC004:
case 0xC005:
case 0xC006:
case 0xC007: chrhi[A&3] = V; Sync(); break;
case 0xC008:
case 0xC009:
case 0xC00A:
case 0xC00B: chrlo[4+(A&3)] = V; Sync(); break;
case 0xC00C:
case 0xC00D:
case 0xC00E:
case 0xC00F: chrhi[4+(A&3)] = V; Sync(); break;
case 0xC010: prg = V; Sync(); break;
case 0xC014: mirr = V; mirrisused = 1; Sync(); break;
}
}
static void M156Power(void)
{
Sync();
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetWriteHandler(0xC000,0xCFFF,M156Write);
}
static void M156Close(void)
{
if(WRAM)
FCEU_gfree(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void Mapper156_Init(CartInfo *info)
{
info->Power=M156Power;
info->Close=M156Close;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -86,19 +86,3 @@ void Mapper96_init(void)
// DIS23C01 Open Soft, Korea
// Metal Force (K)
// Buzz and Waldog (K)
static DECLFW(M156Write)
{
if(A>=0xc000 && A<=0xC003)
VROM_BANK1((A&3)*1024,V);
else if(A>=0xc008 && A<=0xc00b)
VROM_BANK1(0x1000+(A&3)*1024,V);
if(A==0xc010) ROM_BANK16(0x8000,V);
// printf("$%04x:$%02x\n",A,V);
}
void Mapper156_init(void)
{
onemir(0);
SetWriteHandler(0xc000,0xc010,M156Write);
}

View File

@ -536,6 +536,7 @@
<ClCompile Include="..\src\input\toprider.cpp" />
<ClCompile Include="..\src\input\zapper.cpp" />
<ClCompile Include="..\src\mappers\151.cpp" />
<ClCompile Include="..\src\mappers\156.cpp" />
<ClCompile Include="..\src\mappers\16.cpp" />
<ClCompile Include="..\src\mappers\17.cpp" />
<ClCompile Include="..\src\mappers\18.cpp" />

View File

@ -970,6 +970,9 @@
<ClCompile Include="..\src\drivers\win\taseditor\laglog.cpp">
<Filter>drivers\win\taseditor</Filter>
</ClCompile>
<ClCompile Include="..\src\mappers\156.cpp">
<Filter>mappers</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\cart.h">

View File

@ -589,6 +589,10 @@
RelativePath="..\src\boards\15.cpp"
>
</File>
<File
RelativePath="..\src\mappers\156.cpp"
>
</File>
<File
RelativePath="..\src\boards\164.cpp"
>

View File

@ -2213,6 +2213,10 @@
RelativePath="..\src\mappers\151.cpp"
>
</File>
<File
RelativePath="..\src\mappers\156.cpp"
>
</File>
<File
RelativePath="..\src\mappers\16.cpp"
>