Add mapper 544.
This commit is contained in:
committed by
LibretroAdmin
parent
f6385585a6
commit
789a26549c
111
src/boards/544.c
Normal file
111
src/boards/544.c
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
/* 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 "vrc2and4.h"
|
||||||
|
|
||||||
|
static uint8 *CHRRAM;
|
||||||
|
static uint32 CHRRAMSize;
|
||||||
|
static uint8 nt[4];
|
||||||
|
static uint8 prg;
|
||||||
|
static uint8 mask;
|
||||||
|
static uint8 compare;
|
||||||
|
|
||||||
|
extern uint32 RefreshAddr;
|
||||||
|
writefunc writePPU;
|
||||||
|
|
||||||
|
static SFORMAT stateRegs[] ={
|
||||||
|
{ nt, 4, "EXPN" },
|
||||||
|
{ &prg, 1, "PRGC" },
|
||||||
|
{ &mask, 1, "CHRM" },
|
||||||
|
{ &compare, 1, "CHRC" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void sync () {
|
||||||
|
int bank;
|
||||||
|
VRC24_syncWRAM(0);
|
||||||
|
VRC24_syncPRG(0x01F, 0x000);
|
||||||
|
for (bank =0; bank <8; bank++) setchr1r((VRC24_chr[bank] &mask) ==compare? 0x10: 0x00, bank <<10, VRC24_chr[bank]);
|
||||||
|
setmirrorw(nt[0] &1, nt[1] &1, nt[2] &1, nt[3] &1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const uint8 compares[8] = { 0x28, 0x00, 0x4C, 0x64, 0x46, 0x7C, 0x04, 0xFF };
|
||||||
|
static DECLFW(Mapper544_interceptPPUWrite) {
|
||||||
|
if (~RefreshAddr &0x2000) {
|
||||||
|
int bank =VRC24_chr[RefreshAddr >>10 &7];
|
||||||
|
if (bank &0x80) {
|
||||||
|
if (bank &0x10) {
|
||||||
|
mask =0x00;
|
||||||
|
compare =0xFF;
|
||||||
|
} else {
|
||||||
|
int index =(bank &0x02? 1: 0) | (bank &0x08? 2: 0) | (bank &0x40? 4: 0);
|
||||||
|
mask =bank &0x40? 0xFE: 0xFC;
|
||||||
|
compare =compares[index];
|
||||||
|
}
|
||||||
|
VRC24_Sync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writePPU(A, V);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Mapper544_getPRGBank(int bank) {
|
||||||
|
return bank ==2? prg: VRC24_getPRGBank(bank);
|
||||||
|
}
|
||||||
|
|
||||||
|
DECLFW(Mapper544_externalSelect) {
|
||||||
|
if (A &4)
|
||||||
|
nt[A &3] =V;
|
||||||
|
else
|
||||||
|
prg =V;
|
||||||
|
VRC24_Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Mapper544_power (void) {
|
||||||
|
mask =0xFC;
|
||||||
|
compare =0x28;
|
||||||
|
nt[0] =nt[1] =0xE0;
|
||||||
|
nt[2] =nt[3] =0xE1;
|
||||||
|
prg =0xFE;
|
||||||
|
VRC24_power();
|
||||||
|
writePPU =GetWriteHandler(0x2007);
|
||||||
|
SetWriteHandler(0x2007, 0x2007, Mapper544_interceptPPUWrite);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper544_close(void) {
|
||||||
|
if (CHRRAM) {
|
||||||
|
FCEU_gfree(CHRRAM);
|
||||||
|
CHRRAM =NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper544_Init (CartInfo *info) {
|
||||||
|
VRC24_init(info, sync, 0x400, 0x800, 1, 1, 0);
|
||||||
|
info->Power =Mapper544_power;
|
||||||
|
info->Close =Mapper544_close;
|
||||||
|
VRC24_GetPRGBank =Mapper544_getPRGBank;
|
||||||
|
VRC24_ExternalSelect =Mapper544_externalSelect;
|
||||||
|
AddExState(stateRegs, ~0, 0, 0);
|
||||||
|
|
||||||
|
CHRRAMSize =info->CHRRamSize +info->CHRRamSaveSize;
|
||||||
|
CHRRAM =(uint8*)FCEU_gmalloc(CHRRAMSize);
|
||||||
|
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
|
||||||
|
}
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "mapinc.h"
|
#include "mapinc.h"
|
||||||
#include "vrc2and4.h"
|
#include "vrc2and4.h"
|
||||||
|
|
||||||
uint8 VRC24_A0, VRC24_A1; /* What cartridge connector address pins are connected to the chip's A0 and A1 input pins? */
|
int VRC24_A0, VRC24_A1; /* What cartridge connector address pins are connected to the chip's A0 and A1 input pins? */
|
||||||
uint8 VRC24_isVRC4; /* VRC2 or VRC4? VRC2 has no single-screen mirroring, no PRG A14 swap and no IRQ counter */
|
uint8 VRC24_isVRC4; /* VRC2 or VRC4? VRC2 has no single-screen mirroring, no PRG A14 swap and no IRQ counter */
|
||||||
uint8 VRC24_useRepeatBit; /* VRC4 clones ignore the "repeat" bit in the IRQ Mode register */
|
uint8 VRC24_useRepeatBit; /* VRC4 clones ignore the "repeat" bit in the IRQ Mode register */
|
||||||
uint8 VRC24_prg[2];
|
uint8 VRC24_prg[2];
|
||||||
@@ -207,7 +207,7 @@ void VRC24_close(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VRC24_init(CartInfo *info, void (*_sync)(), uint8 _A0, uint8 _A1, uint8 _isVRC4, uint8 _useRepeatBit, uint8 defaultWRAMSizeKiB) {
|
void VRC24_init(CartInfo *info, void (*_sync)(), int _A0, int _A1, uint8 _isVRC4, uint8 _useRepeatBit, uint8 defaultWRAMSizeKiB) {
|
||||||
VRC24_Sync =_sync;
|
VRC24_Sync =_sync;
|
||||||
VRC24_A0 =_A0;
|
VRC24_A0 =_A0;
|
||||||
VRC24_A1 =_A1;
|
VRC24_A1 =_A1;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef _VRC2AND4_H
|
#ifndef _VRC2AND4_H
|
||||||
#define _VRC2AND4_H
|
#define _VRC2AND4_H
|
||||||
|
|
||||||
extern uint8 VRC24_A0, VRC24_A1;
|
extern int VRC24_A0, VRC24_A1;
|
||||||
extern uint8 VRC24_isVRC4;
|
extern uint8 VRC24_isVRC4;
|
||||||
extern uint8 VRC24_useRepeatBit;
|
extern uint8 VRC24_useRepeatBit;
|
||||||
extern uint8 VRC24_prg[2];
|
extern uint8 VRC24_prg[2];
|
||||||
@@ -31,6 +31,6 @@ DECLFW(VRC24_writeReg);
|
|||||||
|
|
||||||
void VRC24_power(void);
|
void VRC24_power(void);
|
||||||
void VRC24_close(void);
|
void VRC24_close(void);
|
||||||
void VRC24_init(CartInfo *info, void (*_sync)(), uint8 _A0, uint8 _A1, uint8 _isVRC4, uint8 _useRepeatBit, uint8 defaultWRAMSizeKiB);
|
void VRC24_init(CartInfo *info, void (*_sync)(), int _A0, int _A1, uint8 _isVRC4, uint8 _useRepeatBit, uint8 defaultWRAMSizeKiB);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -887,6 +887,7 @@ INES_BOARD_BEGIN()
|
|||||||
INES_BOARD( "LittleCom 160-in-1", 541, Mapper541_Init )
|
INES_BOARD( "LittleCom 160-in-1", 541, Mapper541_Init )
|
||||||
INES_BOARD( "JYV610 830626C", 542, Mapper542_Init )
|
INES_BOARD( "JYV610 830626C", 542, Mapper542_Init )
|
||||||
INES_BOARD( "5-in-1 (CH-501)", 543, Mapper543_Init )
|
INES_BOARD( "5-in-1 (CH-501)", 543, Mapper543_Init )
|
||||||
|
INES_BOARD( "WAIXING FS306", 544, Mapper544_Init )
|
||||||
INES_BOARD( "", 551, Mapper178_Init )
|
INES_BOARD( "", 551, Mapper178_Init )
|
||||||
INES_BOARD( "SACHEN 3013", 553, Mapper553_Init )
|
INES_BOARD( "SACHEN 3013", 553, Mapper553_Init )
|
||||||
INES_BOARD( "KS-7010", 554, Mapper554_Init )
|
INES_BOARD( "KS-7010", 554, Mapper554_Init )
|
||||||
|
|||||||
@@ -386,6 +386,7 @@ void Mapper540_Init(CartInfo *);
|
|||||||
void Mapper541_Init(CartInfo *);
|
void Mapper541_Init(CartInfo *);
|
||||||
void Mapper542_Init(CartInfo *);
|
void Mapper542_Init(CartInfo *);
|
||||||
void Mapper543_Init(CartInfo *);
|
void Mapper543_Init(CartInfo *);
|
||||||
|
void Mapper544_Init(CartInfo *);
|
||||||
void Mapper550_Init(CartInfo *);
|
void Mapper550_Init(CartInfo *);
|
||||||
void Mapper553_Init(CartInfo *);
|
void Mapper553_Init(CartInfo *);
|
||||||
void Mapper554_Init(CartInfo *);
|
void Mapper554_Init(CartInfo *);
|
||||||
|
|||||||
Reference in New Issue
Block a user