Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
saulfabregwiivc authored Aug 3, 2021
1 parent 2319886 commit 7e0a452
Show file tree
Hide file tree
Showing 80 changed files with 8,521 additions and 0 deletions.
111 changes: 111 additions & 0 deletions source/fceux/boards/01-222.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2006 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
*
* TXC mappers, originally much complex banksitching
*
* P/N PRG MAP, UNIF Name
* 01-22111-000 (05-00002-010) (132, 22211) - MGC-001 Qi Wang
* 01-22110-000 (52S ) - MGC-002 2-in-1 Gun
* 01-22111-100 (02-00002-010) (173 ) - MGC-008 Mahjong Block
* (079 ) - MGC-012 Poke Block
* 01-22110-200 (05-00002-010) (036 ) - MGC-014 Strike Wolf
* 01-22000-400 (05-00002-010) (036 ) - MGC-015 Policeman
* 01-22017-000 (05-PT017-080) (189 ) - MGC-017 Thunder Warrior
* 01-11160-000 (04-02310-000) ( , 11160) - MGC-023 6-in-1
* 01-22026-000 (05-04010-090) ( ) - MGC-026 4-in-1
* 01-22270-000 (05-00002-010) (132, 22211) - MGC-xxx Creatom
* 01-22200-400 (------------) (079 ) - ET.03 F-15 City War
* (172 ) - 1991 Du Ma Racing
*
*/

#include "mapinc.h"

static uint8 reg[4], cmd, is172, is173;
static SFORMAT StateRegs[] =
{
{ reg, 4, "REGS" },
{ &cmd, 1, "CMD" },
{ 0 }
};

static void Sync(void) {
setprg32(0x8000, (reg[2] >> 2) & 1);
if (is172)
setchr8((((cmd ^ reg[2]) >> 3) & 2) | (((cmd ^ reg[2]) >> 5) & 1)); // 1991 DU MA Racing probably CHR bank sequence is WRONG, so it is possible to
// rearrange CHR banks for normal UNIF board and mapper 172 is unneccessary
else
setchr8(reg[2] & 3);
}

static DECLFW(UNL22211WriteLo) {
// FCEU_printf("bs %04x %02x\n",A,V);
reg[A & 3] = V;
}

static DECLFW(UNL22211WriteHi) {
// FCEU_printf("bs %04x %02x\n",A,V);
cmd = V;
Sync();
}

static DECLFR(UNL22211ReadLo) {
return (reg[1] ^ reg[2]) | (is173 ? 0x01 : 0x40);
// if(reg[3])
// return reg[2];
// else
// return X.DB;
}

static void UNL22211Power(void) {
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetReadHandler(0x4100, 0x4100, UNL22211ReadLo);
SetWriteHandler(0x4100, 0x4103, UNL22211WriteLo);
SetWriteHandler(0x8000, 0xFFFF, UNL22211WriteHi);
}

static void StateRestore(int version) {
Sync();
}

