Add mapper 404

This commit is contained in:
negativeExponent 2022-02-06 21:35:17 +08:00
parent b7a1c3bbb3
commit 6e9c54f795
3 changed files with 46 additions and 0 deletions

View File

@ -681,3 +681,47 @@ void Mapper550_Init(CartInfo *info) {
AddExState(&latch, 1, 0, "LATC");
AddExState(&outerBank, 1, 0, "BANK");
}
/* ---------------------------- Mapper 404 -------------------------------- */
/* NES 2.0 Mapper 404 - JY012005
* 1998 Super HiK 8-in-1 (JY-021B)*/
static uint8_t outerBank;
static void M404PRG16(uint32 A, uint8 V) {
uint8 mask = outerBank & 0x40 ? 0x07 : 0x0F;
setprg16(A, (V & mask) | (outerBank << 3) & ~mask);
}
static void M404CHR4(uint32 A, uint8 V) {
setchr4(A, (V & 0x1F) | outerBank << 5);
}
static DECLFW(M404Write) {
if (!(outerBank & 0x80)) {
outerBank = V;
MMC1PRG();
MMC1CHR();
}
}
static void M404Reset(void) {
outerBank = 0;
MMC1CMReset();
}
static void M404Power(void) {
outerBank = 0;
GenMMC1Power();
SetWriteHandler(0x6000, 0x7FFF, M404Write);
}
void Mapper404_Init(CartInfo *info) {
GenMMC1Init(info, 256, 256, 0, 0);
info->Power = M404Power;
info->Reset = M404Reset;
MMC1CHRHook4 = M404CHR4;
MMC1PRGHook16 = M404PRG16;
AddExState(&outerBank, 1, 0, "BANK");
}

View File

@ -797,6 +797,7 @@ INES_BOARD_BEGIN()
INES_BOARD( "YY850437C", 396, Mapper396_Init )
INES_BOARD( "YY850439C", 397, Mapper397_Init )
INES_BOARD( "831019C J-2282", 402, J2282_Init )
INES_BOARD( "JY012005", 404, Mapper404_Init )
INES_BOARD( "JY-302", 410, Mapper410_Init )
INES_BOARD( "SC871115C", 421, Mapper421_Init )
INES_BOARD( "AB-G1L/WELL-NO-DG450", 428, Mapper428_Init )

View File

@ -290,6 +290,7 @@ void Mapper396_Init(CartInfo *);
void Mapper397_Init(CartInfo *);
void Mapper401_Init(CartInfo *);
void Mapper403_Init(CartInfo *);
void Mapper404_Init(CartInfo *);
void Mapper410_Init(CartInfo *);
void Mapper411_Init(CartInfo *);
void Mapper421_Init(CartInfo *);