supper mapper218 (fixes #447)

This commit is contained in:
zeromus 2022-08-11 23:16:29 -04:00
parent d834ac4e53
commit 32bd9a7f49
4 changed files with 42 additions and 1 deletions

View File

@ -474,6 +474,39 @@ void Mapper203_Init(CartInfo *info) {
Latch_Init(info, M203Sync, 0, 0x8000, 0xFFFF, 0, 0);
}
//------------------ Map 218 ---------------------------
static void Mapper218_Power()
{
//doesn't really matter
SetReadHandler(0x6000, 0xFFFF, &CartBROB);
}
void Mapper218_Init(CartInfo *info)
{
info->Power = &Mapper218_Power;
//fixed PRG mapping
setprg32(0x8000, 0);
//this mapper is supposed to interpret the iNES header bits specially
static const uint8 mirrorings[] = {MI_V,MI_H,MI_0,MI_1};
SetupCartMirroring(mirrorings[info->mirrorAs2Bits],1,nullptr);
//cryptic logic to effect the CHR RAM mappings by mapping 1k blocks to NTARAM according to how the pins are wired
//this could be done by bit logic, but this is self-documenting
static const uint8 mapping[] = {
0,1,0,1,0,1,0,1, //mirrorAs2Bits==0
0,0,1,1,0,0,1,1, //mirrorAs2Bits==1
0,0,0,0,1,1,1,1, //mirrorAs2Bits==2
0,0,0,0,0,0,0,0 //mirrorAs2Bits==3
};
for(int i=0;i<8;i++)
VPageR[i] = &NTARAM[mapping[info->mirrorAs2Bits*8+i]];
PPUCHRRAM = 0xFF;
}
//------------------ Map 240 ---------------------------
static void M240Sync(void) {

View File

@ -15,6 +15,7 @@ typedef struct {
// to help support games like "Karnov"
// that are not really MMC3 but are
// set to mapper 4.
int mirrorAs2Bits;
int battery; // Presence of an actual battery.
int ines2;
int submapper; // Submappers as defined by NES 2.0

View File

@ -54,6 +54,7 @@ iNES_HEADER head;
static CartInfo iNESCart;
uint8 Mirroring = 0;
uint8 MirroringAs2bits = 0;
uint32 ROM_size = 0;
uint32 VROM_size = 0;
char LoadedRomFName[2048]; //mbg merge 7/17/06 added
@ -673,7 +674,7 @@ BMAPPINGLocal bmap[] = {
{"", 215, UNL8237_Init},
{"", 216, Mapper216_Init},
{"", 217, Mapper217_Init}, // Redefined to a new Discrete BMC mapper
// {"", 218, Mapper218_Init},
{"", 218, Mapper218_Init},
{"UNLA9746", 219, UNLA9746_Init},
{"Debug Mapper", 220, QTAi_Init},
{"UNLN625092", 221, UNLN625092_Init},
@ -766,6 +767,9 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
} else
Mirroring = (head.ROM_type & 1);
MirroringAs2bits = head.ROM_type & 1;
if (head.ROM_type & 8) MirroringAs2bits |= 2;
int not_round_size;
if (!iNES2) {
not_round_size = head.ROM_size;
@ -918,6 +922,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
iNESCart.battery = (head.ROM_type & 2) ? 1 : 0;
iNESCart.mirror = Mirroring;
iNESCart.mirrorAs2Bits = MirroringAs2bits;
int result = iNES_Init(MapperNo);
switch(result)

View File

@ -43,6 +43,7 @@ extern uint8 *VROM;
extern uint32 VROM_size;
extern uint32 ROM_size;
extern uint8 *ExtraNTARAM;
extern uint8 **VPageR;
extern int iNesSave(void); //bbit Edited: line added
extern int iNesSaveAs(const char* name);
extern char LoadedRomFName[2048]; //bbit Edited: line added
@ -242,6 +243,7 @@ void Mapper213_Init(CartInfo *);
void Mapper214_Init(CartInfo *);
void Mapper216_Init(CartInfo *);
void Mapper217_Init(CartInfo *);
void Mapper218_Init(CartInfo *);
void Mapper220_Init(CartInfo *);
void Mapper222_Init(CartInfo *);
void Mapper225_Init(CartInfo *);