Exponential notation of NES 2.0 ROM sizes; mappers (#480)

* Support 2 MIB mapper 314 (Y2K 76-in-1)

* Mapper 57: Forgot one Sync() statement

* Mapper 83: Correction for 256 KiB PRG+512 KiB CHR games

* Mapper 114: Use NES 2.0 submapper field if available to differentiate between scrambling patterns

* NES 2.0: Support exponential notation of PRG/CHR sizes, thus adding support for 4 KiB and 8 KiB ROM files.

* Add mapper 553.

* Correct the database regarding the Nanjing game Pegasus Senya

* Add submapper 5 (HST-162) to mapper 176

* Add mapper 436

* Mapper 176.5 has a CNROM latch as well, though it works a bit differently than submapper 1's

* Added mapper 429

* Added mapper 380 submapper 1

* Added mapper 437

* Added mapper 456

* Forgot to include math.h for pow

* Added mapper 434

* Added mapper 452

* Added mapper 438

* Added mappers 391 and 444, corrected the mixup with BS-110 and NC7000M

* Added mapper 443. Added menu-switching funcionality to mapper 444

Co-authored-by: NewRisingSun <8vytz1+dhp372pv94ebg@sharklasers.com>
This commit is contained in:
NRS-NewRisingSun
2022-01-06 08:22:18 +01:00
committed by GitHub
parent c291ceeb13
commit d72c64e5d9
24 changed files with 767 additions and 457 deletions

79
src/boards/452.c Normal file
View File

@@ -0,0 +1,79 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
* Copyright (C) 2002 Xodnizel
*
* 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
*/
/* DS-9-27. Absolutely insane PCB that overlays 8 KiB of WRAM into a selectable position between $8000 and $E000. */
#include "mapinc.h"
static uint8 latch[2];
static void Mapper452_Sync(void) {
uint8 wramBank = latch[1] >>3 &6 |8;
if (latch[1] &2) {
setprg8(0x8000, latch[0] >>1);
setprg8(0xA000, latch[0] >>1);
setprg8(0xC000, latch[0] >>1);
setprg8(0xE000, latch[0] >>1);
setprg8r(0x10, (wramBank ^4) <<12, 0);
} else
if (latch[1] &8) {
setprg8(0x8000, latch[0] >>1 |0);
setprg8(0xA000, latch[0] >>1 |1);
setprg8(0xC000, latch[0] >>1 |2);
setprg8(0xE000, latch[0] >>1 |3 | latch[1] &4);
} else {
setprg16(0x8000, latch[0] >>2);
setprg16(0xC000, 0);
}
setprg8r(0x10, wramBank <<12, 0);
setchr8(0);
setmirror(latch [1] &1 ^1);
}
static DECLFW(Mapper452_WriteLatch) {
latch[0] =A &0xFF;
latch[1] =V;
Mapper452_Sync();
/* Do not relay to CartBW, as RAM mapped to locations other than $8000-$DFFF are not write-enabled. */
}
static void Mapper452_Reset(void) {
latch[0] =latch[1] =0;
Mapper452_Sync();
}
static void Mapper452_Power(void) {
latch[0] =latch[1] =0;
Mapper452_Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xDFFF, Mapper452_WriteLatch);
SetWriteHandler(0xE000, 0xFFFF, CartBW);
uint8* WRAM = (uint8*) FCEU_gmalloc(8192);
SetupCartPRGMapping(0x10, (uint8*) FCEU_gmalloc(8192), 8192, 1);
}
void Mapper452_Init(CartInfo *info) {
info->Reset = Mapper452_Reset;
info->Power = Mapper452_Power;
AddExState(&latch, 2, 0, "LATC");
}