mapper 24 fixed

mapper 26 fixed
formatting fix, cleanup
This commit is contained in:
CaH4e3 2012-12-31 08:47:09 +00:00
parent ca82eadedf
commit 1d5157dca2
13 changed files with 317 additions and 302 deletions

View File

@ -24,7 +24,7 @@
extern uint32 ROM_size;
static uint8 prg[4], chr, sbw, we_sram;
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
@ -135,7 +135,7 @@ static void M176Close(void)
{
if(WRAM)
FCEU_gfree(WRAM);
WRAM=NULL;
WRAM = NULL;
}
static void StateRestore(int version)

View File

@ -21,7 +21,7 @@
#include "mapinc.h"
static uint8 regs[8];
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =

View File

@ -22,7 +22,7 @@
static uint8 preg[2], creg[8], mirr;
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =

View File

@ -23,7 +23,7 @@
static uint8 cmdreg, preg[4], creg[8], mirr;
static uint8 IRQa;
static int32 IRQCount;
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =

View File

@ -21,7 +21,7 @@
#include "mapinc.h"
static uint8 latch;
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static writefunc old4016;

View File

@ -24,9 +24,9 @@ static uint8 reg[8];
static uint8 IRQa;
static int16 IRQCount, IRQLatch;
/*
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static uint8 *CHRRAM=NULL;
static uint8 *CHRRAM = NULL;
static uint32 CHRRAMSIZE;
*/

View File

@ -26,7 +26,7 @@
static uint8 preg[4], creg[8], latch, ffemode;
static uint8 IRQa, mirr;
static int32 IRQCount, IRQLatch;
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =

View File

@ -23,7 +23,7 @@
static uint8 is10;
static uint8 creg[4], latch0, latch1, preg, mirr;
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =

View File

@ -28,7 +28,7 @@ static uint8 IRQx; //autoenable
static uint8 IRQm; //mode
static uint8 IRQa;
static uint16 IRQReload, IRQCount;
static uint8 *WRAM=NULL;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =

View File

