Add mapper 548.

This commit is contained in:
NewRisingSun
2025-09-12 01:25:50 +02:00
parent 48018ab086
commit f56be8ce5e
3 changed files with 109 additions and 0 deletions

107
src/boards/548.c Normal file
View File

@@ -0,0 +1,107 @@
/* FCEUmm - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2020
*
* 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
*
*
*/
/* The UNIF dump of "(JY-103) 3-in-1" (JY4M4 MAPR) has a strange bank order and will not run with this emulation. */
#include "mapinc.h"
#include "wram.h"
#include "../fds_apu.h"
static uint8 reg;
static uint8 latch;
static uint8 counting;
static uint16 counter;
static SFORMAT stateRegs[] ={
{ &reg, 1, "REGM" },
{ &latch, 1, "LATC" },
{ &counting, 1, "IRQA" },
{ &counter, 2, "IRQC" },
{ 0 }
};
static void sync () {
setprg8r(0x10, 0x6000, 0);
setprg16(0x8000, reg);
setprg16(0xC000, 3);
setchr8(0);
}
static DECLFW (writeLatch) {
latch = A >>2 &0x03 | A >>3 &0x04;
if (A &4) {
counting = 0;
counter = 0;
X6502_IRQEnd(FCEU_IQEXT);
} else
counting = 1;
}
static DECLFW (writeReg) {
reg = latch ^0x05;
sync();
}
static void FP_FASTAPASS(1) cpuCycle (int a) {
while (a--) {
if (counting) {
if (counter == 23680)
X6502_IRQBegin(FCEU_IQEXT);
else
if (counter == 24320)
X6502_IRQEnd(FCEU_IQEXT);
counter++;
}
}
}
static void reset() {
FDSSoundReset();
X6502_IRQEnd(FCEU_IQEXT);
latch = 0x07;
reg = latch ^0x05;
counting = 0;
counter = 0;
sync();
}
static void power() {
FDSSoundPower();
SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x4800, 0x4FFF, writeLatch);
SetWriteHandler(0x5000, 0x57FF, writeReg);
SetWriteHandler(0x6000, 0x7FFF, CartBW);
reset();
}
static void stateRestore(int version) {
sync();
}
void Mapper548_Init (CartInfo *info) {
WRAM_init(info, 8);
info->Power = power;
info->Reset = reset;
MapIRQHook = cpuCycle;
GameStateRestore = stateRestore;
AddExState(stateRegs, ~0, 0, 0);
}

View File

@@ -971,6 +971,7 @@ INES_BOARD_BEGIN()
INES_BOARD( "WAIXING FS306", 544, Mapper544_Init )
INES_BOARD( "ST-80", 545, Mapper545_Init )
INES_BOARD( "03-101", 546, Mapper546_Init )
INES_BOARD( "CTC-15", 548, Mapper548_Init )
INES_BOARD( "Kaiser KS-7016B", 549, Mapper549_Init )
INES_BOARD( "", 550, Mapper550_Init )
INES_BOARD( "", 551, Mapper178_Init )

View File

@@ -439,6 +439,7 @@ void Mapper543_Init(CartInfo *);
void Mapper544_Init(CartInfo *);
void Mapper545_Init(CartInfo *);
void Mapper546_Init(CartInfo *);
void Mapper548_Init(CartInfo *);
void Mapper549_Init(CartInfo *);
void Mapper550_Init(CartInfo *);
void Mapper552_Init(CartInfo *);