Add mapper 413.
This commit is contained in:
committed by
LibretroAdmin
parent
a4a98006cf
commit
810090db73
104
src/boards/413.c
Normal file
104
src/boards/413.c
Normal file
@@ -0,0 +1,104 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2025 NewRisingSun
|
||||
*
|
||||
* 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 reg[4];
|
||||
static uint32 pcmAddress, pcmAddressMask;
|
||||
static uint8 pcmControl;
|
||||
static uint8 scanlineCounter;
|
||||
static uint8 scanlineReload;
|
||||
static uint8 scanlineIRQ;
|
||||
static uint32 lasttime;
|
||||
extern uint32 timestamp;
|
||||
|
||||
static SFORMAT stateRegs[] ={
|
||||
{ reg, 4, "REGS" },
|
||||
{ &pcmAddress, 4, "PCMA" },
|
||||
{ &pcmControl, 1, "PCMC" },
|
||||
{ &scanlineCounter, 1, "SLCN" },
|
||||
{ &scanlineReload, 1, "SLRL" },
|
||||
{ &scanlineIRQ, 1, "SLEN" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void sync() {
|
||||
setprg4(0x5000, 1);
|
||||
setprg8(0x6000, reg[0]);
|
||||
setprg8(0x8000, reg[1]);
|
||||
setprg8(0xA000, reg[2]);
|
||||
setprg4(0xD000, 7);
|
||||
setprg8(0xE000, 4);
|
||||
setchr4(0x0000, reg[3]);
|
||||
setchr4(0x1000, ~2);
|
||||
}
|
||||
|
||||
static DECLFR(readPCM) {
|
||||
uint8 result =MiscROM[pcmAddress &pcmAddressMask];
|
||||
if (timestamp <lasttime || timestamp >(lasttime +6)) {
|
||||
if (pcmControl &2) ++pcmAddress;
|
||||
lasttime =timestamp;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static DECLFW(writeReg) {
|
||||
switch(A >>12 &7) {
|
||||
case 0: scanlineReload =V;
|
||||
break;
|
||||
case 1: scanlineCounter =0;
|
||||
break;
|
||||
case 2: scanlineIRQ =0;
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
break;
|
||||
case 3: scanlineIRQ =1;
|
||||
break;
|
||||
case 4: pcmAddress =pcmAddress <<1 | V >>7;
|
||||
break;
|
||||
case 5: pcmControl =V;
|
||||
break;
|
||||
case 6:
|
||||
case 7: reg[V >>6] =V &0x3F;
|
||||
sync();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void horizontalBlanking () {
|
||||
scanlineCounter =!scanlineCounter? scanlineReload: --scanlineCounter;
|
||||
if (!scanlineCounter && scanlineIRQ) X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
|
||||
static void power (void) {
|
||||
pcmAddress =pcmControl =lasttime =0;
|
||||
scanlineCounter =scanlineReload =scanlineIRQ =0;
|
||||
sync();
|
||||
SetReadHandler(0x5000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, writeReg);
|
||||
SetReadHandler(0xC000, 0xCFFF, readPCM);
|
||||
}
|
||||
|
||||
void Mapper413_Init(CartInfo *info) {
|
||||
pcmAddressMask =info->miscROMSize -1;
|
||||
GameStateRestore =sync;
|
||||
GameHBIRQHook =horizontalBlanking;
|
||||
info->Power = power;
|
||||
AddExState(stateRegs, ~0, 0, 0);
|
||||
}
|
||||
@@ -624,6 +624,7 @@ void Mapper561_562_Init(CartInfo *info) {
|
||||
} else
|
||||
trainerSize =0;
|
||||
|
||||
GameStateRestore =sync;
|
||||
info->Power =power;
|
||||
info->Close =close;
|
||||
if (maker ==VENUS) {
|
||||
|
||||
@@ -843,6 +843,7 @@ INES_BOARD_BEGIN()
|
||||
INES_BOARD( "JY-302", 410, Mapper410_Init )
|
||||
INES_BOARD( "A88S-1", 411, Mapper411_Init )
|
||||
INES_BOARD( "Henggedianzi FK-206 JG", 412, Mapper412_Init )
|
||||
INES_BOARD( "BATMAP-SRR-X", 413, Mapper413_Init )
|
||||
INES_BOARD( "9999999-in-1", 414, Mapper414_Init )
|
||||
INES_BOARD( "0353", 415, Mapper415_Init )
|
||||
INES_BOARD( "4-in-1/N-32", 416, Mapper416_Init )
|
||||
|
||||
@@ -322,6 +322,7 @@ void Mapper409_Init(CartInfo *);
|
||||
void Mapper410_Init(CartInfo *);
|
||||
void Mapper411_Init(CartInfo *);
|
||||
void Mapper412_Init(CartInfo *);
|
||||
void Mapper413_Init(CartInfo *);
|
||||
void Mapper414_Init(CartInfo *);
|
||||
void Mapper415_Init(CartInfo *);
|
||||
void Mapper416_Init(CartInfo *);
|
||||
|
||||
Reference in New Issue
Block a user