Mapper 268, submappers 4,5

This commit is contained in:
Alexey 'Cluster' Avdyukhin 2022-12-05 23:22:45 +04:00
parent 92c0417783
commit a70bc4c72c
1 changed files with 23 additions and 3 deletions

View File

@ -94,6 +94,7 @@ static uint8 flash_buffer_v[10];
static uint8 cfi_mode = 0; static uint8 cfi_mode = 0;
static uint8 flag23 = 0; static uint8 flag23 = 0;
static uint8 flag45 = 0;
// Macronix 256-mbit memory CFI data // Macronix 256-mbit memory CFI data
const uint8 cfi_data[] = const uint8 cfi_data[] =
@ -151,15 +152,20 @@ static void COOLBOYCW(uint32 A, uint8 V) {
static void COOLBOYPW(uint32 A, uint8 V) { static void COOLBOYPW(uint32 A, uint8 V) {
uint8 CREGS[] = {EXPREGS[0], EXPREGS[1], EXPREGS[2], EXPREGS[3]}; uint8 CREGS[] = {EXPREGS[0], EXPREGS[1], EXPREGS[2], EXPREGS[3]};
if (flag23) if (flag23) {
CREGS[1] = (CREGS[1] & 0b11100000) | ((CREGS[1] & 0b11100) >> 1) | (((CREGS[1] & 0b10) ^ 0b10) << 3); CREGS[1] = (CREGS[1] & 0b11100000) | ((CREGS[1] & 0b11100) >> 1) | (((CREGS[1] & 0b10) ^ 0b10) << 3);
}
if (flag45) {
CREGS[1] = (CREGS[1] & 0b11101011) | ((CREGS[0] & 0b00100000) >> 3) | (CREGS[0] & 0b00010000);
CREGS[0] &= 0b11001111;
}
uint32 mask = ((0x3F | (CREGS[1] & 0x40) | ((CREGS[1] & 0x20) << 2)) ^ ((CREGS[0] & 0x40) >> 2)) ^ ((CREGS[1] & 0x80) >> 2); uint32 mask = ((0x3F | (CREGS[1] & 0x40) | ((CREGS[1] & 0x20) << 2)) ^ ((CREGS[0] & 0x40) >> 2)) ^ ((CREGS[1] & 0x80) >> 2);
uint32 base = ((CREGS[0] & 0x07) >> 0) | ((CREGS[1] & 0x10) >> 1) | ((CREGS[1] & 0x0C) << 2) | ((CREGS[0] & 0x30) << 2); uint32 base = ((CREGS[0] & 0x07) >> 0) | ((CREGS[1] & 0x10) >> 1) | ((CREGS[1] & 0x0C) << 2) | ((CREGS[0] & 0x30) << 2);
if (cfi_mode) if (flash_save && cfi_mode) {
{
setprg32r(CFI_CHIP, 0x8000, 0); setprg32r(CFI_CHIP, 0x8000, 0);
return;
} }
int chip = !flash_save ? ROM_CHIP : FLASH_CHIP; int chip = !flash_save ? ROM_CHIP : FLASH_CHIP;
@ -355,18 +361,32 @@ void CommonInit(CartInfo* info, int submapper)
case 0: case 0:
info->Power = COOLBOYPower; info->Power = COOLBOYPower;
flag23 = 0; flag23 = 0;
flag45 = 0;
break; break;
case 1: case 1:
info->Power = MINDKIDSPower; info->Power = MINDKIDSPower;
flag23 = 0; flag23 = 0;
flag45 = 0;
break; break;
case 2: case 2:
info->Power = COOLBOYPower; info->Power = COOLBOYPower;
flag23 = 1; flag23 = 1;
flag45 = 0;
break; break;
case 3: case 3:
info->Power = MINDKIDSPower; info->Power = MINDKIDSPower;
flag23 = 1; flag23 = 1;
flag45 = 0;
break;
case 4:
info->Power = COOLBOYPower;
flag23 = 0;
flag45 = 1;
break;
case 5:
info->Power = MINDKIDSPower;
flag23 = 0;
flag45 = 1;
break; break;
default: default:
FCEU_PrintError("Submapper #%d is not supported", submapper); FCEU_PrintError("Submapper #%d is not supported", submapper);