more baordification, refactor

This commit is contained in:
CaH4e3 2012-10-28 17:37:53 +00:00
parent 423586a727
commit be47e34b05
36 changed files with 1703 additions and 1990 deletions

84
src/boards/228.cpp Normal file
View File

@ -0,0 +1,84 @@
/* 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 mram[4], vreg;
static uint16 areg;
static SFORMAT StateRegs[] =
{
{ mram, 4, "MRAM" },
{ &areg, 2, "AREG" },
{ &vreg, 1, "VREG" },
{ 0 }
};
static void Sync(void) {
uint32 prgl, prgh, page = (areg >> 7) & 0x3F;
if ((page & 0x30) == 0x30)
page -= 0x10;
prgl = prgh = (page << 1) + (((areg >> 6) & 1) & ((areg >> 5) & 1));
prgh += ((areg >> 5) & 1) ^ 1;
setmirror(((areg >> 13) & 1) ^ 1);
setprg16(0x8000,prgl);
setprg16(0xc000,prgh);
setchr8(((vreg & 0x3) | ((areg & 0xF) << 2)));
}
static DECLFW(M228RamWrite) {
mram[A & 3] = V & 0x0F;
}
static DECLFR(M228RamRead) {
return mram[A & 3];
}
static DECLFW(M228Write) {
areg = A;
vreg = V;
Sync();
}
static void M228Reset(void) {
areg = 0x8000;
vreg = 0;
Sync();
}
static void M228Power(void) {
M228Reset();
SetReadHandler(0x5000,0x5FFF,M228RamRead);
SetWriteHandler(0x5000,0x5FFF,M228RamWrite);
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M228Write);
}
static void StateRestore(int version) {
Sync();
}
void Mapper228_Init(CartInfo *info) {
info->Reset = M228Reset;
info->Power = M228Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

78
src/boards/230.cpp Normal file
View File

@ -0,0 +1,78 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2005 CaH4e3
* Copyright (C) 2009 qeed
*
* 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
*
* 22 + Contra Reset based custom mapper...
*
*/
#include "mapinc.h"
static uint8 latche, reset;
static SFORMAT StateRegs[] =
{
{ &reset, 1, "RST" },
{ &latche, 1, "LATC" },
{ 0 }
};
static void Sync(void) {
if(reset) {
setprg16(0x8000, latche & 7);
setprg16(0xC000, 7);
setmirror(MI_V);
} else {
uint32 bank = (latche & 0x1F) + 8;
if (latche & 0x20) {
setprg16(0x8000, bank);
setprg16(0xC000, bank);
} else
setprg32(0x8000, bank >> 1);
setmirror((latche >> 6) & 1);
}
setchr8(0);
}
static DECLFW(M230Write) {
latche = V;
Sync();
}
static void M230Reset(void) {
reset ^= 1;
Sync();
}
static void M230Power(void) {
latche = reset = 0;
Sync();
SetWriteHandler(0x8000, 0xFFFF, M230Write);
SetReadHandler(0x8000, 0xFFFF, CartBR);
}
static void StateRestore(int version) {
Sync();
}
void Mapper230_Init(CartInfo *info) {
info->Power = M230Power;
info->Reset = M230Reset;
AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore = StateRestore;
}

68
src/boards/232.cpp Normal file
View File

