Add UNL-AX-40G

This commit is contained in:
retro-wertz
2019-06-24 18:03:18 +08:00
parent c9b3dfb8d5
commit db8a5ab2c9
3 changed files with 96 additions and 0 deletions

94
src/boards/ax40g.c Normal file
View File

@@ -0,0 +1,94 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* NES 2.0 Mapper 527 is used for a bootleg version of
* Taito's 不動明王伝 (Fudō Myōō Den).
* Its UNIF board name is UNL-AX-40G. The original INES Mapper 207 is
* replaced with a VRC2 clone (A0/A1, i.e. VRC2b) while retaining
* Mapper 207's extended mirroring.
*/
#include "mapinc.h"
static uint8 preg[2], creg[8], NT[2];
static SFORMAT StateRegs[] =
{
{ preg, 2, "PREG" },
{ creg, 8, "CREG" },
{ NT, 2, "NMT" },
{ 0 }
};
static void Sync(void) {
uint8 i;
setprg8(0x8000, preg[0]);
setprg8(0xA000, preg[1]);
setprg8(0xC000, 0x1E);
setprg8(0xE000, 0x1F);
for (i = 0; i < 8; i++)
setchr1(i << 10, creg[i]);
setmirrorw(NT[0], NT[0], NT[1], NT[1]);
}
static DECLFW(UNLAX40GWrite8) {
A &= 0xF003;
preg[0] = V & 0x1F;
Sync();
}
static DECLFW(UNLAX40GWriteA) {
A &= 0xF003;
preg[1] = V & 0x1F;
Sync();
}
static DECLFW(UNLAX40GWriteB) {
uint16 i, shift;
A &= 0xF003;
i = ((A >> 1) & 1) | ((A - 0xB000) >> 11);
shift = ((A & 1) << 2);
creg[i] = (creg[i] & (0xF0 >> shift)) | ((V & 0xF) << shift);
if (i < 2)
NT[i] = (creg[i] & 0x80) >> 7;
Sync();
}
static void UNLAX40GPower(void) {
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0x8FFF, UNLAX40GWrite8);
SetWriteHandler(0xA000, 0xAFFF, UNLAX40GWriteA);
SetWriteHandler(0xB000, 0xEFFF, UNLAX40GWriteB);
}
static void StateRestore(int version) {
Sync();
}
void UNLAX40G_Init(CartInfo *info) {
info->Power = UNLAX40GPower;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
/*void UNLAX40G_Init(CartInfo *info); // m527
{ "AX-40G", UNLAX40G_Init, 0 },
{ "JC-016-2", Mapper205_Init, 0 },
*/

View File

@@ -494,6 +494,7 @@ static BMAPPING bmap[] = {
{ "900218", BTL900218_Init, 0 },
{ "JC-016-2", Mapper205_Init, 0 },
{ "AX-40G", UNLAX40G_Init, 0 },
#ifdef COPYFAMI
{ "COPYFAMI_MMC3", MapperCopyFamiMMC3_Init, 0 },

View File

@@ -179,6 +179,7 @@ void BMCK3036_Init(CartInfo *info); /* m340 */
void MINDKIDS_Init(CartInfo *info); /* m268 */
void UNLKS7021A_Init(CartInfo *info); /* m525 */
void BTL900218_Init(CartInfo *info); /* m524 */
void UNLAX40G_Init(CartInfo *info); /* m527 */
#ifdef COPYFAMI
void MapperCopyFamiMMC3_Init(CartInfo *info);