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

View File

@@ -33,7 +33,7 @@ static int32 IRQCount;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static uint8 is2kbank, isnot2kbank;
static uint8 is2kbank, dbzParty, isYoko;
static SFORMAT StateRegs[] =
{
@@ -44,7 +44,6 @@ static SFORMAT StateRegs[] =
{ reg, 11, "REGS" },
{ low, 4, "LOWR" },
{ &is2kbank, 1, "IS2K" },
{ &isnot2kbank, 1, "NT2K" },
{ 0 }
};
@@ -77,7 +76,7 @@ static void M83Sync(void) {
case 2: setmirror(MI_0); break;
case 3: setmirror(MI_1); break;
}
if (is2kbank && !isnot2kbank) {
if (is2kbank) {
setchr2(0x0000, reg[0]);
setchr2(0x0800, reg[1]);
setchr2(0x1000, reg[6]);
@@ -88,14 +87,21 @@ static void M83Sync(void) {
setchr1(x << 10, reg[x] | ((bank & 0x30) << 4));
}
setprg8r(0x10, 0x6000, 0);
if (mode & 0x40) {
setprg16(0x8000, (bank & 0x3F)); /* DBZ Party [p1] */
setprg16(0xC000, (bank & 0x30) | 0xF);
} else {
setprg8(0x8000, reg[8]);
setprg8(0xA000, reg[9]);
setprg8(0xC000, reg[10]);
setprg8(0xE000, ~0);
switch (mode >>3 &3) {
case 0:
setprg16(0x8000, bank);
setprg16(0xC000, bank |0x0F);
break;
case 1:
setprg32(0x8000, bank >>1);
break;
case 2:
case 3:
setprg8(0x8000, bank <<1 &~0x1F | reg[8] &0x1F);
setprg8(0xA000, bank <<1 &~0x1F | reg[9] &0x1F);
setprg8(0xC000, bank <<1 &~0x1F | reg[10]&0x1F);
setprg8(0xE000, bank <<1 &~0x1F | 0x1F);
break;
}
}
@@ -116,25 +122,22 @@ static DECLFW(UNLYOKOWrite) {
}
static DECLFW(M83Write) {
switch (A) {
case 0x8000: is2kbank = 1; M83Sync(); break;
case 0xB000: /* Dragon Ball Z Party [p1] BMC */
case 0xB0FF: /* Dragon Ball Z Party [p1] BMC */
case 0xB1FF: bank = V; mode |= 0x40; M83Sync(); break; /* Dragon Ball Z Party [p1] BMC */
case 0x8100: mode = V | (mode & 0x40); M83Sync(); break;
case 0x8200: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break;
case 0x8201: IRQa = mode & 0x80; IRQCount &= 0xFF; IRQCount |= V << 8; break;
case 0x8300: reg[8] = V; mode &= 0xBF; M83Sync(); break;
case 0x8301: reg[9] = V; mode &= 0xBF; M83Sync(); break;
case 0x8302: reg[10] = V; mode &= 0xBF; M83Sync(); break;
case 0x8310: reg[0] = V; M83Sync(); break;
case 0x8311: reg[1] = V; M83Sync(); break;
case 0x8312: reg[2] = V; isnot2kbank = 1; M83Sync(); break;
case 0x8313: reg[3] = V; isnot2kbank = 1; M83Sync(); break;
case 0x8314: reg[4] = V; isnot2kbank = 1; M83Sync(); break;
case 0x8315: reg[5] = V; isnot2kbank = 1; M83Sync(); break;
case 0x8316: reg[6] = V; M83Sync(); break;
case 0x8317: reg[7] = V; M83Sync(); break;
switch (A &0x31F) {
case 0x000: bank = V; M83Sync(); break;
case 0x100: mode = V; M83Sync(); break;
case 0x200: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break;
case 0x201: IRQa = mode & 0x80; IRQCount &= 0xFF; IRQCount |= V << 8; break;
case 0x300: reg[8] = V; mode &= 0xBF; M83Sync(); break;
case 0x301: reg[9] = V; mode &= 0xBF; M83Sync(); break;
case 0x302: reg[10] = V; mode &= 0xBF; M83Sync(); break;
case 0x310: reg[0] = V; M83Sync(); break;
case 0x311: reg[1] = V; M83Sync(); break;
case 0x312: reg[2] = V; M83Sync(); break;
case 0x313: reg[3] = V; M83Sync(); break;
case 0x314: reg[4] = V; M83Sync(); break;
case 0x315: reg[5] = V; M83Sync(); break;
case 0x316: reg[6] = V; M83Sync(); break;
case 0x317: reg[7] = V; M83Sync(); break;
}
}
@@ -162,8 +165,6 @@ static void UNLYOKOPower(void) {
}
static void M83Power(void) {
is2kbank = 0;
isnot2kbank = 0;
mode = bank = 0;
dip = 0;
M83Sync();
@@ -171,7 +172,7 @@ static void M83Power(void) {
SetReadHandler(0x5100, 0x5103, UNLYOKOReadLow);
SetWriteHandler(0x5100, 0x5103, UNLYOKOWriteLow);
SetReadHandler(0x6000, 0x7fff, CartBR);
SetWriteHandler(0x6000, 0x7fff, CartBW);/* Pirate Dragon Ball Z Party [p1] used if for saves instead of seraial EEPROM */
SetWriteHandler(0x6000, 0x7fff, CartBW);
SetReadHandler(0x8000, 0xffff, CartBR);
SetWriteHandler(0x8000, 0xffff, M83Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
@@ -185,6 +186,7 @@ static void UNLYOKOReset(void) {
static void M83Reset(void) {
dip ^= 1;
mode = bank = 0;
M83Sync();
}
@@ -228,10 +230,19 @@ void Mapper83_Init(CartInfo *info) {
MapIRQHook = UNLYOKOIRQHook;
GameStateRestore = M83StateRestore;
WRAMSIZE = 8192;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if (info->iNES2) {
is2kbank =info->submapper ==1;
dbzParty =info->submapper ==2;
} else {
is2kbank = info->CHRRomSize ==512*1024;
dbzParty = info->PRGRomSize ==1024*1024;
}
if (dbzParty) {
WRAMSIZE = 8192;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
}
AddExState(&StateRegs, ~0, 0, 0);
}