Merge pull request #508 from NRS-NewRisingSun/mappers3
More mapper additions and improvements
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2015 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
|
||||
*
|
||||
* "Blood Of Jurassic" protected MMC3 based board (GD-98 Cart ID, 158B PCB ID)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 lut[8] = { 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0F, 0x00 };
|
||||
|
||||
static void UNL158BPW(uint32 A, uint8 V) {
|
||||
if (EXPREGS[0] & 0x80) {
|
||||
uint32 bank = EXPREGS[0] & 7;
|
||||
if(EXPREGS[0] & 0x20) { /* 32Kb mode */
|
||||
setprg32(0x8000, bank >> 1);
|
||||
} else { /* 16Kb mode */
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, bank);
|
||||
}
|
||||
} else {
|
||||
setprg8(A, V & 0xF);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(UNL158BProtWrite) {
|
||||
EXPREGS[A & 7] = V;
|
||||
switch(A & 7) {
|
||||
case 0:
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
break;
|
||||
case 7:
|
||||
FCEU_printf("UNK PROT WRITE\n");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static DECLFR(UNL158BProtRead) {
|
||||
return X.DB | lut[A & 7];
|
||||
}
|
||||
|
||||
static void UNL158BPower(void) {
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x5000, 0x5FFF, UNL158BProtWrite);
|
||||
SetReadHandler(0x5000, 0x5FFF, UNL158BProtRead);
|
||||
}
|
||||
|
||||
void UNL158B_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 128, 128, 0, 0);
|
||||
pwrap = UNL158BPW;
|
||||
info->Power = UNL158BPower;
|
||||
AddExState(EXPREGS, 8, 0, "EXPR");
|
||||
}
|
||||
61
src/boards/294.c
Normal file
61
src/boards/294.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2022 NewRisingSun
|
||||
*
|
||||
* 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 latch;
|
||||
|
||||
static void Mapper294_sync (void) {
|
||||
setprg16(0x8000, latch);
|
||||
setprg16(0xC000, latch |7);
|
||||
setchr8(0);
|
||||
setmirror(latch &0x80? MI_H: MI_V);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper294_writeInnerBank) {
|
||||
latch =latch &~7 | V&7;
|
||||
Mapper294_sync();
|
||||
}
|
||||
|
||||
static DECLFW(Mapper294_writeOuterBank) {
|
||||
if (A &0x100) {
|
||||
latch =latch &7 | V <<3;
|
||||
Mapper294_sync();
|
||||
}
|
||||
}
|
||||
|
||||
static void Mapper294_reset(void) {
|
||||
latch =0;
|
||||
Mapper294_sync();
|
||||
}
|
||||
|
||||
static void Mapper294_power(void) {
|
||||
Mapper294_reset();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, Mapper294_writeInnerBank);
|
||||
SetWriteHandler(0x4020, 0x7FFF, Mapper294_writeOuterBank);
|
||||
}
|
||||
|
||||
void Mapper294_Init(CartInfo *info) {
|
||||
info->Power = Mapper294_power;
|
||||
info->Reset = Mapper294_reset;
|
||||
AddExState(&latch, 1, 0, "LATC");
|
||||
}
|
||||
88
src/boards/310.c
Normal file
88
src/boards/310.c
Normal file
@@ -0,0 +1,88 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2022 NewRisingSun
|
||||
*
|
||||
* 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 regData[2];
|
||||
static uint8 regAddr;
|
||||
|
||||
static SFORMAT K1053_state[] =
|
||||
{
|
||||
{ regData, 2, "REGD" },
|
||||
{®Addr, 1, "REGA" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void K1053_sync (void) {
|
||||
int prg =regData[0] &0x3F | regAddr <<4 &~0x3F;
|
||||
int chrWritable;
|
||||
switch(regAddr &3) {
|
||||
case 0: setprg32(0x8000, prg >>1);
|
||||
chrWritable =0;
|
||||
break;
|
||||
case 1: setprg16(0x8000, prg);
|
||||
setprg16(0xC000, prg |7);
|
||||
chrWritable =1;
|
||||
break;
|
||||
case 2: prg =prg <<1 | regData[0] >>7;
|
||||
setprg8(0x8000, prg);
|
||||
setprg8(0xA000, prg);
|
||||
setprg8(0xC000, prg);
|
||||
setprg8(0xE000, prg);
|
||||
chrWritable =1;
|
||||
break;
|
||||
case 3: setprg16(0x8000, prg);
|
||||
setprg16(0xC000, prg);
|
||||
chrWritable =0;
|
||||
break;
|
||||
}
|
||||
SetupCartCHRMapping(0, CHRptr[0], 0x8000, chrWritable);
|
||||
setchr8(regData[1]);
|
||||
setmirror(regData[0] &0x40? MI_H: MI_V);
|
||||
}
|
||||
|
||||
static void K1053_restore(int version) {
|
||||
K1053_sync();
|
||||
}
|
||||
|
||||
static DECLFW(K1053_write) {
|
||||
regData[A >>14 &1] =V;
|
||||
if (A &0x4000) regAddr=A &0xFF;
|
||||
K1053_sync();
|
||||
}
|
||||
|
||||
static void K1053_reset(void) {
|
||||
regData[0] =regData[1] =regAddr =0;
|
||||
K1053_sync();
|
||||
}
|
||||
|
||||
static void K1053_power(void) {
|
||||
K1053_reset();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, K1053_write);
|
||||
}
|
||||
|
||||
void Mapper310_Init(CartInfo *info) {
|
||||
info->Power = K1053_power;
|
||||
info->Reset = K1053_reset;
|
||||
GameStateRestore = K1053_restore;
|
||||
AddExState(&K1053_state, ~0, 0, 0);
|
||||
}
|
||||
@@ -31,6 +31,8 @@ static uint8 VRCIRQ_latch;
|
||||
static uint8 VRCIRQ_mode;
|
||||
static uint8 VRCIRQ_count;
|
||||
static signed short int VRCIRQ_cycles;
|
||||
static uint8 *CHRRAM =NULL;
|
||||
static uint8 *PRGCHR =NULL;
|
||||
|
||||
static SFORMAT stateRegs[] = {
|
||||
{ reg, 4, "REGS" },
|
||||
@@ -63,34 +65,36 @@ static void sync () {
|
||||
int chrOR;
|
||||
int prgAND =reg[2] &0x04? 0x0F: 0x1F;
|
||||
int prgOR =reg[1] >>1;
|
||||
if (reg[2] &0x80) { /* NROM mode */
|
||||
int chip =reg[2] &0x01 && CHRRAM? 0x10: 0x00;
|
||||
|
||||
if (reg[2] &0x10) { /* NROM mode */
|
||||
if (reg[2] &0x04) { /* NROM-128 */
|
||||
setprg16(0x8000, prgOR >>1);
|
||||
setprg16(0xC000, prgOR >>1);
|
||||
setprg16r(chip, 0x8000, prgOR >>1);
|
||||
setprg16r(chip, 0xC000, prgOR >>1);
|
||||
} else /* NROM-256 */
|
||||
setprg32(0x8000, prgOR >>2);
|
||||
setprg32r(chip, 0x8000, prgOR >>2);
|
||||
} else
|
||||
if (~reg[0] &0x02) { /* MMC3 mode */
|
||||
setprg8(0x8000 ^(MMC3_index <<8 &0x4000), MMC3_reg[6] &prgAND | prgOR &~prgAND);
|
||||
setprg8(0xA000, MMC3_reg[7] &prgAND | prgOR &~prgAND);
|
||||
setprg8(0xC000 ^(MMC3_index <<8 &0x4000), 0xFE &prgAND | prgOR &~prgAND);
|
||||
setprg8(0xE000, 0xFF &prgAND | prgOR &~prgAND);
|
||||
setprg8r(chip, 0x8000 ^(MMC3_index <<8 &0x4000), MMC3_reg[6] &prgAND | prgOR &~prgAND);
|
||||
setprg8r(chip, 0xA000, MMC3_reg[7] &prgAND | prgOR &~prgAND);
|
||||
setprg8r(chip, 0xC000 ^(MMC3_index <<8 &0x4000), 0xFE &prgAND | prgOR &~prgAND);
|
||||
setprg8r(chip, 0xE000, 0xFF &prgAND | prgOR &~prgAND);
|
||||
} else
|
||||
if (reg[0] &0x01) { /* VRC4 mode */
|
||||
setprg8(0x8000 ^(VRC4_misc <<13 &0x4000), VRC4_prg[0] &prgAND | prgOR &~prgAND);
|
||||
setprg8(0xA000, VRC4_prg[1] &prgAND | prgOR &~prgAND);
|
||||
setprg8(0xC000 ^(VRC4_misc <<13 &0x4000), 0xFE &prgAND | prgOR &~prgAND);
|
||||
setprg8(0xE000, 0xFF &prgAND | prgOR &~prgAND);
|
||||
setprg8r(chip, 0x8000 ^(VRC4_misc <<13 &0x4000), VRC4_prg[0] &prgAND | prgOR &~prgAND);
|
||||
setprg8r(chip, 0xA000, VRC4_prg[1] &prgAND | prgOR &~prgAND);
|
||||
setprg8r(chip, 0xC000 ^(VRC4_misc <<13 &0x4000), 0xFE &prgAND | prgOR &~prgAND);
|
||||
setprg8r(chip, 0xE000, 0xFF &prgAND | prgOR &~prgAND);
|
||||
} else { /* MMC1 mode */
|
||||
prgAND >>=1;
|
||||
prgOR >>=1;
|
||||
if (MMC1_reg[0] &0x8) { /* 16 KiB mode */
|
||||
if (MMC1_reg[0] &0x04) { /* OR logic */
|
||||
setprg16(0x8000, MMC1_reg[3] &prgAND | prgOR &~prgAND);
|
||||
setprg16(0xC000, 0xFF &prgAND | prgOR &~prgAND);
|
||||
setprg16r(chip, 0x8000, MMC1_reg[3] &prgAND | prgOR &~prgAND);
|
||||
setprg16r(chip, 0xC000, 0xFF &prgAND | prgOR &~prgAND);
|
||||
} else { /* AND logic */
|
||||
setprg16(0x8000, 0x00 &prgAND | prgOR &~prgAND);
|
||||
setprg16(0xC000, MMC1_reg[3] &prgAND | prgOR &~prgAND);
|
||||
setprg16r(chip, 0x8000, 0x00 &prgAND | prgOR &~prgAND);
|
||||
setprg16r(chip, 0xC000, MMC1_reg[3] &prgAND | prgOR &~prgAND);
|
||||
}
|
||||
} else
|
||||
setprg32(0x8000, (MMC1_reg[3] &prgAND | prgOR &~prgAND) >>1);
|
||||
@@ -98,6 +102,9 @@ static void sync () {
|
||||
|
||||
chrAND =reg[2] &0x10? 0x1F: reg[2] &0x20? 0x7F: 0xFF;
|
||||
chrOR =reg[0] <<1;
|
||||
if (reg[2] &0x01) /* CHR RAM mode */
|
||||
setchr8r(0x10, 0);
|
||||
else
|
||||
if (reg[2] &0x40) /* CNROM mode */
|
||||
setchr8(chrOR >>3);
|
||||
else
|
||||
@@ -286,12 +293,34 @@ static void Mapper351_reset (void) {
|
||||
sync();
|
||||
}
|
||||
|
||||
static void Mapper351_close(void) {
|
||||
if (CHRRAM) FCEU_gfree(CHRRAM);
|
||||
if (PRGCHR) FCEU_gfree(PRGCHR);
|
||||
CHRRAM =NULL;
|
||||
PRGCHR =NULL;
|
||||
}
|
||||
|
||||
void Mapper351_Init (CartInfo *info) {
|
||||
int CHRRAMSIZE =info->CHRRamSize + info->CHRRamSaveSize;
|
||||
|
||||
info->Reset = Mapper351_reset;
|
||||
info->Power = Mapper351_power;
|
||||
info->Close = Mapper351_close;
|
||||
MapIRQHook = cpuCycle;
|
||||
GameHBIRQHook = horizontalBlanking;
|
||||
GameStateRestore = Mapper351_restore;
|
||||
AddExState(stateRegs, ~0, 0, 0);
|
||||
|
||||
if (CHRRAMSIZE) {
|
||||
CHRRAM =(uint8 *)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||
|
||||
/* This crazy thing can map CHR-ROM into CPU address space. Allocate a combined PRG+CHR address space and treat it a second "chip". */
|
||||
PRGCHR =(uint8 *)FCEU_gmalloc(PRGsize[0] +CHRsize[0]);
|
||||
memcpy(PRGCHR, PRGptr[0], PRGsize[0]);
|
||||
memcpy(PRGCHR +PRGsize[0], CHRptr[0], CHRsize[0]);
|
||||
SetupCartPRGMapping(0x10, PRGCHR, PRGsize[0] +CHRsize[0], 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* NC7000M PCB, with incorrect UNIF MAPR BS-110 due to a mix-up. Submappers denote the setting of two solder pads that configure CHR banking. */
|
||||
/* NC7000M PCB, with incorrect UNIF MAPR BS-110 due to a mix-up. Submapper bits 0 and 1. denote the setting of two solder pads that configure CHR banking. */
|
||||
/* NC8000M PCB, indicated by submapper bit 2. */
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
@@ -27,7 +28,7 @@ static uint8 pads;
|
||||
static uint8 dip;
|
||||
|
||||
static void Mapper444_PRGWrap(uint32 A, uint8 V) {
|
||||
int prgAND =0x0F;
|
||||
int prgAND =pads &4 && EXPREGS[0] &0x02? 0x1F: 0x0F;
|
||||
int prgOR =EXPREGS[0] <<4;
|
||||
if (EXPREGS[0] &0x04) {
|
||||
if (~A &0x4000) {
|
||||
|
||||
74
src/boards/467.c
Normal file
74
src/boards/467.c
Normal file
@@ -0,0 +1,74 @@
|
||||
/* FCEUmm - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2022 NewRisingSun
|
||||
*
|
||||
* 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 Mapper467_PRGWrap(uint32 A, uint8 V) {
|
||||
if (EXPREGS[0] &0x20) {
|
||||
int prgAND =EXPREGS[0] &0x40? 0x0F: 0x03;
|
||||
int prgOR =EXPREGS[0] <<1 &0x3C | 0x40;
|
||||
setprg8(A, V &prgAND | prgOR &~prgAND);
|
||||
} else
|
||||
if (~A &0x2000)
|
||||
setprg16(A, EXPREGS[0] &0x1F);
|
||||
}
|
||||
|
||||
static void Mapper467_CHRWrap(uint32 A, uint8 V) {
|
||||
if (~A &0x0800) {
|
||||
A =A &~0x400 | A <<1 &0x800;
|
||||
if (EXPREGS[0] &0x40)
|
||||
setchr2(A, V |0x100);
|
||||
else
|
||||
setchr2(A, V &~3 | A >>11 &3);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(Mapper467_WriteExtra) {
|
||||
EXPREGS[0] =V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
setmirror(EXPREGS[0] &0x80? MI_H: MI_V);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper467_WriteMMC3) {
|
||||
if (~A &1) V &=0x3F;
|
||||
MMC3_CMDWrite(A, V);
|
||||
}
|
||||
|
||||
static void Mapper467_Reset(void) {
|
||||
EXPREGS[0] =0;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
static void Mapper467_Power(void) {
|
||||
EXPREGS[0] =0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x8000, 0x8FFF, Mapper467_WriteMMC3);
|
||||
SetWriteHandler(0x9000, 0x9FFF, Mapper467_WriteExtra);
|
||||
}
|
||||
|
||||
void Mapper467_Init(CartInfo *info) {
|
||||
GenMMC3_Init(info, 256, 256, 0, 0);
|
||||
cwrap = Mapper467_CHRWrap;
|
||||
pwrap = Mapper467_PRGWrap;
|
||||
info->Power = Mapper467_Power;
|
||||
info->Reset = Mapper467_Reset;
|
||||
AddExState(EXPREGS, 1, 0, "EXPR");
|
||||
}
|
||||
@@ -63,6 +63,17 @@ static uint8 adrperm[8][8] =
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7 }, /* empty */
|
||||
};
|
||||
|
||||
static uint8 protarray[8][8] = {
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 0 Super Hang-On */
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00 }, /* 1 Monkey King */
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x00, 0x00 }, /* 2 Super Hang-On/Monkey King */
|
||||
{ 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x05, 0x00 }, /* 3 Super Hang-On/Monkey King */
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 4 */
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 5 */
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* 6 */
|
||||
{ 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0F, 0x00 } /* 7 (default) Blood of Jurassic */
|
||||
};
|
||||
|
||||
static void UNL8237CW(uint32 A, uint8 V) {
|
||||
uint16 outer_bank;
|
||||
|
||||
@@ -109,6 +120,10 @@ static void UNL8237PW(uint32 A, uint8 V) {
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(UNL8237ProtRead) {
|
||||
return protarray[EXPREGS[3]][A &7] &0x0F | 0x50;
|
||||
}
|
||||
|
||||
static DECLFW(UNL8237Write) {
|
||||
uint8 dat = V;
|
||||
uint8 adr = adrperm[EXPREGS[2]][((A >> 12) & 6) | (A & 1)];
|
||||
@@ -125,6 +140,7 @@ static DECLFW(UNL8237ExWrite) {
|
||||
switch (A & 0xF007) {
|
||||
case 0x5000: EXPREGS[0] = V; FixMMC3PRG(MMC3_cmd); FixMMC3CHR(MMC3_cmd); break;
|
||||
case 0x5001: EXPREGS[1] = V; FixMMC3PRG(MMC3_cmd); FixMMC3CHR(MMC3_cmd); break;
|
||||
case 0x5002: EXPREGS[3] = V; break;
|
||||
case 0x5007: EXPREGS[2] = V; break;
|
||||
}
|
||||
}
|
||||
@@ -132,9 +148,18 @@ static DECLFW(UNL8237ExWrite) {
|
||||
static void UNL8237Power(void) {
|
||||
EXPREGS[0] = EXPREGS[2] = 0;
|
||||
EXPREGS[1] = 0x0F;
|
||||
EXPREGS[3] = 7;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNL8237Write);
|
||||
SetWriteHandler(0x5000, 0x7FFF, UNL8237ExWrite);
|
||||
SetReadHandler (0x5000, 0x5FFF, UNL8237ProtRead);
|
||||
SetWriteHandler(0x5000, 0x5FFF, UNL8237ExWrite);
|
||||
}
|
||||
|
||||
static void UNL8237Reset(void) {
|
||||
EXPREGS[0] = EXPREGS[2] = 0;
|
||||
EXPREGS[1] = 0x0F;
|
||||
EXPREGS[3] = 7;
|
||||
MMC3RegReset();
|
||||
}
|
||||
|
||||
void UNL8237_Init(CartInfo *info) {
|
||||
@@ -142,8 +167,8 @@ void UNL8237_Init(CartInfo *info) {
|
||||
cwrap = UNL8237CW;
|
||||
pwrap = UNL8237PW;
|
||||
info->Power = UNL8237Power;
|
||||
AddExState(EXPREGS, 3, 0, "EXPR");
|
||||
AddExState(&submapper, 1, 0, "SUBM");
|
||||
info->Reset = UNL8237Reset;
|
||||
AddExState(EXPREGS, 4, 0, "EXPR");
|
||||
if (info->iNES2)
|
||||
submapper = info->submapper;
|
||||
}
|
||||
|
||||
@@ -658,13 +658,12 @@ void BMCG146_Init(CartInfo *info) {
|
||||
/* NES 2.0 mapper 341 is used for a simple 4-in-1 multicart */
|
||||
|
||||
static void BMCTJ03Sync(void) {
|
||||
uint8 mirr = ((latche >> 1) & 1) ^ 1;
|
||||
uint8 bank = (latche >> 8) & 7;
|
||||
uint8 mirr = latche &(PRGsize[0] &0x40000? 0x800: 0x200)? MI_H: MI_V;
|
||||
uint8 bank = latche >> 8;
|
||||
|
||||
setprg32(0x8000, bank);
|
||||
setchr8(bank);
|
||||
|
||||
if (bank == 3) mirr ^= 1; /* Twin Bee has incorrect mirroring */
|
||||
setmirror(mirr);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,41 +18,31 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* NES 2.0 mapper 340 is used for a 35-in-1 multicart.
|
||||
* Its UNIF board name is BMC-K-3036.
|
||||
* http://wiki.nesdev.com/w/index.php/NES_2.0_Mapper_340
|
||||
* TODO: Some games are not working...
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 regs[2], mirr, mode;
|
||||
static uint8 regs[2];
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{ regs, 2, "REGS" },
|
||||
{ &mode, 1, "MODE" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void) {
|
||||
if (mode) { /* NROM-128 */
|
||||
setprg16(0x8000, regs[0]);
|
||||
setprg16(0xC000, regs[0]);
|
||||
} else { /* UNROM */
|
||||
setprg16(0x8000, regs[0] | regs[1]);
|
||||
setprg16(0xC000, regs[0] | 0x07);
|
||||
if (regs[0] &0x20) { /* NROM-128 */
|
||||
setprg16(0x8000, regs[0] >>2 &0x20 | regs[0] &0x1F);
|
||||
setprg16(0xC000, regs[0] >>2 &0x20 | regs[0] &0x1F);
|
||||
} else { /* UNROM */
|
||||
setprg16(0x8000, regs[0] >>2 &0x20 | regs[0] | regs[1] &7);
|
||||
setprg16(0xC000, regs[0] >>2 &0x20 | regs[0] | 7);
|
||||
}
|
||||
setchr8(0);
|
||||
setmirror(mirr);
|
||||
setmirror((regs[0] &0x40 || regs[0] &0x20 && regs[0] &0x04)? MI_H: MI_V);
|
||||
}
|
||||
|
||||
static DECLFW(M340Write) {
|
||||
regs[0] = A & 0x1F;
|
||||
regs[1] = V & 0x07;
|
||||
mode = A & 0x20;
|
||||
mirr = ((A & 0x25) == 0x25) ? 0 : 1;
|
||||
regs[0] = A & 0xFF;
|
||||
regs[1] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
@@ -63,7 +53,7 @@ static void BMCK3036Power(void) {
|
||||
}
|
||||
|
||||
static void BMCK3036Reset(void) {
|
||||
regs[0] = regs[1] = mode = mirr = 0;
|
||||
regs[0] = regs[1] = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
|
||||
@@ -597,7 +597,7 @@ static void M49PW(uint32 A, uint8 V) {
|
||||
V |= (EXPREGS[0] & 0xC0) >> 2;
|
||||
setprg8(A, V);
|
||||
} else
|
||||
setprg32(0x8000, (EXPREGS[0] >> 4) & 3);
|
||||
setprg32(0x8000, (EXPREGS[0] >> 4) & 15);
|
||||
}
|
||||
|
||||
static void M49CW(uint32 A, uint8 V) {
|
||||
|
||||
@@ -913,12 +913,14 @@
|
||||
{ 0x6e149729, 189, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Master Fighter II (Unl) [a1].nes */
|
||||
{ 0x60bfeb0c, 90, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Mortal Kombat 2 (Unl) [!].nes */
|
||||
{ 0x247cc73d, 150, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Poker II (Asia) (Ja) (Unl).nes */
|
||||
{ 0x1f1326d4, 121, DEFAULT, MI_H, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Super Sonic 5 (1997) (Unl) [!].nes */
|
||||
{ 0x99748230, 215, DEFAULT, MI_H, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* EarthWorm Jim 2 (SuperGame).nes */
|
||||
{ 0x37876ac7, 215, DEFAULT, MI_H, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Golden Card 6-in-1 (Unl) [!].nes */
|
||||
{ 0x1a3320a3, 215, DEFAULT, MI_H, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Mortal Kombat 3 (SuperGame).nes */
|
||||
{ 0x80eb1839, 114, DEFAULT, MI_H, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Boogerman (Sugar Softec) (Unl) [!].nes */
|
||||
{ 0x071e4ee8, 114, DEFAULT, MI_H, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* ?? m114,submapper 1 test rom */
|
||||
{ 0x1f1326d4, 121, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Super Sonic 5 (1997) (Unl) [!].nes */
|
||||
{ 0x99748230, 215, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* EarthWorm Jim 2 (SuperGame).nes */
|
||||
{ 0x37876ac7, 215, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Golden Card 6-in-1 (Unl) [!].nes */
|
||||
{ 0x1a3320a3, 215, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Mortal Kombat 3 (SuperGame).nes */
|
||||
{ 0xec70f8d8, 258, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* 1997 留念: 港-京 - Super Hang-On (protected version, CHR doubled) */
|
||||
{ 0x224989d9, 258, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* 1997 留念: 港-京 - Super Hang-On (protected version) */
|
||||
{ 0x80eb1839, 114, 1, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Boogerman (Sugar Softec) (Unl) [!].nes */
|
||||
{ 0x071e4ee8, 114, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* ?? m114,submapper 1 test rom */
|
||||
{ 0xfe3e03a1, 197, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Mortal Kombat III Special (YY-030) (Ch) [!].nes */
|
||||
{ 0x9151d311, 197, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Mortal Kombat III 28 Peoples (NT-328) (Ch) [!].nes */
|
||||
{ 0x272709b9, 237, DEFAULT, DEFAULT, 0, DEFAULT, DEFAULT, DEFAULT, NOEXTRA }, /* Teletubbies Y2K (420-in-1).nes */
|
||||
|
||||
@@ -679,7 +679,7 @@ INES_BOARD_BEGIN()
|
||||
/* NES 2.0 MAPPERS */
|
||||
|
||||
INES_BOARD( "OneBus", 256, UNLOneBus_Init )
|
||||
INES_BOARD( "158B", 258, UNL158B_Init )
|
||||
INES_BOARD( "158B", 258, UNL8237_Init )
|
||||
INES_BOARD( "F-15", 259, BMCF15_Init )
|
||||
INES_BOARD( "HPxx / HP2018-A", 260, BMCHPxx_Init )
|
||||
INES_BOARD( "810544-C-A1", 261, BMC810544CA1_Init )
|
||||
@@ -706,7 +706,7 @@ INES_BOARD_BEGIN()
|
||||
INES_BOARD( "Kasheng 2-in-1 ", 291, Mapper291_Init )
|
||||
INES_BOARD( "DRAGONFIGHTER", 292, UNLBMW8544_Init )
|
||||
INES_BOARD( "NewStar 12-in-1/7-in-1", 293, Mapper293_Init )
|
||||
INES_BOARD( "MMC3 BMC PIRATE", 294, Mapper134_Init ) /* nesdev redirects this as mapper 134 */
|
||||
INES_BOARD( "63-1601 ", 294, Mapper294_Init )
|
||||
INES_BOARD( "YY860216C", 295, Mapper295_Init )
|
||||
INES_BOARD( "TXC 01-22110-000", 297, Mapper297_Init )
|
||||
INES_BOARD( "TF1201", 298, UNLTF1201_Init )
|
||||
@@ -721,6 +721,7 @@ INES_BOARD_BEGIN()
|
||||
INES_BOARD( "KS7037", 307, UNLKS7037_Init )
|
||||
INES_BOARD( "TH2131-1", 308, UNLTH21311_Init )
|
||||
INES_BOARD( "LH51", 309, LH51_Init )
|
||||
INES_BOARD( "K-1053", 310, Mapper310_Init )
|
||||
INES_BOARD( "KS7013B", 312, UNLKS7013B_Init )
|
||||
INES_BOARD( "RESET-TXROM", 313, BMCRESETTXROM_Init )
|
||||
INES_BOARD( "64in1NoRepeat", 314, BMC64in1nr_Init )
|
||||
@@ -813,9 +814,10 @@ INES_BOARD_BEGIN()
|
||||
INES_BOARD( "NTDEC TH2348", 437, Mapper437_Init )
|
||||
INES_BOARD( "K-3071", 438, Mapper438_Init )
|
||||
INES_BOARD( "NC-3000M", 443, Mapper443_Init )
|
||||
INES_BOARD( "NC-7000M", 444, Mapper444_Init )
|
||||
INES_BOARD( "NC-7000M/NC-8000M", 444, Mapper444_Init )
|
||||
INES_BOARD( "DS-9-27", 452, Mapper452_Init )
|
||||
INES_BOARD( "K6C3001A", 456, Mapper456_Init )
|
||||
INES_BOARD( "47-2", 467, Mapper467_Init )
|
||||
INES_BOARD( "SA-9602B", 513, SA9602B_Init )
|
||||
INES_BOARD( "Brilliant Com Cocoma Pack", 516, Mapper516_Init )
|
||||
INES_BOARD( "DANCE2000", 518, UNLD2000_Init )
|
||||
|
||||
@@ -262,7 +262,9 @@ void Mapper269_Init(CartInfo *);
|
||||
void Mapper271_Init(CartInfo *);
|
||||
void Mapper288_Init(CartInfo *);
|
||||
void Mapper293_Init(CartInfo *);
|
||||
void Mapper294_Init(CartInfo *);
|
||||
void Mapper297_Init(CartInfo *);
|
||||
void Mapper310_Init(CartInfo *);
|
||||
void Mapper319_Init(CartInfo *);
|
||||
void Mapper326_Init(CartInfo *);
|
||||
void Mapper330_Init(CartInfo *);
|
||||
@@ -325,6 +327,7 @@ void Mapper443_Init(CartInfo *);
|
||||
void Mapper444_Init(CartInfo *);
|
||||
void Mapper452_Init(CartInfo *);
|
||||
void Mapper456_Init(CartInfo *);
|
||||
void Mapper467_Init(CartInfo *);
|
||||
void Mapper516_Init(CartInfo *);
|
||||
void Mapper523_Init(CartInfo *);
|
||||
void Mapper533_Init(CartInfo *);
|
||||
|
||||
@@ -565,7 +565,7 @@ static BMAPPING bmap[] = {
|
||||
{ "YOKO", 264, UNLYOKO_Init, 0 },
|
||||
{ "COOLBOY", 268, COOLBOY_Init, BMCFLAG_256KCHRR },
|
||||
{ "MINDKIDS", 268, MINDKIDS_Init, BMCFLAG_256KCHRR },
|
||||
{ "158B", 258, UNL158B_Init, 0 },
|
||||
{ "158B", 258, UNL8237_Init, 0 },
|
||||
{ "DRAGONFIGHTER", 292, UNLBMW8544_Init, 0 },
|
||||
{ "EH8813A", 519, UNLEH8813A_Init, 0 },
|
||||
{ "HP898F", 319, BMCHP898F_Init, 0 },
|
||||
|
||||
@@ -139,7 +139,6 @@ void UNLYOKO_Init(CartInfo *info);
|
||||
void UNROM_Init(CartInfo *info);
|
||||
void UNROM512_Init(CartInfo *info);
|
||||
void COOLBOY_Init(CartInfo *info);
|
||||
void UNL158B_Init(CartInfo *info);
|
||||
void UNLBMW8544_Init(CartInfo *info);
|
||||
void UNLEH8813A_Init(CartInfo *info);
|
||||
void BMCHP898F_Init(CartInfo *info);
|
||||
|
||||
Reference in New Issue
Block a user