@ -0,0 +1,68 @@
/* 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 bank, preg;
static SFORMAT StateRegs[] =
{
{ &bank, 1, "BANK" },
{ &preg, 1, "PREG" },
{ 0 }
};
static void Sync(void) {
// uint32 bbank = (bank & 0x18) >> 1;
uint32 bbank = ((bank & 0x10) >> 2) | (bank & 8); // some dumps have bbanks swapped, if swap commands,
// then all roms can be played, but with some swapped
// games in menu. if not, some dumps are unplayable
// make hard dump for both cart types to check
setprg16(0x8000, bbank | (preg & 3));
setprg16(0xC000, bbank | 3);
setchr8(0);
}
static DECLFW(M232WriteBank) {
bank = V;
Sync();
}
static DECLFW(M232WritePreg) {
preg = V;
Sync();
}
static void M232Power(void) {
bank = preg = 0;
Sync();
SetWriteHandler(0x8000, 0xBFFF, M232WriteBank);
SetWriteHandler(0xC000, 0xFFFF, M232WritePreg);
SetReadHandler(0x8000, 0xFFFF, CartBR);
}
static void StateRestore(int version) {
Sync();
}
void Mapper232_Init(CartInfo *info) {
info->Power = M232Power;
AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore = StateRestore;
}

79
src/boards/234.cpp Normal file
View File

@ -0,0 +1,79 @@
/* 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 bank, preg;
static SFORMAT StateRegs[] =
{
{ &bank, 1, "BANK" },
{ &preg, 1, "PREG" },
{ 0 }
};
static void Sync(void) {
if (bank & 0x40) {
setprg32(0x8000, (bank & 0xE) | (preg & 1));
setchr8(((bank & 0xE) << 2) | ((preg >> 4) & 7));
} else {
setprg32(0x8000, bank & 0xF);
setchr8(((bank & 0xF) << 2) | ((preg >> 4) & 3));
}
setmirror((bank >> 7) ^ 1);
}
DECLFR(M234ReadBank) {
uint8 r = CartBR(A);
if (!bank) {
bank = r;
Sync();
}
return r;
}
DECLFR(M234ReadPreg) {
uint8 r = CartBR(A);
preg = r;
Sync();
return r;
}
static void M234Reset(void) {
bank = preg = 0;
Sync();
}
static void M234Power(void) {
M234Reset();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetReadHandler(0xFF80, 0xFF9F, M234ReadBank);
SetReadHandler(0xFFE8, 0xFFF7, M234ReadPreg);
}
static void StateRestore(int version) {
Sync();
}
void Mapper234_Init(CartInfo *info) {
info->Power = M234Power;
info->Reset = M234Reset;
AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore = StateRestore;
}

77
src/boards/244.cpp Normal file
View File

@ -0,0 +1,77 @@
/* 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 preg, creg;
static SFORMAT StateRegs[] =
{
{ &preg, 1, "PREG" },
{ &creg, 1, "CREG" },
{ 0 }
};
static uint8 prg_perm[4][4] = {
{ 0, 1, 2, 3, },
{ 3, 2, 1, 0, },
{ 0, 2, 1, 3, },
{ 3, 1, 2, 0, },
};
static uint8 chr_perm[8][8] = {
{ 0, 1, 2, 3, 4, 5, 6, 7, },
{ 0, 2, 1, 3, 4, 6, 5, 7, },
{ 0, 1, 4, 5, 2, 3, 6, 7, },
{ 0, 4, 1, 5, 2, 6, 3, 7, },
{ 0, 4, 2, 6, 1, 5, 3, 7, },
{ 0, 2, 4, 6, 1, 3, 5, 7, },
{ 7, 6, 5, 4, 3, 2, 1, 0, },
{ 7, 6, 5, 4, 3, 2, 1, 0, },
};
static void Sync(void) {
setprg32(0x8000, preg);
setchr8(creg);
}
static DECLFW(M244Write) {
if (V & 8)
creg = chr_perm[(V >> 4) & 7][V & 7];
else
preg = prg_perm[(V >> 4) & 3][V & 3];
Sync();
}
static void M244Power(void) {
preg = creg = 0;
Sync();
SetWriteHandler(0x8000, 0xFFFF, M244Write);
SetReadHandler(0x8000, 0xFFFF, CartBR);
}
static void StateRestore(int version) {
Sync();
}
void Mapper244_Init(CartInfo *info) {
info->Power = M244Power;
AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore = StateRestore;
}

86
src/boards/246.cpp Normal file
View File

@ -0,0 +1,86 @@
/* 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 regs[8];
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =
{
{ regs, 8, "REGS" },
{ 0 }
};
static void Sync(void) {
setprg2r(0x10, 0x6800, 0);
setprg8(0x8000, regs[0]);
setprg8(0xA000, regs[1]);
setprg8(0xC000, regs[2]);
setprg8(0xE000, regs[3]);
setchr2(0x0000, regs[4]);
setchr2(0x0800, regs[5]);
setchr2(0x1000, regs[6]);
setchr2(0x1800, regs[7]);
}
static DECLFW(M246Write) {
regs[A & 7] = V;
Sync();
}
static void M246Power(void) {
regs[0] = regs[1] = regs[2] = regs[3] = ~0;
Sync();
SetWriteHandler(0x6000, 0x67FF, M246Write);
SetReadHandler(0x6800, 0x6FFF, CartBR);
SetWriteHandler(0x6800, 0x6FFF, CartBW);
SetReadHandler(0x8000, 0xFFFF, CartBR);
}
static void M246Close(void)
{
if(WRAM)
FCEU_gfree(WRAM);
WRAM = NULL;
}
static void StateRestore(int version) {
Sync();
}
void Mapper246_Init(CartInfo *info) {
info->Power = M246Power;
info->Close = M246Close;
GameStateRestore = StateRestore;
WRAMSIZE = 2048;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if (info->battery) {
info->SaveGame[0] = WRAM;
info->SaveGameLen[0] = WRAMSIZE;
}
AddExState(&StateRegs, ~0, 0, 0);
}

102
src/boards/32.cpp Normal file
View File

@ -0,0 +1,102 @@
/* 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 preg[2], creg[8], mirr;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =
{
{ preg, 4, "PREG" },
{ creg, 8, "CREG" },
{ &mirr, 1, "MIRR" },
{ 0 }
};
static void Sync(void) {
uint16 swap = ((mirr & 2) << 13);
setmirror((mirr & 1) ^ 1);
setprg8r(0x10, 0x6000, 0);
setprg8(0x8000 ^ swap, preg[0]);
setprg8(0xA000, preg[1]);
setprg8(0xC000 ^ swap, ~1);
setprg8(0xE000, ~0);
uint8 i;
for (i = 0; i < 8; i++)
setchr1(i << 10, creg[i]);
}
static DECLFW(M32Write0) {
preg[0] = V;
Sync();
}
static DECLFW(M32Write1) {
mirr = V;
Sync();
}
static DECLFW(M32Write2) {
preg[1] = V;
Sync();
}
static DECLFW(M32Write3) {
creg[A & 7] = V;
Sync();
}
static void M32Power(void) {
Sync();
SetReadHandler(0x6000,0x7fff,CartBR);
SetWriteHandler(0x6000,0x7fff,CartBW);
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0x8FFF, M32Write0);
SetWriteHandler(0x9000, 0x9FFF, M32Write1);
SetWriteHandler(0xA000, 0xAFFF, M32Write2);
SetWriteHandler(0xB000, 0xBFFF, M32Write3);
}
static void M32Close(void)
{
if (WRAM)
FCEU_gfree(WRAM);
WRAM = NULL;
}
static void StateRestore(int version) {
Sync();
}
void Mapper32_Init(CartInfo *info) {
info->Power = M32Power;
info->Close = M32Close;
GameStateRestore = StateRestore;
WRAMSIZE = 8192;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}

117
src/boards/33.cpp Normal file
View File

@ -0,0 +1,117 @@
/* 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 is48;
static uint8 regs[8], mirr;
static uint8 IRQa;
static int16 IRQCount, IRQLatch;
static SFORMAT StateRegs[] =
{
{ regs, 8, "PREG" },
{ &mirr, 1, "MIRR" },
{ &IRQa, 1, "IRQA" },
{ &IRQCount, 2, "IRQC" },
{ &IRQLatch, 2, "IRQL" },
{ 0 }
};
static void Sync(void) {
setmirror(mirr);
setprg8(0x8000, regs[0]);
setprg8(0xA000, regs[1]);
setprg8(0xC000, ~1);
setprg8(0xE000, ~0);
setchr2(0x0000, regs[2]);
setchr2(0x0800, regs[3]);
setchr1(0x1000, regs[4]);
setchr1(0x1400, regs[5]);
setchr1(0x1800, regs[6]);
setchr1(0x1C00, regs[7]);
}
static DECLFW(M33Write) {
A &= 0xF003;
switch(A) {
case 0x8000: regs[0] = V & 0x3F; if(!is48) mirr = ((V >> 6) & 1) ^ 1; Sync(); break;
case 0x8001: regs[1] = V & 0x3F; Sync(); break;
case 0x8002: regs[2] = V; Sync(); break;
case 0x8003: regs[3] = V; Sync(); break;
case 0xA000: regs[4] = V; Sync(); break;
case 0xA001: regs[5] = V; Sync(); break;
case 0xA002: regs[6] = V; Sync(); break;
case 0xA003: regs[7] = V; Sync(); break;
}
}
static DECLFW(M48Write) {
switch (A & 0xF003) {
case 0xC000: IRQLatch = V; break;
case 0xC001: IRQCount = IRQLatch; break;
case 0xC003: IRQa = 0; X6502_IRQEnd(FCEU_IQEXT); break;
case 0xC002: IRQa = 1; break;
case 0xE000: mirr = ((V >> 6) & 1) ^ 1; Sync(); break;
}
}
static void M33Power(void) {
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M33Write);
}
static void M48Power(void) {
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xBFFF, M33Write);
SetWriteHandler(0xC000, 0xFFFF, M48Write);
}
static void M48IRQ(void) {
if (IRQa) {
IRQCount++;
if (IRQCount == 0x100) {
X6502_IRQBegin(FCEU_IQEXT);
IRQa = 0;
}
}
}
static void StateRestore(int version) {
Sync();
}
void Mapper33_Init(CartInfo *info) {
is48 = 0;
info->Power = M33Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
void Mapper48_Init(CartInfo *info) {
is48 = 1;
info->Power = M48Power;
GameHBIRQHook = M48IRQ;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -32,8 +32,16 @@ my_list = Split("""
208.cpp 208.cpp
222.cpp 222.cpp
225.cpp 225.cpp
228.cpp
230.cpp
232.cpp
234.cpp
235.cpp 235.cpp
244.cpp
246.cpp
253.cpp 253.cpp
32.cpp
33.cpp
34.cpp 34.cpp
3d-block.cpp 3d-block.cpp
411120-c.cpp 411120-c.cpp

View File

@ -1,7 +1,7 @@
/* FCE Ultra - NES/Famicom Emulator /* FCE Ultra - NES/Famicom Emulator
* *
* Copyright notice for this file: * Copyright notice for this file:
* Copyright (C) 2009 CaH4e3 * Copyright (C) 2012 CaH4e3
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -21,6 +21,8 @@
#include "mapinc.h" #include "mapinc.h"
static uint8 reg[8]; static uint8 reg[8];
static uint8 IRQa;
static int16 IRQCount, IRQLatch;
/* /*
static uint8 *WRAM=NULL; static uint8 *WRAM=NULL;
static uint32 WRAMSIZE; static uint32 WRAMSIZE;
@ -28,76 +30,71 @@ static uint8 *CHRRAM=NULL;
static uint32 CHRRAMSIZE; static uint32 CHRRAMSIZE;
*/ */
static SFORMAT StateRegs[]= static SFORMAT StateRegs[] =
{ {
{reg, 8, "REGS"}, { reg, 8, "REGS" },
{0} { &IRQa, 1, "IRQA" },
{ &IRQCount, 2, "IRQC" },
{ &IRQLatch, 2, "IRQL" },
{ 0 }
}; };
static void Sync(void) static void Sync(void) {
{
} }
static DECLFW(MNNNWrite) static DECLFW(MNNNWrite) {
{
} }
static void MNNNPower(void) static void MNNNPower(void) {
{
// SetReadHandler(0x6000,0x7fff,CartBR); // SetReadHandler(0x6000,0x7fff,CartBR);
// SetWriteHandler(0x6000,0x7fff,CartBW); // SetWriteHandler(0x6000,0x7fff,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000,0xFFFF,MNNNWrite); SetWriteHandler(0x8000, 0xFFFF, MNNNWrite);
} }
static void MNNNReset(void) static void MNNNReset(void) {
{
} }
/* /*
static void MNNNClose(void) static void MNNNClose(void)
{ {
if(WRAM) if (WRAM)
FCEU_gfree(WRAM); FCEU_gfree(WRAM);
if(CHRRAM) if (CHRRAM)
FCEU_gfree(CHRRAM); FCEU_gfree(CHRRAM);
WRAM=CHRRAM=NULL; WRAM = CHRRAM = NULL;
} }
*/ */
static void MNNNIRQHook(void) static void MNNNIRQHook() {
{ X6502_IRQBegin(FCEU_IQEXT);
X6502_IRQBegin(FCEU_IQEXT);
} }
static void StateRestore(int version) static void StateRestore(int version) {
{ Sync();
Sync();
} }
void MapperNNN_Init(CartInfo *info) void MapperNNN_Init(CartInfo *info) {
{ info->Reset = MNNNReset;
info->Reset=MNNNReset; info->Power = MNNNPower;
info->Power=MNNNPower; // info->Close = MNNNClose;
// info->Close=MNNNClose; GameHBIRQHook = MNNNIRQHook;
GameHBIRQHook=MNNNIRQHook; GameStateRestore = StateRestore;
GameStateRestore=StateRestore;
/* /*
CHRRAMSIZE=8192; CHRRAMSIZE = 8192;
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSIZE); CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10,CHRRAM,CHRRAMSIZE,1); SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM"); AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
*/ */
/* /*
WRAMSIZE=8192; WRAMSIZE = 8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE); WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM"); AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if(info->battery) if (info->battery) {
{ info->SaveGame[0] = WRAM;
info->SaveGame[0]=WRAM; info->SaveGameLen[0] = WRAMSIZE;
info->SaveGameLen[0]=WRAMSIZE; }
}
*/ */
AddExState(&StateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0);
} }

View File

@ -26,69 +26,61 @@
static uint8 isresetbased = 0; static uint8 isresetbased = 0;
static uint8 latche[2], reset; static uint8 latche[2], reset;
static SFORMAT StateRegs[]= static SFORMAT StateRegs[] =
{ {
{&reset, 1, "RST"}, { &reset, 1, "RST" },
{latche, 2, "LATC"}, { latche, 2, "LATC" },
{0} { 0 }
}; };
static void Sync(void) static void Sync(void) {
{ uint8 bank;
uint8 bank; if (isresetbased)
if(isresetbased) bank = (latche[0] & 0x1f) | (reset << 5) | ((latche[1] & 1) << 6);
bank = (latche[0]&0x1f)|(reset<<5)|((latche[1]&1)<<6); else
else bank = (latche[0] & 0x1f) | ((latche[0] & 0x80) >> 2) | ((latche[1] & 1) << 6);
bank = (latche[0]&0x1f)|((latche[0]&0x80)>>2)|((latche[1]&1)<<6); if (!(latche[0] & 0x20))
if(!(latche[0] & 0x20)) setprg32(0x8000, bank >> 1);
setprg32(0x8000,bank >> 1); else{
else setprg16(0x8000, bank);
{ setprg16(0xC000, bank);
setprg16(0x8000,bank); }
setprg16(0xC000,bank); setmirror((latche[0] >> 6) & 1);
} setchr8(0);
setmirror((latche[0]>>6)&1);
setchr8(0);
} }
static DECLFW(M226Write) static DECLFW(M226Write) {
{ latche[A & 1] = V;
latche[A & 1] = V; Sync();
Sync();
} }
static void M226Power(void) static void M226Power(void) {
{ latche[0] = latche[1] = reset = 0;
latche[0] = latche[1] = reset = 0; Sync();
Sync(); SetWriteHandler(0x8000, 0xFFFF, M226Write);
SetWriteHandler(0x8000,0xFFFF,M226Write); SetReadHandler(0x8000, 0xFFFF, CartBR);
SetReadHandler(0x8000,0xFFFF,CartBR);
} }
static void StateRestore(int version) static void StateRestore(int version) {
{ Sync();
Sync();
} }
void Mapper226_Init(CartInfo *info) void Mapper226_Init(CartInfo *info) {
{ isresetbased = 0;
isresetbased = 0; info->Power = M226Power;
info->Power=M226Power; AddExState(&StateRegs, ~0, 0, 0);
AddExState(&StateRegs, ~0, 0, 0); GameStateRestore = StateRestore;
GameStateRestore=StateRestore;
} }
static void BMC42in1Reset(void) static void M233Reset(void) {
{ reset ^= 1;
reset ^= 1; Sync();
Sync();
} }
void BMC42in1r_Init(CartInfo *info) void Mapper233_Init(CartInfo *info) {
{ isresetbased = 1;
isresetbased = 1; info->Power = M226Power;
info->Power=M226Power; info->Reset = M233Reset;
info->Reset=BMC42in1Reset; AddExState(&StateRegs, ~0, 0, 0);
AddExState(&StateRegs, ~0, 0, 0); GameStateRestore = StateRestore;
GameStateRestore=StateRestore;
} }

