Add mapper 565.

This commit is contained in:
NewRisingSun
2025-09-10 23:06:31 +02:00
parent 33974f5438
commit acdf0b83c1
4 changed files with 84 additions and 2 deletions

View File

@@ -36,7 +36,7 @@ static void sync () {
VRC24_syncMirror();
}
DECLFW(Mapper563_writeIRQ) {
static DECLFW(Mapper563_writeIRQ) {
X6502_IRQEnd(FCEU_IQEXT);
switch(A &0x1C) {
case 0x0C: irqEnabled =0; break;
@@ -49,7 +49,7 @@ static void Mapper563_scanline (void) { /* Actually, a sixteen-stage counter tri
if (!(++irqCounter &1) && irqEnabled) X6502_IRQBegin(FCEU_IQEXT);
}
void Mapper563_power(void) {
static void Mapper563_power(void) {
irqEnabled =irqCounter =0;
VRC24_power();
SetWriteHandler(0xF000, 0xFFFF, Mapper563_writeIRQ);

80
src/boards/565.c Normal file
View File

@@ -0,0 +1,80 @@
/* 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"
#include "asic_vrc2and4.h"
static uint8 irqEnabled;
static uint8 irqCounter;
static uint8 irqPrescaler;
static uint8 irqMask;
static SFORMAT stateRegs[] ={
{ &irqEnabled, 1, "IRQE" },
{ &irqCounter, 1, "CNTL" },
{ &irqPrescaler, 1, "IRQP" },
{ &irqMask, 1, "IRQC" },
{ 0 }
};
static void sync () {
VRC24_syncPRG(0x01F, 0x000);
VRC24_syncCHR(0x1FF, 0x000);
VRC24_syncMirror();
}
static DECLFW(writeIRQ) {
switch(A &0x0C) {
case 0:
irqCounter = V;
irqPrescaler = 0;
X6502_IRQEnd(FCEU_IQEXT);
break;
case 4:
irqEnabled = V;
break;
}
}
void FP_FASTAPASS(1) cpuCycle (int a) {
while (a--) {
if (irqEnabled &1) {
irqPrescaler++;
if (irqPrescaler == 64 && !++irqCounter) X6502_IRQBegin(FCEU_IQEXT);
if (irqPrescaler == 112) irqPrescaler = 0;
} else {
irqPrescaler = 0;
X6502_IRQEnd(FCEU_IQEXT);
}
}
}
static void power(void) {
irqEnabled = irqCounter = irqPrescaler = irqMask = 0;
VRC24_power();
SetWriteHandler(0xF000, 0xFFFF, writeIRQ);
}
void Mapper565_Init (CartInfo *info) {
VRC2_init(info, sync, 0x08, 0x04, NULL, NULL, NULL, NULL);
AddExState(stateRegs, ~0, 0, 0);
info->Power = power;
MapIRQHook = cpuCycle;
}

View File

@@ -971,6 +971,7 @@ INES_BOARD_BEGIN()
INES_BOARD( "Venus Turbo Game Doctor", 562, Mapper561_562_Init )
INES_BOARD( "J-2020", 563, Mapper563_Init )
INES_BOARD( "bd23.pcb", 564, Mapper564_Init )
INES_BOARD( "J-33-C", 565, Mapper565_Init )
INES_BOARD( "ET-149", 566, Mapper566_Init )
INES_BOARD( "Top Ten Variety (SF III)", 567, Mapper567_Init )
INES_BOARD( "T-227", 568, Mapper568_Init )

View File

@@ -437,6 +437,7 @@ void Mapper559_Init(CartInfo *);
void Mapper561_562_Init(CartInfo *);
void Mapper563_Init(CartInfo *);
void Mapper564_Init(CartInfo *);
void Mapper565_Init(CartInfo *);
void Mapper566_Init(CartInfo *);
void Mapper567_Init(CartInfo *);
void Mapper568_Init(CartInfo *);