void UNL22211_Init(CartInfo *info) {
is172 = 0;
is173 = 0;
info->Power = UNL22211Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

void Mapper172_Init(CartInfo *info) {
is172 = 1;
is173 = 0;
info->Power = UNL22211Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

void Mapper173_Init(CartInfo *info) {
is172 = 0;
is173 = 1;
info->Power = UNL22211Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

97 changes: 97 additions & 0 deletions source/fceux/boards/09-034a.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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
*
* FDS Conversions
*
* Super Mario Bros 2j (Alt Full) is a BAD incomplete dump, should be mapper 43
*
* Both Voleyball and Zanac by Whirlind Manu shares the same PCB, but with
* some differences: Voleyball has 8K CHR ROM and 8K ROM at 6000K, Zanac
* have 8K CHR RAM and banked 16K ROM mapper at 6000 as two 8K banks.
*
* Super Mario Bros 2j (Alt Small) uses additionally IRQ timer to drive framerate
*
* PCB for this mapper is "09-034A"
*/

#include "mapinc.h"

static uint8 prg;
static uint32 IRQCount, IRQa;

static SFORMAT StateRegs[] =
{
{ &IRQCount, 4, "IRQC" },
{ &IRQa, 4, "IRQA" },
{ &prg, 1, "PRG" },
{ 0 }
};

static void Sync(void) {
setprg8r(1, 0x6000, prg);
setprg32(0x8000, 0);
setchr8(0);
}

static DECLFW(UNLSMB2JWrite1) {
prg = V & 1;
Sync();
}

static DECLFW(UNLSMB2JWrite2) {
IRQa = V & 1;
IRQCount = 0;
X6502_IRQEnd(FCEU_IQEXT);
}

static DECLFR(UNLSMB2JRead) {
return 0xFF;
}

static void UNLSMB2JPower(void) {
prg = 0;
Sync();
SetReadHandler(0x6000, 0xFFFF, CartBR);
SetReadHandler(0x4042, 0x4055, UNLSMB2JRead);
SetWriteHandler(0x4068, 0x4068, UNLSMB2JWrite2);
SetWriteHandler(0x4027, 0x4027, UNLSMB2JWrite1);
}

static void UNLSMB2JIRQHook(int a) {
if (IRQa)
{
if (IRQCount < 5750) // completely by guess
IRQCount += a;
else {
IRQa = 0;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}

static void StateRestore(int version) {
Sync();
}

void UNLSMB2J_Init(CartInfo *info) {
info->Power = UNLSMB2JPower;
MapIRQHook = UNLSMB2JIRQHook;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
112 changes: 112 additions & 0 deletions source/fceux/boards/103.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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 reg0, reg1, reg2;
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;

static SFORMAT StateRegs[] =
{
{ &reg0, 1, "REG0" },
{ &reg1, 1, "REG1" },
{ &reg2, 1, "REG2" },
{ 0 }
};

static void Sync(void) {
setchr8(0);
setprg8(0x8000, 0xc);
setprg8(0xe000, 0xf);
if (reg2 & 0x10) {
setprg8(0x6000, reg0);
setprg8(0xa000, 0xd);
setprg8(0xc000, 0xe);
} else {
setprg8r(0x10, 0x6000, 0);
setprg4(0xa000, (0xd << 1));
setprg2(0xb000, (0xd << 2) + 2);
setprg2r(0x10, 0xb800, 4);
setprg2r(0x10, 0xc000, 5);
setprg2r(0x10, 0xc800, 6);
setprg2r(0x10, 0xd000, 7);
setprg2(0xd800, (0xe << 2) + 3);
}
setmirror(reg1 ^ 1);
}

static DECLFW(M103RamWrite0) {
WRAM[A & 0x1FFF] = V;
}

static DECLFW(M103RamWrite1) {
WRAM[0x2000 + ((A - 0xB800) & 0x1FFF)] = V;
}

static DECLFW(M103Write0) {
reg0 = V & 0xf;
Sync();
}

static DECLFW(M103Write1) {
reg1 = (V >> 3) & 1;
Sync();
}

static DECLFW(M103Write2) {
reg2 = V;
Sync();
}

static void M103Power(void) {
reg0 = reg1 = 0; reg2 = 0;
Sync();
SetReadHandler(0x6000, 0x7FFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, M103RamWrite0);
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0xB800, 0xD7FF, M103RamWrite1);
SetWriteHandler(0x8000, 0x8FFF, M103Write0);
SetWriteHandler(0xE000, 0xEFFF, M103Write1);
SetWriteHandler(0xF000, 0xFFFF, M103Write2);
}

static void M103Close(void) {
if (WRAM)
FCEU_gfree(WRAM);
WRAM = NULL;
}

static void StateRestore(int version) {
Sync();
}

void Mapper103_Init(CartInfo *info) {
info->Power = M103Power;
info->Close = M103Close;
GameStateRestore = StateRestore;

WRAMSIZE = 16384;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");

AddExState(&StateRegs, ~0, 0, 0);
}
Loading

0 comments on commit 7e0a452

Please sign in to comment.