View File

@ -23,10 +23,11 @@
static uint8 isPirate, is22; static uint8 isPirate, is22;
static uint16 IRQCount; static uint16 IRQCount;
static uint8 IRQLatch, IRQa; static uint8 IRQLatch, IRQa;
static uint8 prgreg[2]; static uint8 prgreg[2], chrreg[8];
static uint8 chrreg[8]; static uint16 chrhi[8];
static uint8 regcmd, irqcmd, mirr, big_bank; static uint8 regcmd, irqcmd, mirr, big_bank;
static uint16 acount = 0; static uint16 acount = 0;
static uint16 weirdo = 0;
static uint8 *WRAM = NULL; static uint8 *WRAM = NULL;
static uint32 WRAMSIZE; static uint32 WRAMSIZE;
@ -35,6 +36,7 @@ static SFORMAT StateRegs[] =
{ {
{ prgreg, 2, "PREG" }, { prgreg, 2, "PREG" },
{ chrreg, 8, "CREG" }, { chrreg, 8, "CREG" },
{ chrhi, 16, "CRGH" },
{ &regcmd, 1, "CMDR" }, { &regcmd, 1, "CMDR" },
{ &irqcmd, 1, "CMDI" }, { &irqcmd, 1, "CMDI" },
{ &mirr, 1, "MIRR" }, { &mirr, 1, "MIRR" },
@ -49,7 +51,7 @@ static void Sync(void) {
if (regcmd & 2) { if (regcmd & 2) {
setprg8(0xC000, prgreg[0] | big_bank); setprg8(0xC000, prgreg[0] | big_bank);
setprg8(0x8000, ((~1) & 0x1F) | big_bank); setprg8(0x8000, ((~1) & 0x1F) | big_bank);
}else { } else {
setprg8(0x8000, prgreg[0] | big_bank); setprg8(0x8000, prgreg[0] | big_bank);
setprg8(0xC000, ((~1) & 0x1F) | big_bank); setprg8(0xC000, ((~1) & 0x1F) | big_bank);
} }
@ -59,8 +61,15 @@ static void Sync(void) {
setchr8(0); setchr8(0);
else{ else{
uint8 i; uint8 i;
for (i = 0; i < 8; i++) if(!weirdo)
setchr1(i << 10, chrreg[i] >> is22); for (i = 0; i < 8; i++)
setchr1(i << 10, (chrhi[i] | chrreg[i]) >> is22);
else {
setchr1(0x0000, 0xFC);
setchr1(0x0400, 0xFD);
setchr1(0x0800, 0xFF);
weirdo--;
}
} }
switch (mirr & 0x3) { switch (mirr & 0x3) {
case 0: setmirror(MI_V); break; case 0: setmirror(MI_V); break;
@ -77,11 +86,14 @@ static DECLFW(VRC24Write) {
big_bank = (V & 8) << 2; // my personally many-in-one feature ;) just for support pirate cart 2-in-1 big_bank = (V & 8) << 2; // my personally many-in-one feature ;) just for support pirate cart 2-in-1
else{ else{
uint16 i = ((A >> 1) & 1) | ((A - 0xB000) >> 11); uint16 i = ((A >> 1) & 1) | ((A - 0xB000) >> 11);
chrreg[i] &= (0xF0) >> ((A & 1) << 2); uint16 nibble = ((A & 1) << 2);
chrreg[i] |= (V & 0xF) << ((A & 1) << 2); chrreg[i] &= (0xF0) >> nibble;
chrreg[i] |= (V & 0xF) << nibble;
if(nibble)
chrhi[i] = (V & 0x10) << 4; // another one many in one feature from pirate carts
} }
Sync(); Sync();
}else } else
switch (A & 0xF003) { switch (A & 0xF003) {
case 0x8000: case 0x8000:
case 0x8001: case 0x8001:
@ -99,8 +111,8 @@ static DECLFW(VRC24Write) {
if (!isPirate) if (!isPirate)
prgreg[1] = V & 0x1F; prgreg[1] = V & 0x1F;
else{ else{
prgreg[0] = (V << 1) & 0x1F; prgreg[0] = (V & 0x1F) << 1;
prgreg[1] = ((V << 1) & 0x1F) | 1; prgreg[1] = ((V & 0x1F) << 1) | 1;
} }
Sync(); Sync();
break; break;
@ -122,7 +134,11 @@ static DECLFW(M21Write) {
} }
static DECLFW(M22Write) { static DECLFW(M22Write) {
A |= ((A >> 2) & 0x3); // It's just swapped lines from 21 mapper if (A == 0xC007) { // Ganbare Goemon Gaiden does strange things!!! at the end credits
weirdo = 8; // quick dirty hack, seems there is no other games with such PCB, so
// we never know if it will not work for something else lol
}
A |= ((A >> 2) & 0x3); // It's just swapped lines from 21 mapper
// //
VRC24Write((A & 0xF000) | ((A >> 1) & 1) | ((A << 1) & 2), V); VRC24Write((A & 0xF000) | ((A >> 1) & 1) | ((A << 1) & 2), V);
} }
@ -212,10 +228,7 @@ void Mapper22_Init(CartInfo *info) {
AddExState(&StateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0);
} }
void Mapper23_Init(CartInfo *info) { void VRC24_Init(CartInfo *info) {
isPirate = 0;
is22 = 0;
info->Power = M23Power;
info->Close = VRC24Close; info->Close = VRC24Close;
MapIRQHook = VRC24IRQHook; MapIRQHook = VRC24IRQHook;
GameStateRestore = StateRestore; GameStateRestore = StateRestore;
@ -233,29 +246,23 @@ void Mapper23_Init(CartInfo *info) {
AddExState(&StateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0);
} }
void Mapper23_Init(CartInfo *info) {
isPirate = 0;
is22 = 0;
info->Power = M23Power;
VRC24_Init(info);
}
void Mapper25_Init(CartInfo *info) { void Mapper25_Init(CartInfo *info) {
isPirate = 0; isPirate = 0;
is22 = 0; is22 = 0;
info->Power = M25Power; info->Power = M25Power;
info->Close = VRC24Close; VRC24_Init(info);
MapIRQHook = VRC24IRQHook;
GameStateRestore = StateRestore;
WRAMSIZE = 8192;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if(info->battery) {
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
AddExState(&StateRegs, ~0, 0, 0);
} }
void UNLT230_Init(CartInfo *info) { void UNLT230_Init(CartInfo *info) {
isPirate = 1; isPirate = 1;
is22 = 0; is22 = 0;
Mapper23_Init(info); info->Power = M23Power;
VRC24_Init(info);
} }

View File

@ -35,4 +35,6 @@
{ 0x3716c4bebf885344LL, "Super Mario Bros.", INESB_HACKED }, { 0x3716c4bebf885344LL, "Super Mario Bros.", INESB_HACKED },
{ 0xfffda4407d80885aLL, "Sweet Home", INESB_CORRUPT }, { 0xfffda4407d80885aLL, "Sweet Home", INESB_CORRUPT },
{ 0x103fc85d978b861bLL, "Sweet Home", INESB_CORRUPT }, { 0x103fc85d978b861bLL, "Sweet Home", INESB_CORRUPT },
{ 0x7979dc51da86f19fLL, "110-in-1", INESB_CORRUPT },
{ 0x001c0bb9c358252aLL, "110-in-1", INESB_CORRUPT },
{ 0, 0, 0 } { 0, 0, 0 }

View File

@ -81,7 +81,9 @@
{0x6e68e31a, 16, 8}, /* Dragon Ball 3*/ {0x6e68e31a, 16, 8}, /* Dragon Ball 3*/
{0x183859d2, 16, -1}, {0x183859d2, 16, -1},
{0x33b899c9, 16, -1}, /* Dragon Ball - Dai Maou Fukkatsu (J) [!] */ {0x33b899c9, 16, -1}, /* Dragon Ball - Dai Maou Fukkatsu (J) [!] */
{0x286fcd20, 23, -1}, /* Ganbare Goemon Gaiden 2 - Tenka no Zaihou (J) [!] */ {0x286fcd20, 23, -1}, /* Ganbare Goemon Gaiden 2 - Tenka no Zaihou (J) [!] */
{0xe4a291ce, 23, -1}, /* World Hero (Unl) [!] */
{0x51e9cd33, 23, -1}, /* World Hero (Unl) [b1] */
{0x5555fca3, 32, 8}, {0x5555fca3, 32, 8},
{0x283ad224, 32, 8}, /* Ai Sensei no Oshiete */ {0x283ad224, 32, 8}, /* Ai Sensei no Oshiete */
{0x243a8735, 32, 0x10|4}, /* Major League */ {0x243a8735, 32, 0x10|4}, /* Major League */
@ -91,6 +93,7 @@
{0xf46ef39a, 37, -1}, /* Super Mario Bros. + Tetris + Nintendo World Cup (E) [!] */ {0xf46ef39a, 37, -1}, /* Super Mario Bros. + Tetris + Nintendo World Cup (E) [!] */
{0x7ccb12a3, 43, -1}, /* SMB2j */ {0x7ccb12a3, 43, -1}, /* SMB2j */
{0x6c71feae, 45, -1}, /* Kunio 8-in-1 */ {0x6c71feae, 45, -1}, /* Kunio 8-in-1 */
{0xe2c94bc2, 48, -1}, /* Super Bros 8 (Unl) [!] */
{0xaebd6549, 48, 8}, /* Bakushou!! Jinsei Gekijou 3 */ {0xaebd6549, 48, 8}, /* Bakushou!! Jinsei Gekijou 3 */
{0x6cdc0cd9, 48, 8}, /* Bubble Bobble 2 */ {0x6cdc0cd9, 48, 8}, /* Bubble Bobble 2 */
{0x99c395f9, 48, 8}, /* Captain Saver */ {0x99c395f9, 48, 8}, /* Captain Saver */

View File

@ -547,16 +547,16 @@ static BMAPPINGLocal bmap[] = {
{"Konami VRC2/VRC4", 21, Mapper21_Init}, {"Konami VRC2/VRC4", 21, Mapper21_Init},
{"Konami VRC2/VRC4", 22, Mapper22_Init}, {"Konami VRC2/VRC4", 22, Mapper22_Init},
{"Konami VRC2/VRC4", 23, Mapper23_Init}, {"Konami VRC2/VRC4", 23, Mapper23_Init},
// {"Konami VRC6", 24, Mapper24_Init}, // {"", 24, Mapper24_Init},
{"Konami VRC2/VRC4", 25, Mapper25_Init}, {"Konami VRC2/VRC4", 25, Mapper25_Init},
// {"", 26, Mapper26_Init}, // {"", 26, Mapper26_Init},
// {"", 27, Mapper27_Init}, // {"", 27, Mapper27_Init}, // Deprecated, dupe for VRC2/VRC4 mapper
// {"", 28, Mapper28_Init}, // {"", 28, Mapper28_Init},
// {"", 29, Mapper29_Init}, // {"", 29, Mapper29_Init},
// {"", 30, Mapper30_Init}, // {"", 30, Mapper30_Init},
// {"", 31, Mapper31_Init}, // {"", 31, Mapper31_Init},
// {"", 32, Mapper32_Init}, {"IREM G-101", 32, Mapper32_Init},
// {"", 33, Mapper33_Init}, {"TC0190FMC/TC0350FMR", 33, Mapper33_Init},
{"", 34, Mapper34_Init}, {"", 34, Mapper34_Init},
{"Wario Land 2", 35, UNLSC127_Init}, // Wario Land 2 {"Wario Land 2", 35, UNLSC127_Init}, // Wario Land 2
{"TXC Policeman", 36, Mapper36_Init}, // TXC Policeman {"TXC Policeman", 36, Mapper36_Init}, // TXC Policeman
@ -571,7 +571,7 @@ static BMAPPINGLocal bmap[] = {
{"", 45, Mapper45_Init}, {"", 45, Mapper45_Init},
// {"", 46, Mapper46_Init}, // {"", 46, Mapper46_Init},
{"", 47, Mapper47_Init}, {"", 47, Mapper47_Init},
// {"", 48, Mapper48_Init}, {"TAITO TCxxx", 48, Mapper48_Init},
{"", 49, Mapper49_Init}, {"", 49, Mapper49_Init},
// {"", 50, Mapper50_Init}, // {"", 50, Mapper50_Init},
// {"", 51, Mapper51_Init}, // {"", 51, Mapper51_Init},
@ -749,15 +749,15 @@ static BMAPPINGLocal bmap[] = {
// {"", 223, Mapper223_Init}, // {"", 223, Mapper223_Init},
// {"", 224, Mapper224_Init}, // {"", 224, Mapper224_Init},
{"", 225, Mapper225_Init}, {"", 225, Mapper225_Init},
{"", 226, Mapper226_Init}, {"BMC 22+20-in-1", 226, Mapper226_Init},
{"", 227, Mapper227_Init}, {"", 227, Mapper227_Init},
// {"", 228, Mapper228_Init}, {"", 228, Mapper228_Init},
{"", 229, Mapper229_Init}, {"", 229, Mapper229_Init},
// {"", 230, Mapper230_Init}, {"BMC 22-in-1+Contra", 230, Mapper230_Init},
{"", 231, Mapper231_Init}, {"", 231, Mapper231_Init},
// {"", 232, Mapper232_Init}, {"BMC QUATTRO", 232, Mapper232_Init},
{"", 233, BMC42in1r_Init}, {"BMC 22+20-in-1 RST", 233, Mapper233_Init},
// {"", 234, Mapper234_Init}, {"BMC MAXI", 234, Mapper234_Init},
{"", 235, Mapper235_Init}, {"", 235, Mapper235_Init},
// {"", 236, Mapper236_Init}, // {"", 236, Mapper236_Init},
// {"", 237, Mapper237_Init}, // {"", 237, Mapper237_Init},
@ -767,9 +767,9 @@ static BMAPPINGLocal bmap[] = {
{"", 241, Mapper241_Init}, {"", 241, Mapper241_Init},
{"", 242, Mapper242_Init}, {"", 242, Mapper242_Init},
{"S74LS374NA", 243, S74LS374NA_Init}, {"S74LS374NA", 243, S74LS374NA_Init},
// {"", 244, Mapper244_Init}, {"DECATHLON", 244, Mapper244_Init},
{"", 245, Mapper245_Init}, {"", 245, Mapper245_Init},
// {"", 246, Mapper246_Init}, {"FONG SHEN BANG", 246, Mapper246_Init},
// {"", 247, Mapper247_Init}, // {"", 247, Mapper247_Init},
// {"", 248, Mapper248_Init}, // {"", 248, Mapper248_Init},
{"", 249, Mapper249_Init}, {"", 249, Mapper249_Init},
@ -778,8 +778,8 @@ static BMAPPINGLocal bmap[] = {
// {"", 252, Mapper252_Init}, // {"", 252, Mapper252_Init},
{"", 253, Mapper253_Init}, {"", 253, Mapper253_Init},
{"", 254, Mapper254_Init}, {"", 254, Mapper254_Init},
// {"", 255, Mapper255_Init}, // {"", 255, Mapper255_Init}, // doesn't have any good dump for this mapper
{"", 0, NULL} {"", 0, NULL}
}; };
@ -1197,13 +1197,13 @@ void (*MapInitTab[256])(void)=
Mapper24_init, Mapper24_init,
0, //Mapper25_init, 0, //Mapper25_init,
Mapper26_init, Mapper26_init,
Mapper27_init, 0, //Mapper27_init,
0, 0,
0, 0,
0, 0,
0, 0,
Mapper32_init, 0, //Mapper32_init,
Mapper33_init, 0, //Mapper33_init,
0, //Mapper34_init, 0, //Mapper34_init,
0, 0,
0, 0,
@ -1218,7 +1218,7 @@ void (*MapInitTab[256])(void)=
0, 0,
Mapper46_init, Mapper46_init,
0, 0,
Mapper48_init, 0, //Mapper48_init,
0, 0,
Mapper50_init, Mapper50_init,
Mapper51_init, Mapper51_init,
@ -1398,13 +1398,13 @@ void (*MapInitTab[256])(void)=
0, //Mapper225_init, 0, //Mapper225_init,
0, //Mapper226_init, 0, //Mapper226_init,
0, //Mapper227_init, 0, //Mapper227_init,
Mapper228_init, 0, //Mapper228_init,
0, //Mapper229_init, 0, //Mapper229_init,
Mapper230_init, 0, //Mapper230_init,
0, //Mapper231_init, 0, //Mapper231_init,
Mapper232_init, 0, //Mapper232_init,
0, 0,
Mapper234_init, 0, //Mapper234_init,
0, //Mapper235_init, 0, //Mapper235_init,
0, 0,
0, 0,
@ -1414,9 +1414,9 @@ void (*MapInitTab[256])(void)=
0, //Mapper241_init, 0, //Mapper241_init,
0, //Mapper242_init, 0, //Mapper242_init,
0, 0,
Mapper244_init, 0, //Mapper244_init,
0, 0,
Mapper246_init, 0, //Mapper246_init,
0, 0,
0, 0,
0, 0,
@ -1425,7 +1425,7 @@ void (*MapInitTab[256])(void)=
0, 0,
0, 0,
0, 0,
Mapper255_init 0, //Mapper255_init
}; };
static DECLFW(BWRAM) static DECLFW(BWRAM)

View File

@ -172,13 +172,13 @@ void Mapper20_init(void);
void Mapper24_init(void); void Mapper24_init(void);
//void Mapper25_init(void); //void Mapper25_init(void);
void Mapper26_init(void); void Mapper26_init(void);
void Mapper27_init(void); //void Mapper27_init(void);
void Mapper28_init(void); void Mapper28_init(void);
void Mapper29_init(void); void Mapper29_init(void);
void Mapper30_init(void); void Mapper30_init(void);
void Mapper31_init(void); void Mapper31_init(void);
void Mapper32_init(void); //void Mapper32_init(void);
void Mapper33_init(void); //void Mapper33_init(void);
//void Mapper34_init(void); //void Mapper34_init(void);
void Mapper35_init(void); void Mapper35_init(void);
void Mapper36_init(void); void Mapper36_init(void);
@ -193,7 +193,7 @@ void Mapper44_init(void);
void Mapper45_init(void); void Mapper45_init(void);
void Mapper46_init(void); void Mapper46_init(void);
void Mapper47_init(void); void Mapper47_init(void);
void Mapper48_init(void); //void Mapper48_init(void);
void Mapper49_init(void); void Mapper49_init(void);
void Mapper50_init(void); void Mapper50_init(void);
void Mapper51_init(void); void Mapper51_init(void);
@ -335,13 +335,13 @@ void Mapper224_init(void);
//void Mapper225_init(void); //void Mapper225_init(void);
//void Mapper226_init(void); //void Mapper226_init(void);
//void Mapper227_init(void); //void Mapper227_init(void);
void Mapper228_init(void); //void Mapper228_init(void);
//void Mapper229_init(void); //void Mapper229_init(void);
void Mapper230_init(void); //void Mapper230_init(void);
//void Mapper231_init(void); //void Mapper231_init(void);
void Mapper232_init(void); //void Mapper232_init(void);
//void Mapper233_init(void); //void Mapper233_init(void);
void Mapper234_init(void); //void Mapper234_init(void);
//void Mapper235_init(void); //void Mapper235_init(void);
void Mapper236_init(void); void Mapper236_init(void);
void Mapper237_init(void); void Mapper237_init(void);
@ -350,15 +350,15 @@ void Mapper239_init(void);
void Mapper240_init(void); void Mapper240_init(void);
//void Mapper241_init(void); //void Mapper241_init(void);
//void Mapper242_init(void); //void Mapper242_init(void);
void Mapper244_init(void); //void Mapper244_init(void);
void Mapper245_init(void); void Mapper245_init(void);
void Mapper246_init(void); //void Mapper246_init(void);
void Mapper247_init(void); void Mapper247_init(void);
void Mapper249_init(void); void Mapper249_init(void);
void Mapper251_init(void); void Mapper251_init(void);
void Mapper252_init(void); void Mapper252_init(void);
//void Mapper253_init(void); //void Mapper253_init(void);
void Mapper255_init(void); //void Mapper255_init(void);
void NSFVRC6_Init(void); void NSFVRC6_Init(void);
void NSFMMC5_Init(void); void NSFMMC5_Init(void);
@ -382,6 +382,8 @@ void Mapper21_Init(CartInfo *);
void Mapper22_Init(CartInfo *); void Mapper22_Init(CartInfo *);
void Mapper23_Init(CartInfo *); void Mapper23_Init(CartInfo *);
void Mapper25_Init(CartInfo *); void Mapper25_Init(CartInfo *);
void Mapper32_Init(CartInfo *);
void Mapper33_Init(CartInfo *);
void Mapper34_Init(CartInfo *); void Mapper34_Init(CartInfo *);
void Mapper36_Init(CartInfo *); void Mapper36_Init(CartInfo *);
void Mapper37_Init(CartInfo *); void Mapper37_Init(CartInfo *);
@ -390,6 +392,7 @@ void Mapper43_Init(CartInfo *);
void Mapper44_Init(CartInfo *); void Mapper44_Init(CartInfo *);
void Mapper45_Init(CartInfo *); void Mapper45_Init(CartInfo *);
void Mapper47_Init(CartInfo *); void Mapper47_Init(CartInfo *);
void Mapper48_Init(CartInfo *);
void Mapper49_Init(CartInfo *); void Mapper49_Init(CartInfo *);
void Mapper52_Init(CartInfo *); void Mapper52_Init(CartInfo *);
void Mapper57_Init(CartInfo *); void Mapper57_Init(CartInfo *);
@ -486,15 +489,22 @@ void Mapper222_Init(CartInfo *);
void Mapper225_Init(CartInfo *); void Mapper225_Init(CartInfo *);
void Mapper226_Init(CartInfo *); void Mapper226_Init(CartInfo *);
void Mapper227_Init(CartInfo *); void Mapper227_Init(CartInfo *);
void Mapper228_Init(CartInfo *);
void Mapper229_Init(CartInfo *); void Mapper229_Init(CartInfo *);
void Mapper230_Init(CartInfo *);
void Mapper231_Init(CartInfo *); void Mapper231_Init(CartInfo *);
void Mapper232_Init(CartInfo *);
void Mapper233_Init(CartInfo *);
void Mapper234_Init(CartInfo *);
void Mapper235_Init(CartInfo *); void Mapper235_Init(CartInfo *);
void Mapper236_Init(CartInfo *); void Mapper236_Init(CartInfo *);
void Mapper237_Init(CartInfo *); void Mapper237_Init(CartInfo *);
void Mapper240_Init(CartInfo *); void Mapper240_Init(CartInfo *);
void Mapper241_Init(CartInfo *); void Mapper241_Init(CartInfo *);
void Mapper242_Init(CartInfo *); void Mapper242_Init(CartInfo *);
void Mapper244_Init(CartInfo *);
void Mapper245_Init(CartInfo *); void Mapper245_Init(CartInfo *);
void Mapper246_Init(CartInfo *);
void Mapper249_Init(CartInfo *); void Mapper249_Init(CartInfo *);
void Mapper250_Init(CartInfo *); void Mapper250_Init(CartInfo *);
void Mapper253_Init(CartInfo *); void Mapper253_Init(CartInfo *);

View File

@ -1,76 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* 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
*/
#include "mapinc.h"
//16 bits of ram in total
//only use bottom 4 bits as ram though
static uint8 mapper228_ram[4];
static SFORMAT StateRegs[]=
{
{ mapper228_ram, 4, "MRAM" },
{ 0 }
};
static DECLFR(Mapper228_read)
{
return mapper228_ram[A & 3] & 0xF;
}
static DECLFW(Mapper228_write)
{
uint32 page, pagel, pageh;
//write to ram
if (A < 0x6000)
{
mapper228_ram[A & 3] = V;
return;
}
MIRROR_SET((A >> 13) & 1);
page = (A >> 7) & 0x3F;
if( (page & 0x30) == 0x30)
page -= 0x10;
pagel = pageh = (page << 1) + (((A >> 6) & 1) & ((A >> 5) & 1));
pageh += ((A >> 5) & 1) ^ 1;
ROM_BANK16(0x8000,pagel);
ROM_BANK16(0xC000,pageh);
VROM_BANK8( (V&0x3) | ((A&0xF)<<2) );
}
static void A52Reset(void)
{
Mapper228_write(0x8000, 0);
}
void Mapper228_init(void)
{
MapperReset=A52Reset;
A52Reset();
SetWriteHandler(0x8000, 0xFFFF, Mapper228_write);
SetWriteHandler(0x4020, 0x5FFF, Mapper228_write);
SetReadHandler (0x4020, 0x5FFF, Mapper228_read);
AddExState(StateRegs, ~0, 0, 0);
}

View File

@ -1,62 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2003 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"
#define rom_sw mapbyte1[0]
void Mapper230_Reset(void)
{
rom_sw ^= 1; //1 - rom_sw;
if( rom_sw ) {
ROM_BANK16(0x8000,0);
ROM_BANK16(0xc000,7);
} else {
ROM_BANK16(0x8000,8);
ROM_BANK16(0xc000,39);
}
MIRROR_SET2(1);
}
static DECLFW(Mapper230_write)
{
if( rom_sw ) {
ROM_BANK16( 0x8000, V&0x07 );
} else {
if( V & 0x20 ) {
ROM_BANK16( 0x8000, (V&0x1F)+8 );
ROM_BANK16( 0xc000, (V&0x1F)+8 );
} else {
ROM_BANK32( ((V&0x1E) >> 1) + 4 );
}
MIRROR_SET2( ((V & 0x40) >> 6) );
}
}
void Mapper230_init(void)
{
ROM_BANK16(0x8000,0);
ROM_BANK16(0xc000,7);
SetWriteHandler(0x8000, 0xffff, Mapper230_write);
MapperReset = Mapper230_Reset;
rom_sw = 1;
}

View File

@ -1,50 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* 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
*/
#include "mapinc.h"
static void DoIt(void)
{
ROM_BANK16(0x8000,(mapbyte1[1]&3) | ((mapbyte1[0]&0x18)>>1));
ROM_BANK16(0xc000,3|(((mapbyte1[0])&0x18)>>1));
}
DECLFW(Mapper232_write)
{
if(A<=0x9FFF)
mapbyte1[0]=V;
else
mapbyte1[1]=V;
DoIt();
}
static void QuattroReset(void)
{
mapbyte1[0]=0x18;
DoIt();
}
void Mapper232_init(void)
{
SetWriteHandler(0x6000,0xffff,Mapper232_write);
MapperReset=QuattroReset;
QuattroReset();
}

View File

@ -1,107 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* 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
*/
#include "mapinc.h"
#define r1 mapbyte1[0]
#define r2 mapbyte1[1]
static void DoBS(void)
{
if(r1&0x40)
{
ROM_BANK32((r1&0xE)|(r2&1));
VROM_BANK8( ((r1&0xE)<<2) | ((r2>>4)&7) );
}
else
{
ROM_BANK32(r1&0xF);
VROM_BANK8( ((r1&0xF)<<2) | ((r2>>4)&3) );
}
}
static void R1Set(uint8 V)
{
if(r1) return;
r1=V;
MIRROR_SET(V>>7);
DoBS();
}
static void R2Set(uint8 V)
{
r2=V;
DoBS();
}
DECLFW(R1W)
{
R1Set(V);
}
DECLFR(R1R)
{
uint8 r=CartBR(A);
R1Set(r);
return r;
}
DECLFW(R2W)
{
R2Set(V);
}
DECLFR(R2R)
{
uint8 r=CartBR(A);
R2Set(r);
return r;
}
static void M15Restore(int version)
{
DoBS();
MIRROR_SET(r1>>7);
}
static void M15Reset(void)
{
r1=r2=0;
DoBS();
MIRROR_SET(0);
}
void Mapper234_init(void)
{
SetWriteHandler(0xff80,0xff9f,R1W);
SetReadHandler(0xff80,0xff9f,R1R);
SetWriteHandler(0xffe8,0xfff7,R2W);
SetReadHandler(0xffe8,0xfff7,R2R);
SetReadHandler(0x6000,0x7FFF,0);
SetWriteHandler(0x6000,0x7FFF,0);
M15Reset();
GameStateRestore=M15Restore;
MapperReset=M15Reset;
}

View File

@ -1,53 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2011 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 prg_perm[4][4] = {
{0, 1, 2, 3,},
{3, 2, 1, 0,},
{0, 2, 1, 3,},
{3, 1, 2, 0,},
};
static uint8 chr_perm[8][8] = {
{0, 1, 2, 3, 4, 5, 6, 7,},
{0, 2, 1, 3, 4, 6, 5, 7,},
{0, 1, 4, 5, 2, 3, 6, 7,},
{0, 4, 1, 5, 2, 6, 3, 7,},
{0, 4, 2, 6, 1, 5, 3, 7,},
{0, 2, 4, 6, 1, 3, 5, 7,},
{7, 6, 5, 4, 3, 2, 1, 0,},
{7, 6, 5, 4, 3, 2, 1, 0,},
};
static DECLFW(Mapper244_write)
{
if(V&8)
VROM_BANK8(chr_perm[(V>>4)&7][V&7]);
else
ROM_BANK32(prg_perm[(V>>4)&3][V&3]);
}
void Mapper244_init(void)
{
ROM_BANK32(0);
SetWriteHandler(0x8000,0xffff,Mapper244_write);
}

View File

@ -1,44 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* 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
*/
#include "mapinc.h"
DECLFW(Mapper246_write)
{
switch(A&0xF007)
{
case 0x6000:ROM_BANK8(0x8000,V);break;
case 0x6001:ROM_BANK8(0xA000,V);break;
case 0x6002:ROM_BANK8(0xC000,V);break;
case 0x6003:ROM_BANK8(0xE000,V);break;
case 0x6004:VROM_BANK2(0x0000,V);break;
case 0x6005:VROM_BANK2(0x0800,V);break;
case 0x6006:VROM_BANK2(0x1000,V);break;
case 0x6007:VROM_BANK2(0x1800,V);break;
}
}
void Mapper246_init(void)
{
SetWriteHandler(0x4020,0x67ff,Mapper246_write);
SetWriteHandler(0x8000,0xffff,Mapper246_write);
}

View File

@ -1,67 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* 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
*/
#include "mapinc.h"
static DECLFW(Mapper255_write)
{
uint32 pbank=(A>>7)&0x1F;
uint32 cbank=A&0x3F;
uint32 rbank=(A>>14)&1;
// printf("$%04x:$%02x\n",A,V);
// printf("%2x:%2x:%2x,%2x\n",pbank,cbank,rbank,(A&0x40)>>6);
if(A&0x1000)
{
ROM_BANK16(0x8000,((pbank|(rbank<<5))<<1)|((A&0x40)>>6));
ROM_BANK16(0xc000,((pbank|(rbank<<5))<<1)|((A&0x40)>>6));
}
else
{
ROM_BANK32(pbank|(rbank<<5));
}
MIRROR_SET((A>>13)&1);
VROM_BANK8((rbank<<6)|cbank);
}
static DECLFW(Mapper255_wl)
{
// printf("Wr: $%04x:$%02x\n",A,V);
mapbyte1[A&3]=V&0xF;
}
static DECLFR(Mapper255_read)
{
//printf("Rd: $%04x\n",A);
return(mapbyte1[A&3]); //|(X.DB&0xF0));
}
void Mapper255_init(void)
{
mapbyte1[0]=mapbyte1[1]=0xF;
ROM_BANK32(0);
VROM_BANK8(0);
SetWriteHandler(0x5800,0x5FF0,Mapper255_wl);
SetWriteHandler(0x8000,0xffff,Mapper255_write);
SetReadHandler(0x5800,0x5FFF,Mapper255_read);
}

View File

@ -1,69 +0,0 @@
#include "mapinc.h"
static uint32 regchr[9];
static DECLFW(Mapper27_write)
{
int regnum;
A&=0xF00F;
if((A>=0xB000) && (A<=0xE003)) {
regnum=((((A>>12)+1)&0x03)<<1)|((A&0x02)>>1);
if(A&1)
regchr[regnum]=(regchr[regnum]&0x00F)|(V<<4);
else
regchr[regnum]=(regchr[regnum]&0x1F0)|(V&0xF);
VROM_BANK1(regnum<<10,regchr[regnum]);
}
switch(A)
{
case 0x8000: ROM_BANK8(0x8000|((regchr[8]&2)<<13),V); break;
case 0xA000: ROM_BANK8(0xa000,V); break;
case 0x9000: switch(V&3){
case 0:setmirror(MI_V);break;
case 1:setmirror(MI_H);break;
case 2:setmirror(MI_0);break;
case 3:setmirror(MI_1);break;
}
case 0x9002: regchr[8]=V; break;
case 0xF000: //X6502_IRQEnd(FCEU_IQEXT);
IRQLatch=(IRQLatch&0xF0)|(V&0x0F);
break;
case 0xF001: //X6502_IRQEnd(FCEU_IQEXT);
IRQLatch=(IRQLatch&0x0F)|((V&0xF)<<4);
break;
case 0xF003: IRQa=((IRQa&0x1)<<1)|(IRQa&0x1);
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0xF002: IRQa=V&3;
if(IRQa&0x02) IRQCount=IRQLatch-1;
// X6502_IRQEnd(FCEU_IQEXT);
break;
}
// if((A&0xF000)==0xF000) FCEU_printf("$%04x:$%02x, %d\n",A,V, scanline);
}
static void Mapper27_hb(void)
{
// FCEU_printf("%02x-%d,%d,%d\n",scanline,IRQa,IRQCount,IRQLatch);
if(IRQa&0x2){
if(IRQCount==0xFF){
X6502_IRQBegin(FCEU_IQEXT);
IRQCount=IRQLatch+1;
} else {
IRQCount++;
}
}
}
void Mapper27_init(void)
{
int i;
for (i=0; i<9; i++) {
regchr[i]=0;
}
IRQa=0;
IRQCount=IRQLatch=0;
SetWriteHandler(0x8000,0xffff,Mapper27_write);
GameHBIRQHook=Mapper27_hb;
}

View File

@ -1,53 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* 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
*/
#include "mapinc.h"
#define IREMCon mapbyte1[0]
static DECLFW(Mapper32_write)
{
switch(A>>12)
{
case 0x8:
mapbyte1[1]=V;
if(IREMCon) {ROM_BANK8(0xc000,V);ROM_BANK8(0x8000,~1);}
else {ROM_BANK8(0x8000,V);ROM_BANK8(0xc000,~1);}
break;
case 0x9:IREMCon=(V>>1)&1;
if(IREMCon) {ROM_BANK8(0xc000,mapbyte1[1]);ROM_BANK8(0x8000,~1);}
else {ROM_BANK8(0x8000,mapbyte1[1]); ROM_BANK8(0xc000,~1);}
MIRROR_SET(V&1);
break;
case 0xa:ROM_BANK8(0xA000,V);
break;
}
if((A&0xF000)==0xb000)
VROM_BANK1((A&0x7)<<10,V);
}
void Mapper32_init(void)
{
ROM_BANK16(0x8000,0);
ROM_BANK16(0xc000,~0);
SetWriteHandler(0x8000,0xffff,Mapper32_write);
}

View File

@ -1,80 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* 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
*/
#include "mapinc.h"
static int is48;
static DECLFW(Mapper33_write)
{
//printf("%04x:%02x, %d\n",A,V,scanline);
A&=0xF003;
if(A>=0xA000 && A<=0xA003)
VROM_BANK1(0x1000+((A&3)<<10),V);
else switch(A)
{
case 0x8000:if(!is48) MIRROR_SET((V>>6)&1);
ROM_BANK8(0x8000,V);
break;
case 0x8001:ROM_BANK8(0xA000,V); break;
case 0x8002:VROM_BANK2(0x0000,V);break;
case 0x8003:VROM_BANK2(0x0800,V);break;
}
}
static DECLFW(Mapper48_HiWrite)
{
switch(A&0xF003)
{
case 0xc000:IRQLatch=V;break;
case 0xc001:IRQCount=IRQLatch;break;
case 0xc003:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
case 0xc002:IRQa=1;break;
case 0xe000:MIRROR_SET((V>>6)&1);break;
}
}
static void heho(void)
{
if(IRQa)
{
IRQCount++;
if(IRQCount==0x100)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQa=0;
}
}
}
void Mapper33_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper33_write);
is48=0;
}
void Mapper48_init(void)
{
SetWriteHandler(0x8000,0xbfff,Mapper33_write);
SetWriteHandler(0xc000,0xffff,Mapper48_HiWrite);
GameHBIRQHook=heho;
is48=1;
}

View File

@ -1,15 +1,5 @@
my_list = Split(""" my_list = Split("""
228.cpp
230.cpp
232.cpp
234.cpp
244.cpp
246.cpp
24and26.cpp 24and26.cpp
255.cpp
27.cpp
32.cpp
33.cpp
40.cpp 40.cpp
41.cpp 41.cpp
42.cpp 42.cpp
@ -35,12 +25,9 @@ emu2413.c
mmc2and4.cpp mmc2and4.cpp
""") """)
# #
# vrc7tone.h
#
# emu2413.h # emu2413.h
# mapinc.h # mapinc.h
# #
# emutypes.h
for x in range(len(my_list)): for x in range(len(my_list)):
my_list[x] = 'mappers/' + my_list[x] my_list[x] = 'mappers/' + my_list[x]
Return('my_list') Return('my_list')

File diff suppressed because it is too large Load Diff

View File

@ -1,131 +1,136 @@
#ifndef _EMU2413_H_ #ifndef _EMU2413_H_
#define _EMU2413_H_ #define _EMU2413_H_
#include "emutypes.h" #ifndef INLINE
#if defined(_MSC_VER)
#ifdef EMU2413_DLL_EXPORTS #define INLINE __forceinline
#define EMU2413_API __declspec(dllexport) #elif defined(__GNUC__)
#elif defined(EMU2413_DLL_IMPORTS) #define INLINE __inline__
#define EMU2413_API __declspec(dllimport) #elif defined(_MWERKS_)
#else #define INLINE inline
#define EMU2413_API #else
#endif #define INLINE
#endif
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef unsigned char uint8 ;
typedef signed char int8 ;
typedef unsigned short uint16 ;
typedef signed short int16 ;
typedef unsigned int uint32 ;
typedef signed int int32 ;
#define PI 3.14159265358979323846 #define PI 3.14159265358979323846
enum {OPLL_VRC7_TONE=0} ; enum { OPLL_VRC7_TONE=0 };
/* voice data */ /* voice data */
typedef struct { typedef struct {
e_uint32 TL,FB,EG,ML,AR,DR,SL,RR,KR,KL,AM,PM,WF ; uint32 TL, FB, EG, ML, AR, DR, SL, RR, KR, KL, AM, PM, WF;
} OPLL_PATCH ; } OPLL_PATCH;
/* slot */ /* slot */
typedef struct { typedef struct {
OPLL_PATCH patch;
OPLL_PATCH patch; int32 type; /* 0 : modulator 1 : carrier */
e_int32 type ; /* 0 : modulator 1 : carrier */ /* OUTPUT */
int32 feedback;
int32 output[2]; /* Output value of slot */
/* OUTPUT */ /* for Phase Generator (PG) */
e_int32 feedback ; uint16 *sintbl; /* Wavetable */
e_int32 output[2] ; /* Output value of slot */ uint32 phase; /* Phase */
uint32 dphase; /* Phase increment amount */
uint32 pgout; /* output */
/* for Phase Generator (PG) */ /* for Envelope Generator (EG) */
e_uint16 *sintbl ; /* Wavetable */ int32 fnum; /* F-Number */
e_uint32 phase ; /* Phase */ int32 block; /* Block */
e_uint32 dphase ; /* Phase increment amount */ int32 volume; /* Current volume */
e_uint32 pgout ; /* output */ int32 sustine; /* Sustine 1 = ON, 0 = OFF */
uint32 tll; /* Total Level + Key scale level*/
/* for Envelope Generator (EG) */ uint32 rks; /* Key scale offset (Rks) */
e_int32 fnum ; /* F-Number */ int32 eg_mode; /* Current state */
e_int32 block ; /* Block */ uint32 eg_phase; /* Phase */
e_int32 volume ; /* Current volume */ uint32 eg_dphase; /* Phase increment amount */
e_int32 sustine ; /* Sustine 1 = ON, 0 = OFF */ uint32 egout; /* output */
e_uint32 tll ; /* Total Level + Key scale level*/ } OPLL_SLOT;
e_uint32 rks ; /* Key scale offset (Rks) */
e_int32 eg_mode ; /* Current state */
e_uint32 eg_phase ; /* Phase */
e_uint32 eg_dphase ; /* Phase increment amount */
e_uint32 egout ; /* output */
} OPLL_SLOT ;
/* Mask */ /* Mask */
#define OPLL_MASK_CH(x) (1<<(x)) #define OPLL_MASK_CH(x) (1 << (x))
/* opll */ /* opll */
typedef struct { typedef struct {
uint32 adr;
int32 out;
e_uint32 adr ; uint32 realstep;
e_int32 out ; uint32 oplltime;
uint32 opllstep;
int32 prev, next;
#ifndef EMU2413_COMPACTION /* Register */
e_uint32 realstep ; uint8 LowFreq[6];
e_uint32 oplltime ; uint8 HiFreq[6];
e_uint32 opllstep ; uint8 InstVol[6];
e_int32 prev, next ;
#endif
/* Register */ uint8 CustInst[8];
e_uint8 LowFreq[6];
e_uint8 HiFreq[6];
e_uint8 InstVol[6];
e_uint8 CustInst[8]; int32 slot_on_flag[6 * 2];
e_int32 slot_on_flag[6 * 2] ; /* Pitch Modulator */
uint32 pm_phase;
int32 lfo_pm;
/* Pitch Modulator */ /* Amp Modulator */
e_uint32 pm_phase ; int32 am_phase;
e_int32 lfo_pm ; int32 lfo_am;
/* Amp Modulator */ uint32 quality;
e_int32 am_phase ;
e_int32 lfo_am ;
e_uint32 quality; /* Channel Data */
int32 patch_number[6];
int32 key_status[6];
/* Channel Data */ /* Slot */
e_int32 patch_number[6]; OPLL_SLOT slot[6 * 2];
e_int32 key_status[6] ;
/* Slot */ uint32 mask;
OPLL_SLOT slot[6 * 2] ; } OPLL;
e_uint32 mask ;
} OPLL ;
/* Create Object */ /* Create Object */
EMU2413_API OPLL *OPLL_new(e_uint32 clk, e_uint32 rate) ; OPLL *OPLL_new(uint32 clk, uint32 rate);
EMU2413_API void OPLL_delete(OPLL *) ; void OPLL_delete(OPLL *);
/* Setup */ /* Setup */
EMU2413_API void OPLL_reset(OPLL *) ; void OPLL_reset(OPLL *);
EMU2413_API void OPLL_set_rate(OPLL *opll, e_uint32 r) ; void OPLL_set_rate(OPLL *opll, uint32 r);
EMU2413_API void OPLL_set_quality(OPLL *opll, e_uint32 q) ; void OPLL_set_quality(OPLL *opll, uint32 q);
/* Port/Register access */ /* Port/Register access */
EMU2413_API void OPLL_writeIO(OPLL *, e_uint32 reg, e_uint32 val) ; void OPLL_writeIO(OPLL *, uint32 reg, uint32 val);
EMU2413_API void OPLL_writeReg(OPLL *, e_uint32 reg, e_uint32 val) ; void OPLL_writeReg(OPLL *, uint32 reg, uint32 val);
/* Synthsize */ /* Synthsize */
EMU2413_API e_int16 OPLL_calc(OPLL *) ; int16 OPLL_calc(OPLL *);
/* Misc */ /* Misc */
EMU2413_API void OPLL_forceRefresh(OPLL *) ; void OPLL_forceRefresh(OPLL *);
/* Channel Mask */ /* Channel Mask */
EMU2413_API e_uint32 OPLL_setMask(OPLL *, e_uint32 mask) ; uint32 OPLL_setMask(OPLL *, uint32 mask);
EMU2413_API e_uint32 OPLL_toggleMask(OPLL *, e_uint32 mask) ; uint32 OPLL_toggleMask(OPLL *, uint32 mask);
void moocow(OPLL* opll, e_int32 *buf, e_int32 len, int shift); void moocow(OPLL* opll, int32 *buf, int32 len, int shift);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,44 +0,0 @@
#ifndef _EMUTYPES_H_
#define _EMUTYPES_H_
#ifndef INLINE
#if defined(_MSC_VER)
#define INLINE __forceinline
#elif defined(__GNUC__)
#define INLINE __inline__
#elif defined(_MWERKS_)
#define INLINE inline
#else
#define INLINE
#endif
#endif
#if defined(EMU_DLL_IMPORTS)
#define EMU2149_DLL_IMPORTS
#define EMU2212_DLL_IMPORTS
#define EMU2413_DLL_IMPORTS
#define EMU8950_DLL_IMPORTS
#define EMU76489_DLL_IMPORTS
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned int e_uint;
typedef signed int e_int;
typedef unsigned char e_uint8 ;
typedef signed char e_int8 ;
typedef unsigned short e_uint16 ;
typedef signed short e_int16 ;
typedef unsigned int e_uint32 ;
typedef signed int e_int32 ;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,17 +0,0 @@
/* VRC7 instruments, January 17, 2004 update -Xodnizel */
{0x03, 0x21, 0x04, 0x06, 0x8D, 0xF2, 0x42, 0x17},
{0x13, 0x41, 0x05, 0x0E, 0x99, 0x96, 0x63, 0x12},
{0x31, 0x11, 0x10, 0x0A, 0xF0, 0x9C, 0x32, 0x02},
{0x21, 0x61, 0x1D, 0x07, 0x9F, 0x64, 0x20, 0x27},
{0x22, 0x21, 0x1E, 0x06, 0xF0, 0x76, 0x08, 0x28},
{0x02, 0x01, 0x06, 0x00, 0xF0, 0xF2, 0x03, 0x95},
{0x21, 0x61, 0x1C, 0x07, 0x82, 0x81, 0x16, 0x07},
{0x23, 0x21, 0x1A, 0x17, 0xEF, 0x82, 0x25, 0x15},
{0x25, 0x11, 0x1F, 0x00, 0x86, 0x41, 0x20, 0x11},
{0x85, 0x01, 0x1F, 0x0F, 0xE4, 0xA2, 0x11, 0x12},
{0x07, 0xC1, 0x2B, 0x45, 0xB4, 0xF1, 0x24, 0xF4},
{0x61, 0x23, 0x11, 0x06, 0x96, 0x96, 0x13, 0x16},
{0x01, 0x02, 0xD3, 0x05, 0x82, 0xA2, 0x31, 0x51},
{0x61, 0x22, 0x0D, 0x02, 0xC3, 0x7F, 0x24, 0x05},
{0x21, 0x62, 0x0E, 0x00, 0xA1, 0xA0, 0x44, 0x17},

View File

@ -24,7 +24,6 @@ void BMC12IN1_Init(CartInfo *info);
void BMC13in1JY110_Init(CartInfo *info); void BMC13in1JY110_Init(CartInfo *info);
void BMC190in1_Init(CartInfo *info); void BMC190in1_Init(CartInfo *info);
void BMC411120C_Init(CartInfo *info); void BMC411120C_Init(CartInfo *info);
void BMC42in1r_Init(CartInfo *info);
void BMC64in1nr_Init(CartInfo *info); void BMC64in1nr_Init(CartInfo *info);
void BMC70in1B_Init(CartInfo *info); void BMC70in1B_Init(CartInfo *info);
void BMC70in1_Init(CartInfo *info); void BMC70in1_Init(CartInfo *info);
@ -142,5 +141,5 @@ void UNLVRC7_Init(CartInfo *info);
void UNLYOKO_Init(CartInfo *info); void UNLYOKO_Init(CartInfo *info);
void UNROM_Init(CartInfo *info); void UNROM_Init(CartInfo *info);
extern uint8 *UNIFchrrama; // Meh. So I can stop CHR RAM extern uint8 *UNIFchrrama; // Meh. So I can stop CHR RAM
// bank switcherooing with certain boards... // bank switcherooing with certain boards...

View File

@ -259,8 +259,16 @@
<ClCompile Include="..\src\boards\208.cpp" /> <ClCompile Include="..\src\boards\208.cpp" />
<ClCompile Include="..\src\boards\222.cpp" /> <ClCompile Include="..\src\boards\222.cpp" />
<ClCompile Include="..\src\boards\225.cpp" /> <ClCompile Include="..\src\boards\225.cpp" />
<ClCompile Include="..\src\boards\228.cpp" />
<ClCompile Include="..\src\boards\230.cpp" />
<ClCompile Include="..\src\boards\232.cpp" />
<ClCompile Include="..\src\boards\234.cpp" />
<ClCompile Include="..\src\boards\235.cpp" /> <ClCompile Include="..\src\boards\235.cpp" />
<ClCompile Include="..\src\boards\244.cpp" />
<ClCompile Include="..\src\boards\246.cpp" />
<ClCompile Include="..\src\boards\253.cpp" /> <ClCompile Include="..\src\boards\253.cpp" />
<ClCompile Include="..\src\boards\32.cpp" />
<ClCompile Include="..\src\boards\33.cpp" />
<ClCompile Include="..\src\boards\34.cpp" /> <ClCompile Include="..\src\boards\34.cpp" />
<ClCompile Include="..\src\boards\3d-block.cpp" /> <ClCompile Include="..\src\boards\3d-block.cpp" />
<ClCompile Include="..\src\boards\411120-c.cpp" /> <ClCompile Include="..\src\boards\411120-c.cpp" />
@ -569,17 +577,7 @@
<ClCompile Include="..\src\input\suborkb.cpp" /> <ClCompile Include="..\src\input\suborkb.cpp" />
<ClCompile Include="..\src\input\toprider.cpp" /> <ClCompile Include="..\src\input\toprider.cpp" />
<ClCompile Include="..\src\input\zapper.cpp" /> <ClCompile Include="..\src\input\zapper.cpp" />
<ClCompile Include="..\src\mappers\228.cpp" />
<ClCompile Include="..\src\mappers\230.cpp" />
<ClCompile Include="..\src\mappers\232.cpp" />
<ClCompile Include="..\src\mappers\234.cpp" />
<ClCompile Include="..\src\mappers\244.cpp" />
<ClCompile Include="..\src\mappers\246.cpp" />
<ClCompile Include="..\src\mappers\24and26.cpp" /> <ClCompile Include="..\src\mappers\24and26.cpp" />
<ClCompile Include="..\src\mappers\255.cpp" />
<ClCompile Include="..\src\mappers\27.cpp" />
<ClCompile Include="..\src\mappers\32.cpp" />
<ClCompile Include="..\src\mappers\33.cpp" />
<ClCompile Include="..\src\mappers\40.cpp" /> <ClCompile Include="..\src\mappers\40.cpp" />
<ClCompile Include="..\src\mappers\41.cpp" /> <ClCompile Include="..\src\mappers\41.cpp" />
<ClCompile Include="..\src\mappers\42.cpp" /> <ClCompile Include="..\src\mappers\42.cpp" />
@ -829,9 +827,7 @@
<ClInclude Include="..\src\input\share.h" /> <ClInclude Include="..\src\input\share.h" />
<ClInclude Include="..\src\input\suborkb.h" /> <ClInclude Include="..\src\input\suborkb.h" />
<ClInclude Include="..\src\mappers\emu2413.h" /> <ClInclude Include="..\src\mappers\emu2413.h" />
<ClInclude Include="..\src\mappers\emutypes.h" />
<ClInclude Include="..\src\mappers\mapinc.h" /> <ClInclude Include="..\src\mappers\mapinc.h" />
<ClInclude Include="..\src\mappers\vrc7tone.h" />
<ClInclude Include="..\src\utils\ConvertUTF.h" /> <ClInclude Include="..\src\utils\ConvertUTF.h" />
<ClInclude Include="..\src\utils\crc32.h" /> <ClInclude Include="..\src\utils\crc32.h" />
<ClInclude Include="..\src\utils\endian.h" /> <ClInclude Include="..\src\utils\endian.h" />

View File

@ -644,39 +644,9 @@
<ClCompile Include="..\src\lua\src\print.c"> <ClCompile Include="..\src\lua\src\print.c">
<Filter>drivers\win\lua</Filter> <Filter>drivers\win\lua</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\src\mappers\228.cpp">
<Filter>mappers</Filter>
</ClCompile>
<ClCompile Include="..\src\mappers\230.cpp">
<Filter>mappers</Filter>
</ClCompile>
<ClCompile Include="..\src\mappers\232.cpp">
<Filter>mappers</Filter>
</ClCompile>
<ClCompile Include="..\src\mappers\234.cpp">
<Filter>mappers</Filter>
</ClCompile>
<ClCompile Include="..\src\mappers\244.cpp">
<Filter>mappers</Filter>
</ClCompile>
<ClCompile Include="..\src\mappers\246.cpp">
<Filter>mappers</Filter>
</ClCompile>
<ClCompile Include="..\src\mappers\24and26.cpp"> <ClCompile Include="..\src\mappers\24and26.cpp">
<Filter>mappers</Filter> <Filter>mappers</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\src\mappers\255.cpp">
<Filter>mappers</Filter>
</ClCompile>
<ClCompile Include="..\src\mappers\27.cpp">
<Filter>mappers</Filter>
</ClCompile>
<ClCompile Include="..\src\mappers\32.cpp">
<Filter>mappers</Filter>
</ClCompile>
<ClCompile Include="..\src\mappers\33.cpp">
<Filter>mappers</Filter>
</ClCompile>
<ClCompile Include="..\src\mappers\40.cpp"> <ClCompile Include="..\src\mappers\40.cpp">
<Filter>mappers</Filter> <Filter>mappers</Filter>
</ClCompile> </ClCompile>
@ -967,6 +937,30 @@
<ClCompile Include="..\src\boards\vrc2and4.cpp"> <ClCompile Include="..\src\boards\vrc2and4.cpp">
<Filter>boards</Filter> <Filter>boards</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\src\boards\32.cpp">
<Filter>boards</Filter>
</ClCompile>
<ClCompile Include="..\src\boards\33.cpp">
<Filter>boards</Filter>
</ClCompile>
<ClCompile Include="..\src\boards\228.cpp">
<Filter>boards</Filter>
</ClCompile>
<ClCompile Include="..\src\boards\230.cpp">
<Filter>boards</Filter>
</ClCompile>
<ClCompile Include="..\src\boards\232.cpp">
<Filter>boards</Filter>
</ClCompile>
<ClCompile Include="..\src\boards\234.cpp">
<Filter>boards</Filter>
</ClCompile>
<ClCompile Include="..\src\boards\244.cpp">
<Filter>boards</Filter>
</ClCompile>
<ClCompile Include="..\src\boards\246.cpp">
<Filter>boards</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\src\cart.h"> <ClInclude Include="..\src\cart.h">
@ -1290,15 +1284,9 @@
<ClInclude Include="..\src\mappers\emu2413.h"> <ClInclude Include="..\src\mappers\emu2413.h">
<Filter>mappers</Filter> <Filter>mappers</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\src\mappers\emutypes.h">
<Filter>mappers</Filter>
</ClInclude>
<ClInclude Include="..\src\mappers\mapinc.h"> <ClInclude Include="..\src\mappers\mapinc.h">
<Filter>mappers</Filter> <Filter>mappers</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\src\mappers\vrc7tone.h">
<Filter>mappers</Filter>
</ClInclude>
<ClInclude Include="..\src\movie.h"> <ClInclude Include="..\src\movie.h">
<Filter>include files</Filter> <Filter>include files</Filter>
</ClInclude> </ClInclude>

View File

@ -681,6 +681,38 @@
RelativePath="..\src\boards\225.cpp" RelativePath="..\src\boards\225.cpp"
> >
</File> </File>
<File
RelativePath="..\src\boards\228.cpp"
>
</File>
<File
RelativePath="..\src\boards\230.cpp"
>
</File>
<File
RelativePath="..\src\boards\232.cpp"
>
</File>
<File
RelativePath="..\src\boards\234.cpp"
>
</File>
<File
RelativePath="..\src\boards\244.cpp"
>
</File>
<File
RelativePath="..\src\boards\246.cpp"
>
</File>
<File
RelativePath="..\src\boards\32.cpp"
>
</File>
<File
RelativePath="..\src\boards\33.cpp"
>
</File>
<File <File
RelativePath="..\src\boards\vrc2and4.cpp" RelativePath="..\src\boards\vrc2and4.cpp"
> >
@ -4132,50 +4164,10 @@
RelativePath="..\src\mappers\217.cpp" RelativePath="..\src\mappers\217.cpp"
> >
</File> </File>
<File
RelativePath="..\src\mappers\228.cpp"
>
</File>
<File
RelativePath="..\src\mappers\230.cpp"
>
</File>
<File
RelativePath="..\src\mappers\232.cpp"
>
</File>
<File
RelativePath="..\src\mappers\234.cpp"
>
</File>
<File
RelativePath="..\src\mappers\244.cpp"
>
</File>
<File
RelativePath="..\src\mappers\246.cpp"
>
</File>
<File <File
RelativePath="..\src\mappers\24and26.cpp" RelativePath="..\src\mappers\24and26.cpp"
> >
</File> </File>
<File
RelativePath="..\src\mappers\255.cpp"
>
</File>
<File
RelativePath="..\src\mappers\27.cpp"
>
</File>
<File
RelativePath="..\src\mappers\32.cpp"
>
</File>
<File
RelativePath="..\src\mappers\33.cpp"
>
</File>
<File <File
RelativePath="..\src\mappers\40.cpp" RelativePath="..\src\mappers\40.cpp"
> >
@ -4329,10 +4321,6 @@
RelativePath="..\src\mappers\emu2413.h" RelativePath="..\src\mappers\emu2413.h"
> >
</File> </File>
<File
RelativePath="..\src\mappers\emutypes.h"
>
</File>
<File <File
RelativePath="..\src\mappers\mapinc.h" RelativePath="..\src\mappers\mapinc.h"
> >
@ -4341,10 +4329,6 @@
RelativePath="..\src\mappers\mmc2and4.cpp" RelativePath="..\src\mappers\mmc2and4.cpp"
> >
</File> </File>
<File
RelativePath="..\src\mappers\vrc7tone.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="utils" Name="utils"

View File

@ -2507,10 +2507,6 @@
RelativePath="..\src\mappers\emu2413.h" RelativePath="..\src\mappers\emu2413.h"
> >
</File> </File>
<File
RelativePath="..\src\mappers\emutypes.h"
>
</File>
<File <File
RelativePath="..\src\mappers\mapinc.h" RelativePath="..\src\mappers\mapinc.h"
> >
@ -2519,14 +2515,6 @@
RelativePath="..\src\mappers\mmc2and4.cpp" RelativePath="..\src\mappers\mmc2and4.cpp"
> >
</File> </File>
<File
RelativePath="..\src\mappers\simple.cpp"
>
</File>
<File
RelativePath="..\src\mappers\vrc7tone.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="utils" Name="utils"