Mapper 30: Add submappers.
This commit is contained in:
@@ -43,6 +43,7 @@
|
|||||||
static uint8 fceumm_flash_buf[flashdata_size + flash_write_count_size];
|
static uint8 fceumm_flash_buf[flashdata_size + flash_write_count_size];
|
||||||
static uint32 fceumm_flash_buf_size = sizeof(fceumm_flash_buf);
|
static uint32 fceumm_flash_buf_size = sizeof(fceumm_flash_buf);
|
||||||
|
|
||||||
|
static uint8 submapper;
|
||||||
static uint8 latche, latcheinit, bus_conflict, chrram_mask, software_id=0;
|
static uint8 latche, latcheinit, bus_conflict, chrram_mask, software_id=0;
|
||||||
static uint16 latcha;
|
static uint16 latcha;
|
||||||
static uint8 *flashdata = fceumm_flash_buf + flash_write_count_size;
|
static uint8 *flashdata = fceumm_flash_buf + flash_write_count_size;
|
||||||
@@ -135,11 +136,11 @@ static void UNROM512LatchPower(void) {
|
|||||||
latche = latcheinit;
|
latche = latcheinit;
|
||||||
WHSync();
|
WHSync();
|
||||||
SetReadHandler(0x8000, 0xFFFF, UNROM512LatchRead);
|
SetReadHandler(0x8000, 0xFFFF, UNROM512LatchRead);
|
||||||
if (!flash_save)
|
if (submapper == 0 && !flash_save || submapper == 2)
|
||||||
SetWriteHandler(0x8000, 0xFFFF, UNROM512HLatchWrite);
|
SetWriteHandler(0x8000, 0xFFFF, UNROM512HLatchWrite);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetWriteHandler(0x8000, 0xBFFF, UNROM512LLatchWrite);
|
if (submapper != 4) SetWriteHandler(0x8000, 0xBFFF, UNROM512LLatchWrite);
|
||||||
SetWriteHandler(0xC000, 0xFFFF, UNROM512HLatchWrite);
|
SetWriteHandler(0xC000, 0xFFFF, UNROM512HLatchWrite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,12 +206,15 @@ static void UNROM512HSync(void) {
|
|||||||
setfprg16(0x8000, flash_bank);
|
setfprg16(0x8000, flash_bank);
|
||||||
setfprg16(0xC000, ~0);
|
setfprg16(0xC000, ~0);
|
||||||
setchr8r(0, (latche & chrram_mask) >> 5);
|
setchr8r(0, (latche & chrram_mask) >> 5);
|
||||||
|
if (submapper == 3)
|
||||||
|
setmirror(latche &0x80? MI_V: MI_H);
|
||||||
|
else
|
||||||
setmirror(MI_0 + (latche >> 7));
|
setmirror(MI_0 + (latche >> 7));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UNROM512_Init(CartInfo *info) {
|
void UNROM512_Init(CartInfo *info) {
|
||||||
int mirror;
|
int mirror;
|
||||||
|
submapper = info->submapper;
|
||||||
memset(fceumm_flash_buf, 0x00, fceumm_flash_buf_size);
|
memset(fceumm_flash_buf, 0x00, fceumm_flash_buf_size);
|
||||||
flash_state = 0;
|
flash_state = 0;
|
||||||
flash_bank = 0;
|
flash_bank = 0;
|
||||||
@@ -224,6 +228,9 @@ void UNROM512_Init(CartInfo *info) {
|
|||||||
chrram_mask = 0x60;
|
chrram_mask = 0x60;
|
||||||
|
|
||||||
mirror = (head.ROM_type & 1) | ((head.ROM_type & 8) >> 2);
|
mirror = (head.ROM_type & 1) | ((head.ROM_type & 8) >> 2);
|
||||||
|
if (submapper == 3) /* Mega Man II (30th Anniversary Edition): switchable H/V */
|
||||||
|
SetupCartMirroring(MI_V, 0, NULL);
|
||||||
|
else
|
||||||
switch (mirror) {
|
switch (mirror) {
|
||||||
case 0: /* hard horizontal, internal */
|
case 0: /* hard horizontal, internal */
|
||||||
SetupCartMirroring(MI_H, 1, NULL);
|
SetupCartMirroring(MI_H, 1, NULL);
|
||||||
@@ -238,7 +245,7 @@ void UNROM512_Init(CartInfo *info) {
|
|||||||
SetupCartMirroring(4, 1, VROM + (info->CHRRamSize - 8192));
|
SetupCartMirroring(4, 1, VROM + (info->CHRRamSize - 8192));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bus_conflict = !info->battery;
|
bus_conflict = submapper == 0 && !info->battery || submapper == 2;
|
||||||
latcheinit = 0;
|
latcheinit = 0;
|
||||||
WLSync = UNROM512LSync;
|
WLSync = UNROM512LSync;
|
||||||
WHSync = UNROM512HSync;
|
WHSync = UNROM512HSync;
|
||||||
|
|||||||
Reference in New Issue
Block a user