@ -26,7 +26,9 @@
static uint8 is26;
static uint8 prg[2], chr[8], mirr;
static uint8 IRQLatch, IRQa, IRQd;
static uint32 IRQCount, CycleCount;
static int32 IRQCount, CycleCount;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =
{
@ -42,21 +44,23 @@ static SFORMAT StateRegs[] =
};
static void(*sfun[3]) (void);
static uint8 vpsg1[8];
static uint8 vpsg2[4];
static uint8 vpsg1[4];
static int32 cvbc[3];
static int32 vcount[3];
static int32 dcount[2];
static SFORMAT SStateRegs[] =
{
{ vpsg1, 4, "PSG1" },
{ vpsg1, 8, "PSG1" },
{ vpsg2, 4, "PSG2" },
{ 0 }
};
static void Sync(void) {
uint8 i;
if (is26)
setprg8r(0x10, 0x6000, 0);
setprg16(0x8000, prg[0]);
setprg8(0xc000, prg[1]);
setprg8(0xe000, ~0);
@ -103,14 +107,13 @@ static DECLFW(VRC6Write) {
case 0xE001: chr[5] = V; Sync(); break;
case 0xE002: chr[6] = V; Sync(); break;
case 0xE003: chr[7] = V; Sync(); break;
case 0xF000: IRQLatch = V; break;
case 0xF000: IRQLatch = V; X6502_IRQEnd(FCEU_IQEXT); break;
case 0xF001:
IRQa = V & 2;
IRQd = V & 1;
if (V & 2) {
if (V & 2)
IRQCount = IRQLatch;
CycleCount = 0;
}
CycleCount = 0;
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0xF002:
@ -121,26 +124,32 @@ static DECLFW(VRC6Write) {
static void VRC6Power(void) {
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetWriteHandler(0x8000, 0xFFFF, VRC6Write);
}
static void VRC6IRQHook(int a) {
if (IRQa) {
CycleCount += a * 3;
if (CycleCount >= 341) {
while(CycleCount >= 341) {
CycleCount -= 341;
IRQCount++;
if (IRQCount == 0x100) {
X6502_IRQBegin(FCEU_IQEXT);
IRQCount = IRQLatch;
}
while(CycleCount >= 341) {
CycleCount -= 341;
IRQCount++;
if (IRQCount == 0x100) {
IRQCount = IRQLatch;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
}
static void VRC6Close(void)
{
if (WRAM)
FCEU_gfree(WRAM);
WRAM = NULL;
}
static void StateRestore(int version) {
Sync();
}
@ -231,7 +240,7 @@ static void DoSawV(void) {
}
static INLINE void DoSQVHQ(int x) {
uint32 V;
int32 V;
int32 amp = ((vpsg1[x << 2] & 15) << 8) * 6 / 8;
if (vpsg1[(x << 2) | 0x2] & 0x80) {
@ -265,7 +274,7 @@ static void DoSQV2HQ(void) {
static void DoSawVHQ(void) {
static uint8 b3 = 0;
static int32 phaseacc = 0;
uint32 V;
int32 V;
if (vpsg2[2] & 0x80) {
for (V = cvbc[2]; V < SOUNDTS; V++) {
@ -345,9 +354,20 @@ void Mapper24_Init(CartInfo *info) {
void Mapper26_Init(CartInfo *info) {
is26 = 1;
info->Power = VRC6Power;
info->Close = VRC6Close;
MapIRQHook = VRC6IRQHook;
VRC6_ESI();
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);
}

View File

@ -22,8 +22,8 @@
static uint8 vrc7idx, preg[3], creg[8], mirr;
static uint8 IRQLatch, IRQa, IRQd;
static uint32 IRQCount, CycleCount;
static uint8 *WRAM=NULL;
static int32 IRQCount, CycleCount;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[] =
@ -163,14 +163,12 @@ static void VRC7Close(void)
static void VRC7IRQHook(int a) {
if (IRQa) {
CycleCount += a * 3;
if (CycleCount >= 341) {
while(CycleCount >= 341) {
CycleCount -= 341;
IRQCount++;
if (IRQCount & 0x100) {
IRQCount = IRQLatch;
X6502_IRQBegin(FCEU_IQEXT);
}
while(CycleCount >= 341) {
CycleCount -= 341;
IRQCount++;
if (IRQCount == 0x100) {
IRQCount = IRQLatch;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}

View File

@ -24,7 +24,7 @@
static uint8 prg[3], chr[8], mirr;
static uint8 IRQLatch, IRQa, IRQd;
static uint32 IRQCount, CycleCount;
static int32 IRQCount, CycleCount;
static SFORMAT StateRegs[] =
{
@ -69,10 +69,7 @@ static DECLFW(UNLVRC7Write) {
case 0xd000: chr[6] = V; Sync(); break;
case 0xd008: chr[7] = V; Sync(); break;
case 0xe000: mirr = V; Sync(); break;
case 0xe008:
IRQLatch = V;
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0xe008: IRQLatch = V; X6502_IRQEnd(FCEU_IQEXT); break;
case 0xf000:
IRQa = V & 2;
IRQd = V & 1;
@ -104,8 +101,8 @@ static void UNLVRC7IRQHook(int a) {
CycleCount -= 341;
IRQCount++;
if (IRQCount == 248) {
X6502_IRQBegin(FCEU_IQEXT);
IRQCount = IRQLatch;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}

View File

@ -451,18 +451,18 @@ static BMAPPINGLocal bmap[] = {
{"CNROM", 3, CNROM_Init},
{"MMC3", 4, Mapper4_Init},
{"MMC5", 5, Mapper5_Init},
{"FFE", 6, Mapper6_Init},
{"FFE Rev. A", 6, Mapper6_Init},
{"ANROM", 7, ANROM_Init},
{"", 8, Mapper8_Init}, // Nogaems, it's worthless
{"MMC2", 9, Mapper9_Init},
{"MMC4", 10, Mapper10_Init},
{"Color Dreams", 11, Mapper11_Init},
{"", 12, Mapper12_Init},
{"REX DBZ 5", 12, Mapper12_Init},
{"CPROM", 13, CPROM_Init},
// {"", 14, Mapper14_Init},
{"100-in-1", 15, Mapper15_Init},
{"Bandai", 16, Mapper16_Init},
{"", 17, Mapper17_Init},
{"FFE Rev. B", 17, Mapper17_Init},
{"JALECO SS880006", 18, Mapper18_Init}, // JF-NNX (EB89018-30007) boards
{"Namcot 106", 19, Mapper19_Init},
// {"", 20, Mapper20_Init},
@ -479,34 +479,34 @@ static BMAPPINGLocal bmap[] = {
// {"", 31, Mapper31_Init},
{"IREM G-101", 32, Mapper32_Init},
{"TC0190FMC/TC0350FMR", 33, Mapper33_Init},
{"", 34, Mapper34_Init},
{"IREM I-IM/BNROM", 34, Mapper34_Init},
{"Wario Land 2", 35, UNLSC127_Init},
{"TXC Policeman", 36, Mapper36_Init},
{"", 37, Mapper37_Init},
{"PAL-ZZ SMB/TETRIS/NWC",37, Mapper37_Init},
{"Bit Corp.", 38, Mapper38_Init}, // Crime Busters
// {"", 39, Mapper39_Init},
{"SMB2j FDS", 40, Mapper40_Init},
{"CALTRON 6-in-1", 41, Mapper41_Init},
{"BIO MIRACLE FDS", 42, Mapper42_Init},
{"", 43, Mapper43_Init},
{"", 44, Mapper44_Init},
{"", 45, Mapper45_Init},
{"FDS SMB2j LF36", 43, Mapper43_Init},
{"MMC3 BMC PIRATE A", 44, Mapper44_Init},
{"MMC3 BMC PIRATE B", 45, Mapper45_Init},
{"RUMBLESTATION 15-in-1",46, Mapper46_Init},
{"", 47, Mapper47_Init},
{"NES-QJ SSVB/NWC", 47, Mapper47_Init},
{"TAITO TCxxx", 48, Mapper48_Init},
{"", 49, Mapper49_Init},
{"SMB2j FDS REV A", 50, Mapper50_Init},
{"MMC3 BMC PIRATE C", 49, Mapper49_Init},
{"SMB2j FDS Rev. A", 50, Mapper50_Init},
{"11-in-1 BALL SERIES", 51, Mapper51_Init}, // 1993 year version
{"", 52, Mapper52_Init},
{"MMC3 BMC PIRATE D", 52, Mapper52_Init},
// {"", 53, Mapper53_Init}, // iNES version of complex UNIF board, can't emulate properly as iNES
// {"", 54, Mapper54_Init},
// {"", 55, Mapper55_Init},
// {"", 56, Mapper56_Init},
{"", 57, Mapper57_Init},
{"", 58, BMCGK192_Init},
{"SIMBPLE BMC PIRATE A", 57, Mapper57_Init},
{"SIMBPLE BMC PIRATE B", 58, BMCGK192_Init},
{"", 59, Mapper59_Init}, // Check this out
{"", 60, BMCD1038_Init},
{"20-in-1 KAISER REV A", 61, Mapper61_Init},
{"SIMBPLE BMC PIRATE C", 60, BMCD1038_Init},
{"20-in-1 KAISER Rev. A",61, Mapper61_Init},
{"700-in-1", 62, Mapper62_Init},
// {"", 63, Mapper63_Init},
{"TENGEN RAMBO1", 64, Mapper64_Init},
@ -519,77 +519,77 @@ static BMAPPINGLocal bmap[] = {
{"CAMERICA BF9093", 71, Mapper71_Init},
{"JALECO JF-17", 72, Mapper72_Init},
{"KONAMI VRC3", 73, Mapper73_Init},
{"TW MMC3+VRAM VER. A", 74, Mapper74_Init},
{"TW MMC3+VRAM Rev. A", 74, Mapper74_Init},
{"KONAMI VRC1", 75, Mapper75_Init},
{"NAMCOT 108 VER. A", 76, Mapper76_Init},
{"NAMCOT 108 Rev. A", 76, Mapper76_Init},
{"IREM LROG017", 77, Mapper77_Init},
{"Irem 74HC161/32", 78, Mapper78_Init},
{"AVE/C&E/TXC BOARD", 79, Mapper79_Init},
{"TAITO X1-005 VER. A", 80, Mapper80_Init},
{"TAITO X1-005 Rev. A", 80, Mapper80_Init},
// {"", 81, Mapper81_Init},
{"", 82, Mapper82_Init},
{"", 83, Mapper83_Init},
{"TAITO X1-017", 82, Mapper82_Init},
{"YOKO VRC Rev. B", 83, Mapper83_Init},
// {"", 84, Mapper84_Init},
{"KONAMI VRC7", 85, Mapper85_Init},
{"", 86, Mapper86_Init},
{"", 87, Mapper87_Init},
{"", 88, Mapper88_Init},
{"JALECO JF-13", 86, Mapper86_Init},
{"74*139/74 DISCRETE", 87, Mapper87_Init},
{"NAMCO 3433", 88, Mapper88_Init},
{"SUNSOFT-3", 89, Mapper89_Init}, // SUNSOFT-2 mapper
{"", 90, Mapper90_Init},
{"", 91, Mapper91_Init},
{"", 92, Mapper92_Init},
{"HUMMER/JY BOARD", 90, Mapper90_Init},
{"EARLY HUMMER/JY BOARD",91, Mapper91_Init},
{"JALECO JF-19", 92, Mapper92_Init},
{"SUNSOFT-3R", 93, SUNSOFT_UNROM_Init}, // SUNSOFT-2 mapper with VRAM, different wiring
{"", 94, Mapper94_Init},
{"NAMCOT 108 VER. B", 95, Mapper95_Init},
{"", 96, Mapper96_Init},
{"", 97, Mapper97_Init},
{"HVC-UN1ROM", 94, Mapper94_Init},
{"NAMCOT 108 Rev. B", 95, Mapper95_Init},
{"BANDAI OEKAKIDS", 96, Mapper96_Init},
{"IREM TAM-S1", 97, Mapper97_Init},
// {"", 98, Mapper98_Init},
{"", 99, Mapper99_Init},
{"VS Uni/Dual- system", 99, Mapper99_Init},
// {"", 100, Mapper100_Init},
{"", 101, Mapper101_Init},
// {"", 102, Mapper102_Init},
{"", 103, Mapper103_Init},
{"FDS DOKIDOKI FULL", 103, Mapper103_Init},
// {"", 104, Mapper104_Init},
{"", 105, Mapper105_Init},
{"", 106, Mapper106_Init},
{"", 107, Mapper107_Init},
{"", 108, Mapper108_Init},
{"NES-EVENT NWC1990", 105, Mapper105_Init},
{"SMB3 PIRATE A", 106, Mapper106_Init},
{"MAGIC CORP A", 107, Mapper107_Init},
{"FDS UNROM BOARD", 108, Mapper108_Init},
// {"", 109, Mapper109_Init},
// {"", 110, Mapper110_Init},
// {"", 111, Mapper111_Init},
{"", 112, Mapper112_Init},
{"", 113, Mapper113_Init},
{"", 114, Mapper114_Init},
{"", 115, Mapper115_Init},
{"", 116, UNLSL12_Init},
{"", 117, Mapper117_Init},
{"ASDER/NTDEC BOARD", 112, Mapper112_Init},
{"HACKER/SACHEN BOARD", 113, Mapper113_Init},
{"MMC3 SG PROT. A", 114, Mapper114_Init},
{"MMC3 PIRATE A", 115, Mapper115_Init},
{"MMC1/MMC3/VRC PIRATE",116, UNLSL12_Init},
{"FUTURE MEDIA BOARD", 117, Mapper117_Init},
{"TSKROM", 118, TKSROM_Init},
{"", 119, Mapper119_Init},
{"", 120, Mapper120_Init},
{"", 121, Mapper121_Init},
{"NES-TQROM", 119, Mapper119_Init},
{"FDS TOBIDASE", 120, Mapper120_Init},
{"MMC3 PIRATE PROT. A", 121, Mapper121_Init},
// {"", 122, Mapper122_Init},
{"UNLH2288", 123, UNLH2288_Init},
{"MMC3 PIRATE H2288", 123, UNLH2288_Init},
// {"", 124, Mapper124_Init},
{"", 125, LH32_Init},
{"FDS LH32", 125, LH32_Init},
// {"", 126, Mapper126_Init},
// {"", 127, Mapper127_Init},
// {"", 128, Mapper128_Init},
// {"", 129, Mapper129_Init},
// {"", 130, Mapper130_Init},
// {"", 131, Mapper131_Init},
{"UNL22211", 132, UNL22211_Init},
{"TXC/MGENIUS 22111", 132, UNL22211_Init},
{"SA72008", 133, SA72008_Init},
{"", 134, Mapper134_Init},
{"MMC3 BMC PIRATE", 134, Mapper134_Init},
// {"", 135, Mapper135_Init},
{"TCU02", 136, TCU02_Init},
{"S8259D", 137, S8259D_Init},
{"S8259B", 138, S8259B_Init},
{"S8259C", 139, S8259C_Init},
{"", 140, Mapper140_Init},
{"JALECO JF-11/14", 140, Mapper140_Init},
{"S8259A", 141, S8259A_Init},
{"UNLKS7032", 142, UNLKS7032_Init},
{"TCA01", 143, TCA01_Init},
{"", 144, Mapper144_Init},
{"AGCI 50282", 144, Mapper144_Init},
{"SA72007", 145, SA72007_Init},
{"SA0161M", 146, SA0161M_Init},
{"TCU01", 147, TCU01_Init},
@ -637,13 +637,13 @@ static BMAPPINGLocal bmap[] = {
{"", 189, Mapper189_Init},
// {"", 190, Mapper190_Init},
{"", 191, Mapper191_Init},
{"TW MMC3+VRAM VER. B", 192, Mapper192_Init},
{"TW MMC3+VRAM Rev. B", 192, Mapper192_Init},
{"NTDEC TC-112", 193, Mapper193_Init}, // War in the Gulf
{"TW MMC3+VRAM VER. C", 194, Mapper194_Init},
{"TW MMC3+VRAM VER. D", 195, Mapper195_Init},
{"TW MMC3+VRAM Rev. C", 194, Mapper194_Init},
{"TW MMC3+VRAM Rev. D", 195, Mapper195_Init},
{"", 196, Mapper196_Init},
{"", 197, Mapper197_Init},
{"TW MMC3+VRAM VER. E", 198, Mapper198_Init},
{"TW MMC3+VRAM Rev. E", 198, Mapper198_Init},
{"", 199, Mapper199_Init},
{"", 200, Mapper200_Init},
{"", 201, Mapper201_Init},
@ -651,8 +651,8 @@ static BMAPPINGLocal bmap[] = {
{"", 203, Mapper203_Init},
{"", 204, Mapper204_Init},
{"", 205, Mapper205_Init},
{"NAMCOT 108 VER. C", 206, Mapper206_Init}, // Deprecated, Used to be "DEIROM" whatever it means, but actually simple version of MMC3
{"TAITO X1-005 VER. B", 207, Mapper207_Init},
{"NAMCOT 108 Rev. C", 206, Mapper206_Init}, // Deprecated, Used to be "DEIROM" whatever it means, but actually simple version of MMC3
{"TAITO X1-005 Rev. B", 207, Mapper207_Init},
{"", 208, Mapper208_Init},
{"", 209, Mapper209_Init},
{"", 210, Mapper210_Init},