@@ -136,6 +136,11 @@ static void M178Power(void) {
|
||||
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
|
||||
}
|
||||
|
||||
static void M178Reset(void) {
|
||||
/* Always reset to menu */
|
||||
reg[0] = reg[1] = reg[2] = reg[3] = 0;
|
||||
Sync();
|
||||
}
|
||||
static void M178SndClk(int a) {
|
||||
if (pcm_enable) {
|
||||
pcm_latch -= a;
|
||||
@@ -158,6 +163,7 @@ static void StateRestore(int version) {
|
||||
|
||||
void Mapper178_Init(CartInfo *info) {
|
||||
info->Power = M178Power;
|
||||
info->Reset = M178Reset;
|
||||
info->Close = M178Close;
|
||||
GameStateRestore = StateRestore;
|
||||
MapIRQHook = M178SndClk;
|
||||
|
||||
109
src/boards/236.c
Normal file
109
src/boards/236.c
Normal file
@@ -0,0 +1,109 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[2];
|
||||
static uint8 dip;
|
||||
static uint8 chrramvariant;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 2, "REG " },
|
||||
{ &dip, 1, "DIP " },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
int prg;
|
||||
if (chrramvariant)
|
||||
{
|
||||
prg = reg[1] &7 | reg[0] <<3;
|
||||
}
|
||||
else
|
||||
{
|
||||
prg = reg[1] &15;
|
||||
}
|
||||
switch (reg[1] >>4 &3)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
setprg16(0x8000, prg);
|
||||
setprg16(0xC000, prg |7);
|
||||
break;
|
||||
case 2:
|
||||
setprg32(0x8000, prg >>1);
|
||||
break;
|
||||
case 3:
|
||||
setprg16(0x8000, prg);
|
||||
setprg16(0xC000, prg);
|
||||
break;
|
||||
}
|
||||
setchr8(reg[0] &15);
|
||||
setmirror((reg[0] >>5 &1) ^1);
|
||||
}
|
||||
|
||||
|
||||
static DECLFR(M236Read)
|
||||
{
|
||||
if ((reg[1] >>4 &3) ==1)
|
||||
return CartBR(A &~0xF | dip &0xF);
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(M236WriteReg)
|
||||
{
|
||||
reg[A >>14 &1] =A &0xFF;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M236Power(void)
|
||||
{
|
||||
dip = 0;
|
||||
reg[0] = 0;
|
||||
reg[1] = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000, 0xFFFF, M236WriteReg);
|
||||
SetReadHandler(0x8000, 0xFFFF, M236Read);
|
||||
}
|
||||
|
||||
static void M236Reset(void)
|
||||
{
|
||||
++dip;
|
||||
/* Soft-reset returns to menu */
|
||||
reg[0] = 0;
|
||||
reg[1] = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper236_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = M236Power;
|
||||
info->Reset = M236Reset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
chrramvariant = info->CHRRomSize == 0;
|
||||
}
|
||||
86
src/boards/319.c
Normal file
86
src/boards/319.c
Normal file
@@ -0,0 +1,86 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[2];
|
||||
static uint8 latch;
|
||||
static uint8 pad;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ reg, 2, "REG" },
|
||||
{ &latch, 1, "LATC" },
|
||||
{ &pad, 1, "PAD" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void M319Sync (void) {
|
||||
if (reg[1] &0x40)
|
||||
setprg32(0x8000, reg[1] >>3 &3);
|
||||
else
|
||||
{
|
||||
setprg16(0x8000, reg[1] >>2 &6 | reg[1] >>5 &1);
|
||||
setprg16(0xC000, reg[1] >>2 &6 | reg[1] >>5 &1);
|
||||
}
|
||||
setchr8(reg[0] >>4 &~(reg[0] <<2 &4) | latch <<2 &(reg[0] <<2 &4));
|
||||
setmirror(reg[1] >>7);
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
M319Sync();
|
||||
}
|
||||
|
||||
static DECLFR(M319ReadPad) {
|
||||
return pad;
|
||||
}
|
||||
|
||||
static DECLFW(M319WriteReg) {
|
||||
reg[A >>2 &1] =V;
|
||||
M319Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M319WriteLatch) {
|
||||
latch =V;
|
||||
M319Sync();
|
||||
}
|
||||
|
||||
static void M319Reset(void) {
|
||||
reg[0] =reg[1] =latch =0;
|
||||
pad ^=0x40;
|
||||
M319Sync();
|
||||
}
|
||||
|
||||
static void M319Power(void) {
|
||||
reg[0] =reg[1] =latch =pad =0;
|
||||
M319Sync();
|
||||
SetReadHandler(0x5000, 0x5FFF, M319ReadPad);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, M319WriteReg);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M319WriteLatch);
|
||||
}
|
||||
|
||||
void Mapper319_Init(CartInfo *info) {
|
||||
info->Power = M319Power;
|
||||
info->Reset = M319Reset;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
65
src/boards/376.c
Normal file
65
src/boards/376.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/* FCEUmm - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2019 Libretro Team
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static void Mapper376CW(uint32 A, uint8 V) {
|
||||
uint32 base = (EXPREGS[0] &0x40? 0x080: 0x000) | (EXPREGS[1] &0x01? 0x100: 0x000);
|
||||
setchr1(A, base | (V & 0x7F));
|
||||
}
|
||||
|
||||
static void Mapper376PW(uint32 A, uint8 V) {
|
||||
uint32 base = (EXPREGS[0] &0x07) | (EXPREGS[0] &0x40? 0x08: 0x00) | (EXPREGS[1] &0x01? 0x10: 0x00);
|
||||
if (EXPREGS[0] & 0x80) {
|
||||
if (EXPREGS[0] &0x20) {
|
||||
if (A ==0x8000) setprg32(A, base >>1);
|
||||
} else {
|
||||
if (A ==0x8000 || A ==0xC000) setprg16(A, base);
|
||||
}
|
||||
} else
|
||||
setprg8(A, (base << 1) | (V & 0x0F));
|
||||
}
|
||||
|
||||
static DECLFW(Mapper376Write) {
|
||||
EXPREGS[A & 1] = V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void Mapper376Reset(void) {
|
||||
EXPREGS[0] = 0;
|
||||
EXPREGS[1] = 0;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void Mapper376Power(void) {
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x6000, 0x7FFF, Mapper376Write);
|
||||
}
|
||||
|
||||
void Mapper376_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 256, 1, 0);
|
||||
pwrap = Mapper376PW;
|
||||
cwrap = Mapper376CW;
|
||||
info->Power = Mapper376Power;
|
||||
info->Reset = Mapper376Reset;
|
||||
AddExState(EXPREGS, 2, 0, "EXPR");
|
||||
}
|
||||
108
src/boards/383.c
Normal file
108
src/boards/383.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* 晶太 YY840708C PCB
|
||||
Solely used for the "1995 Soccer 6-in-1 足球小将專輯 (JY-014)" multicart.
|
||||
MMC3+PAL16L8 combination, resulting in a bizarre mapper that switches banks in part upon *reads*.
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
#define A15 EXPREGS[0]
|
||||
#define A16 EXPREGS[1]
|
||||
#define A17A18 EXPREGS[2]
|
||||
|
||||
static void M383PRGWrap (uint32 A, uint8 V)
|
||||
{
|
||||
switch(A17A18)
|
||||
{
|
||||
case 0x00:
|
||||
/* "Setting 0 provides a round-about means of dividing the first 128 KiB bank into two 32 KiB and one 64 KiB bank." */
|
||||
setprg8(A, V &(A16? 0x07: 0x03) | (A16? 0x00: A15) | A16 | A17A18);
|
||||
break;
|
||||
case 0x30:
|
||||
/* "Setting 3 provides 128 KiB MMC3 banking with the CPU A14 line fed to the MMC3 clone reversed.
|
||||
This is used for the game Tecmo Cup: Soccer Game (renamed "Tecmo Cup Soccer"),
|
||||
originally an MMC1 game with the fixed bank at $8000-$BFFF and the switchable bank at $C000-$FFFF,
|
||||
a configuration that could not be reproduced with an MMC3 alone." */
|
||||
setprg8(A ^0x4000, V &0x0F | A17A18);
|
||||
|
||||
/* "It is also used for the menu,
|
||||
which in part executes from PRG-ROM mapped to the CPU $6000-$7FFF address range on the MMC3 clone's fixed banks alone,
|
||||
as no MMC3 PRG bank register is written to before JMPing to this address range." */
|
||||
if (A ==0xE000) setprg8(A ^0x8000, V &0x0B | A17A18);
|
||||
break;
|
||||
default:
|
||||
/* "Settings 1 and 2 provide normal 128 KiB MMC3 banking." */
|
||||
setprg8(A, V &0x0F | A17A18);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M383CHRWrap (uint32 A, uint8 V)
|
||||
{
|
||||
setchr1(A, V &0x7F | A17A18 <<3);
|
||||
}
|
||||
|
||||
static DECLFR(M383Read)
|
||||
{
|
||||
if (A17A18 ==0x00)
|
||||
{ /* "PAL PRG A16 is updated with the content of the corresponding MMC3 PRG bank bit by reading from the respective address range,
|
||||
which in turn will then be applied across the entire ROM address range." */
|
||||
A16 =DRegBuf[0x06 | A >>13 &0x01] &0x08;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(M383Write)
|
||||
{
|
||||
if (A &0x0100)
|
||||
{
|
||||
A15 =A >>11 &0x04;
|
||||
A17A18 =A &0x30;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
if (A &0x4000)
|
||||
MMC3_IRQWrite(A, V);
|
||||
else
|
||||
MMC3_CMDWrite(A, V);
|
||||
}
|
||||
|
||||
static void M383Reset (void) {
|
||||
EXPREGS[0] = 0;
|
||||
EXPREGS[1] = 0;
|
||||
EXPREGS[2] = 0;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void M383Power (void) {
|
||||
GenMMC3Power();
|
||||
SetReadHandler(0x8000, 0xBFFF, M383Read);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M383Write);
|
||||
}
|
||||
|
||||
void Mapper383_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 128, 8, 0);
|
||||
pwrap = M383PRGWrap;
|
||||
cwrap = M383CHRWrap;
|
||||
info->Power = M383Power;
|
||||
info->Reset = M383Reset;
|
||||
AddExState(EXPREGS, 3, 0, "EXPR");
|
||||
}
|
||||
@@ -54,8 +54,8 @@ static DECLFW(M57Write) {
|
||||
}
|
||||
|
||||
static void M57Power(void) {
|
||||
regs[1] = regs[0] = 0;
|
||||
hrd_flag = 0;
|
||||
regs[1] = regs[0] = 0; /* Always reset to menu */
|
||||
hrd_flag = 1; /* YH-xxx "Olympic" multicarts disable the menu after one selection */
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M57Write);
|
||||
SetReadHandler(0x6000, 0x6000, M57Read);
|
||||
@@ -63,6 +63,7 @@ static void M57Power(void) {
|
||||
}
|
||||
|
||||
static void M57Reset(void) {
|
||||
regs[1] = regs[0] = 0; /* Always reset to menu */
|
||||
hrd_flag++;
|
||||
hrd_flag &= 3;
|
||||
FCEU_printf("Select Register = %02x\n", hrd_flag);
|
||||
|
||||
@@ -62,8 +62,8 @@ void Bs5652AnalyzeReg()
|
||||
readDIP = exRegs[0] & 0x40;
|
||||
prgAND = exRegs[1] & 0x04 ? 0x0F : 0x1F;
|
||||
chrAND = exRegs[1] & 0x40 ? 0x7F : 0xFF;
|
||||
prgOR = (exRegs[1] & 0x03) << 4;
|
||||
chrOR = (exRegs[1] & 0x30) << 3 ;
|
||||
prgOR = (exRegs[1] & 0x03) << 4 | (exRegs[0] & 0x10) << 2;
|
||||
chrOR = (exRegs[1] & 0x30) << 3 | (exRegs[0] & 0x20) << 4;
|
||||
nrom = exRegs[0] & 0x08;
|
||||
nrom128 = exRegs[1] & 0x08;
|
||||
}
|
||||
|
||||
@@ -21,55 +21,85 @@
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static DECLFW(UNLA9746Write) {
|
||||
/* FCEU_printf("write raw %04x:%02x\n",A,V); */
|
||||
switch (A & 0xE003) {
|
||||
case 0x8000: EXPREGS[1] = V; EXPREGS[0] = 0; break;
|
||||
case 0x8002: EXPREGS[0] = V; EXPREGS[1] = 0; break;
|
||||
case 0x8001:
|
||||
{
|
||||
uint8 bits_rev = ((V & 0x20) >> 5) | ((V & 0x10) >> 3) | ((V & 0x08) >> 1) | ((V & 0x04) << 1);
|
||||
switch (EXPREGS[0]) {
|
||||
case 0x26: setprg8(0x8000, bits_rev); break;
|
||||
case 0x25: setprg8(0xA000, bits_rev); break;
|
||||
case 0x24: setprg8(0xC000, bits_rev); break;
|
||||
case 0x23: setprg8(0xE000, bits_rev); break;
|
||||
static void UNLA9746PWrap(uint32 A, uint8 V) {
|
||||
setprg8(A, EXPREGS[1] <<4 | V &0x0F);
|
||||
}
|
||||
|
||||
static void UNLA9746CWrap(uint32 A, uint8 V) {
|
||||
setchr1(A, EXPREGS[1] <<7 | V &0x7F);
|
||||
}
|
||||
|
||||
static DECLFW(UNLA9746WriteOuter) {
|
||||
switch(A &1) {
|
||||
case 0: EXPREGS[1] =EXPREGS[1] &~1 | V >>3 &1; break;
|
||||
case 1: EXPREGS[1] =EXPREGS[1] &~2 | V >>4 &2; break;
|
||||
}
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
|
||||
static DECLFW(UNLA9746WriteASIC) {
|
||||
int index;
|
||||
|
||||
if (A &1)
|
||||
{ /* Register data */
|
||||
if (~EXPREGS[0] &0x20)
|
||||
{ /* Scrambled mode inactive */
|
||||
MMC3_CMDWrite(A, V);
|
||||
}
|
||||
switch (EXPREGS[1]) {
|
||||
case 0x0a:
|
||||
case 0x08: EXPREGS[2] = (V << 4); break;
|
||||
case 0x09: setchr1(0x0000, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x0b: setchr1(0x0400, EXPREGS[2] | (V >> 1) | 1); break;
|
||||
case 0x0c:
|
||||
case 0x0e: EXPREGS[2] = (V << 4); break;
|
||||
case 0x0d: setchr1(0x0800, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x0f: setchr1(0x0c00, EXPREGS[2] | (V >> 1) | 1); break;
|
||||
case 0x10:
|
||||
case 0x12: EXPREGS[2] = (V << 4); break;
|
||||
case 0x11: setchr1(0x1000, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x14:
|
||||
case 0x16: EXPREGS[2] = (V << 4); break;
|
||||
case 0x15: setchr1(0x1400, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x18:
|
||||
case 0x1a: EXPREGS[2] = (V << 4); break;
|
||||
case 0x19: setchr1(0x1800, EXPREGS[2] | (V >> 1)); break;
|
||||
case 0x1c:
|
||||
case 0x1e: EXPREGS[2] = (V << 4); break;
|
||||
case 0x1d: setchr1(0x1c00, EXPREGS[2] | (V >> 1)); break;
|
||||
else
|
||||
{ /* Scrambled mode active */
|
||||
if (MMC3_cmd >=0x08 && MMC3_cmd <=0x1F)
|
||||
{ /* Scrambled CHR register */
|
||||
index = (MMC3_cmd -8) >>2;
|
||||
if (MMC3_cmd &1)
|
||||
{ /* LSB nibble */
|
||||
DRegBuf[index] &=~0x0F;
|
||||
DRegBuf[index] |=V >>1 &0x0F;
|
||||
}
|
||||
else
|
||||
{ /* MSB nibble */
|
||||
DRegBuf[index] &=~0xF0;
|
||||
DRegBuf[index] |=V <<4 &0xF0;
|
||||
}
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
else
|
||||
if (MMC3_cmd >=0x25 && MMC3_cmd <=0x26)
|
||||
{ /* Scrambled PRG register */
|
||||
DRegBuf[6 | MMC3_cmd &1] =V >>5 &1 | V >>3 &2 | V >>1 &4 | V <<1 &8;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
else
|
||||
{ /* Register index */
|
||||
MMC3_CMDWrite(A, V);
|
||||
if (A &2) EXPREGS[0] =V;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLA9746Power(void) {
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x8000, 0xbfff, UNLA9746Write);
|
||||
SetWriteHandler(0x5000, 0x5FFF, UNLA9746WriteOuter);
|
||||
SetWriteHandler(0x8000, 0xBFFF, UNLA9746WriteASIC);
|
||||
EXPREGS[0] = 0;
|
||||
EXPREGS[1] = 3;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void UNLA9746Reset(void) {
|
||||
EXPREGS[0] = 0;
|
||||
EXPREGS[1] = 3;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
void UNLA9746_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 256, 0, 0);
|
||||
GenMMC3_Init(info, 128, 128, 0, 0);
|
||||
pwrap = UNLA9746PWrap;
|
||||
cwrap = UNLA9746CWrap;
|
||||
info->Power = UNLA9746Power;
|
||||
AddExState(EXPREGS, 6, 0, "EXPR");
|
||||
info->Reset = UNLA9746Reset;
|
||||
AddExState(EXPREGS, 2, 0, "EXPR");
|
||||
}
|
||||
|
||||
|
||||
@@ -495,15 +495,64 @@ void Mapper231_Init(CartInfo *info) {
|
||||
}
|
||||
|
||||
/*------------------ Map 242 ---------------------------*/
|
||||
|
||||
static uint8 M242TwoChips;
|
||||
static void M242Sync(void) {
|
||||
uint32 S = latche & 1;
|
||||
uint32 p = (latche >> 2) & 0x1F;
|
||||
uint32 L = (latche >> 9) & 1;
|
||||
|
||||
if (M242TwoChips) {
|
||||
if (latche &0x600)
|
||||
{ /* First chip */
|
||||
p &= 0x1F;
|
||||
}
|
||||
else
|
||||
{ /* Second chip */
|
||||
p &= 0x07;
|
||||
p += 0x20;
|
||||
}
|
||||
}
|
||||
|
||||
if ((latche >> 7) & 1) {
|
||||
if (S) {
|
||||
setprg32(0x8000, p >> 1);
|
||||
} else {
|
||||
setprg16(0x8000, p);
|
||||
setprg16(0xC000, p);
|
||||
}
|
||||
} else {
|
||||
if (S) {
|
||||
if (L) {
|
||||
setprg16(0x8000, p & 0x3E);
|
||||
setprg16(0xC000, p | 7);
|
||||
} else {
|
||||
setprg16(0x8000, p & 0x3E);
|
||||
setprg16(0xC000, p & 0x38);
|
||||
}
|
||||
} else {
|
||||
if (L) {
|
||||
setprg16(0x8000, p);
|
||||
setprg16(0xC000, p | 7);
|
||||
} else {
|
||||
setprg16(0x8000, p);
|
||||
setprg16(0xC000, p & 0x38);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasBattery && (latche & 0x80) == 0x80)
|
||||
/* CHR-RAM write protect hack, needed for some multicarts */
|
||||
SetupCartCHRMapping(0, CHRptr[0], 0x2000, 0);
|
||||
else
|
||||
SetupCartCHRMapping(0, CHRptr[0], 0x2000, 1);
|
||||
|
||||
setmirror(((latche >> 1) & 1) ^ 1);
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg32(0x8000, (latche >> 3) & 0xf);
|
||||
setmirror(((latche >> 1) & 1) ^ 1);
|
||||
}
|
||||
|
||||
void Mapper242_Init(CartInfo *info) {
|
||||
M242TwoChips = info->PRGRomSize &0x20000 && info->PRGRomSize >0x20000;
|
||||
Latch_Init(info, M242Sync, NULL, 0x0000, 0x8000, 0xFFFF, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ static SFORMAT StateRegs[] =
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (regs[0] & 0x80) {
|
||||
if (regs[0] & 0x80) { /* NROM mode */
|
||||
if (regs[1] & 0x80)
|
||||
setprg32(0x8000, regs[1] & 0x1F);
|
||||
else {
|
||||
@@ -39,9 +39,9 @@ static void Sync(void) {
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, bank);
|
||||
}
|
||||
} else {
|
||||
int bank = ((regs[1] & 0x1f) << 1) | ((regs[1] >> 6) & 1);
|
||||
setprg16(0xC000, bank);
|
||||
} else { /* UNROM mode */
|
||||
setprg16(0x8000, regs[1] <<1 | regs[3] &7);
|
||||
setprg16(0xC000, regs[1] <<1 | 7);
|
||||
}
|
||||
if (regs[0] & 0x20)
|
||||
setmirror(MI_H);
|
||||
@@ -51,6 +51,8 @@ static void Sync(void) {
|
||||
}
|
||||
|
||||
static DECLFW(BMC64in1nrWriteLo) {
|
||||
A &=3;
|
||||
if (A ==3) A =1; /* K-42001's "Aladdin III" */
|
||||
regs[A & 3] = V;
|
||||
Sync();
|
||||
}
|
||||
@@ -65,17 +67,26 @@ static void BMC64in1nrPower(void) {
|
||||
regs[1] = 0x43;
|
||||
regs[2] = regs[3] = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x5000, 0x5003, BMC64in1nrWriteLo);
|
||||
SetWriteHandler(0x5000, 0x5FFF, BMC64in1nrWriteLo);
|
||||
SetWriteHandler(0x8000, 0xFFFF, BMC64in1nrWriteHi);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void BMC64in1nrReset(void) {
|
||||
/* Reset returns to menu */
|
||||
regs[0] = 0x80;
|
||||
regs[1] = 0x43;
|
||||
regs[2] = regs[3] = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC64in1nr_Init(CartInfo *info) {
|
||||
info->Power = BMC64in1nrPower;
|
||||
info->Reset = BMC64in1nrReset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore = StateRestore;
|
||||
}
|
||||
|
||||
@@ -126,15 +126,6 @@ void NROM_Init(CartInfo *info) {
|
||||
/*------------------ Map 2 ---------------------------*/
|
||||
|
||||
static void UNROMSync(void) {
|
||||
#if 0
|
||||
static uint32 mirror_in_use = 0;
|
||||
if (PRGsize[0] <= 128 * 1024) {
|
||||
setprg16(0x8000, latche & 0x7);
|
||||
if ((latche & 0xF8) == 0x08) mirror_in_use = 1;
|
||||
if (mirror_in_use)
|
||||
setmirror(((latche >> 3) & 1) ^ 1); /* Higway Star Hacked mapper to be redefined to another mapper */
|
||||
} else
|
||||
#endif
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg16(0x8000, latche);
|
||||
setprg16(0xc000, ~0);
|
||||
@@ -142,7 +133,8 @@ static void UNROMSync(void) {
|
||||
}
|
||||
|
||||
void UNROM_Init(CartInfo *info) {
|
||||
Latch_Init(info, UNROMSync, 0, 0x8000, 0xFFFF, 1, 0);
|
||||
/* By default, do not emulate bus conflicts except when explicitly told by a NES 2.0 header to do so. */
|
||||
Latch_Init(info, UNROMSync, 0, 0x8000, 0xFFFF, 1, info->iNES2 && info->submapper == 2);
|
||||
}
|
||||
|
||||
/*------------------ Map 3 ---------------------------*/
|
||||
@@ -154,11 +146,8 @@ static void CNROMSync(void) {
|
||||
}
|
||||
|
||||
void CNROM_Init(CartInfo *info) {
|
||||
uint8 CNROM_busc = 1; /* by default, CNROM is set to emulate bus conflicts to all games. */
|
||||
if (info->submapper && info->submapper == 1) /* no bus conflict */
|
||||
CNROM_busc = 0;
|
||||
FCEU_printf(" Bus Conflict: %s\n", CNROM_busc ? "Yes" : "No");
|
||||
Latch_Init(info, CNROMSync, 0, 0x8000, 0xFFFF, 1, CNROM_busc);
|
||||
/* By default, do not emulate bus conflicts except when explicitly told by a NES 2.0 header to do so. */
|
||||
Latch_Init(info, CNROMSync, 0, 0x8000, 0xFFFF, 1, info->iNES2 && info->submapper == 2);
|
||||
}
|
||||
|
||||
/*------------------ Map 7 ---------------------------*/
|
||||
|
||||
@@ -20,45 +20,25 @@
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
/* This source code file only applies to Sanchez' original UNIF file with the incorrect bank order.
|
||||
The correctly-specified mapper, used for all NES 2.0 ROM files, is implemented in 319.c. */
|
||||
|
||||
static uint8 regs[2];
|
||||
static uint8 _submapper = 0;
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 2, "REGS" },
|
||||
{ &_submapper ,1, "SUBM"},
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
/* submapper 1 The code for the original fceux
|
||||
* submapper 0 new HP898F code by dragon2snow,loong2snow from www.nesbbs.com
|
||||
*/
|
||||
static void Sync(void) {
|
||||
|
||||
if (_submapper == 1)
|
||||
{
|
||||
uint8 chr = (regs[0] >> 4) & 7;
|
||||
uint8 prg = (regs[1] >> 3) & 7;
|
||||
uint8 dec = (regs[1] >> 4) & 4;
|
||||
setchr8(chr & (~(((regs[0] & 1) << 2) | (regs[0] & 2))));
|
||||
setprg16(0x8000, prg & (~dec));
|
||||
setprg16(0xC000, prg | dec);
|
||||
setmirror(regs[1] >> 7);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (regs[1] & 0x40)
|
||||
setprg32(0x8000, regs[1] >> 1);
|
||||
else {
|
||||
setprg16(0x8000, regs[1]);
|
||||
setprg16(0xC000, regs[1]);
|
||||
}
|
||||
setchr8((regs[0] >> 4) &~(((regs[0] & 1) ? 4 : 0) | (regs[0] & 2)));
|
||||
if (regs[1] & 0x80)
|
||||
setmirror(1);
|
||||
else
|
||||
setmirror(0);
|
||||
}
|
||||
static void Sync(void) {
|
||||
uint8 chr = (regs[0] >> 4) & 7;
|
||||
uint8 prg = (regs[1] >> 3) & 7;
|
||||
uint8 dec = (regs[1] >> 4) & 4;
|
||||
setchr8(chr & (~(((regs[0] & 1) << 2) | (regs[0] & 2))));
|
||||
setprg16(0x8000, prg & (~dec));
|
||||
setprg16(0xC000, prg | dec);
|
||||
setmirror(regs[1] >> 7);
|
||||
}
|
||||
|
||||
static DECLFW(HP898FWrite) {
|
||||
@@ -78,17 +58,8 @@ static DECLFW(HP898FWriteEx) {
|
||||
static void HP898FPower(void) {
|
||||
regs[0] = regs[1] = 0;
|
||||
Sync();
|
||||
if (_submapper == 1)
|
||||
{
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0xFFFF, HP898FWrite);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, HP898FWriteEx);
|
||||
SetWriteHandler(0xE000, 0xFFFF, HP898FWriteEx);
|
||||
}
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0xFFFF, HP898FWrite);
|
||||
}
|
||||
|
||||
static void HP898FReset(void) {
|
||||
@@ -101,7 +72,6 @@ static void StateRestore(int version) {
|
||||
}
|
||||
|
||||
void BMCHP898F_Init(CartInfo *info) {
|
||||
_submapper = info->submapper;
|
||||
info->Reset = HP898FReset;
|
||||
info->Power = HP898FPower;
|
||||
GameStateRestore = StateRestore;
|
||||
|
||||
@@ -1080,13 +1080,11 @@ static void M196PW(uint32 A, uint8 V) {
|
||||
}
|
||||
|
||||
static DECLFW(Mapper196Write) {
|
||||
if (A >= 0xC000) {
|
||||
A = (A & 0xFFFE) | ((A >> 2) & 1) | ((A >> 3) & 1);
|
||||
A =A &0xF000 | (!!(A &0xE) ^(A &1));
|
||||
if (A >= 0xC000)
|
||||
MMC3_IRQWrite(A, V);
|
||||
} else {
|
||||
A = (A & 0xFFFE) | ((A >> 2) & 1) | ((A >> 3) & 1) | ((A >> 1) & 1);
|
||||
else
|
||||
MMC3_CMDWrite(A, V);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(Mapper196WriteLo) {
|
||||
|
||||
@@ -655,7 +655,7 @@ INES_BOARD_BEGIN()
|
||||
INES_BOARD( "BMC 22+20-in-1 RST", 233, Mapper233_Init )
|
||||
INES_BOARD( "BMC MAXI", 234, Mapper234_Init )
|
||||
INES_BOARD( "Golden Game", 235, Mapper235_Init )
|
||||
/* INES_BOARD( "", 236, Mapper236_Init ) */
|
||||
INES_BOARD( "Realtec 8155", 236, Mapper236_Init )
|
||||
INES_BOARD( "Teletubbies / Y2K", 237, Mapper237_Init )
|
||||
INES_BOARD( "UNL6035052", 238, UNL6035052_Init )
|
||||
/* INES_BOARD( "", 239, Mapper239_Init ) */
|
||||
@@ -695,9 +695,11 @@ INES_BOARD_BEGIN()
|
||||
INES_BOARD( "Golden Mario Party II - Around the World 6-in-1", 370, Mapper370_Init )
|
||||
INES_BOARD( "MMC3 PIRATE SFC-12", 372, Mapper372_Init )
|
||||
INES_BOARD( "95/96 Super HiK 4-in-1", 374, Mapper374_Init )
|
||||
INES_BOARD( "YY841155C", 376, Mapper376_Init )
|
||||
INES_BOARD( "42 to 80,000 (970630C)", 380, Mapper380_Init )
|
||||
INES_BOARD( "KN-42", 381, Mapper381_Init )
|
||||
INES_BOARD( "830928C", 382, Mapper382_Init )
|
||||
INES_BOARD( "YY840708C", 383, Mapper383_Init )
|
||||
INES_BOARD( "Caltron 9-in-1", 389, Mapper389_Init )
|
||||
INES_BOARD( "Realtec 8031", 390, Mapper390_Init )
|
||||
INES_BOARD( "NewStar 12-in-1/7-in-1", 293, Mapper293_Init )
|
||||
@@ -756,7 +758,7 @@ INES_BOARD_BEGIN()
|
||||
INES_BOARD( "RESET-TXROM", 313, BMCRESETTXROM_Init )
|
||||
INES_BOARD( "64in1NoRepeat", 314, BMC64in1nr_Init )
|
||||
INES_BOARD( "830134C", 315, BMC830134C_Init )
|
||||
INES_BOARD( "HP898F", 319, BMCHP898F_Init )
|
||||
INES_BOARD( "HP898F", 319, Mapper319_Init )
|
||||
INES_BOARD( "830425C-4391T", 320, BMC830425C4391T_Init )
|
||||
INES_BOARD( "K-3033", 322, BMCK3033_Init )
|
||||
INES_BOARD( "FARID_SLROM_8-IN-1", 323, FARIDSLROM8IN1_Init )
|
||||
|
||||
@@ -260,6 +260,7 @@ void Mapper269_Init(CartInfo *);
|
||||
void Mapper288_Init(CartInfo *);
|
||||
void Mapper293_Init(CartInfo *);
|
||||
void Mapper297_Init(CartInfo *);
|
||||
void Mapper319_Init(CartInfo *);
|
||||
void Mapper353_Init(CartInfo *);
|
||||
void Mapper356_Init(CartInfo *);
|
||||
void Mapper357_Init(CartInfo *);
|
||||
@@ -270,9 +271,11 @@ void Mapper369_Init(CartInfo *);
|
||||
void Mapper370_Init(CartInfo *);
|
||||
void Mapper372_Init(CartInfo *);
|
||||
void Mapper374_Init(CartInfo *);
|
||||
void Mapper376_Init(CartInfo *);
|
||||
void Mapper380_Init(CartInfo *);
|
||||
void Mapper381_Init(CartInfo *);
|
||||
void Mapper382_Init(CartInfo *);
|
||||
void Mapper383_Init(CartInfo *);
|
||||
void Mapper386_Init(CartInfo *);
|
||||
void Mapper387_Init(CartInfo *);
|
||||
void Mapper388_Init(CartInfo *);
|
||||
|
||||
Reference in New Issue
Block a user