nes: mapper 117: some sort of vrc7 clone. fixes "Crayon Shin-Chan" (not that one, the other one)

This commit is contained in:
goyuken 2013-01-09 23:22:40 +00:00
parent 66077951c4
commit a0ea09a226
1 changed files with 59 additions and 0 deletions

View File

@ -52,6 +52,39 @@ namespace BizHawk.Emulation.Consoles.Nintendo
IRQSignal = (irq_pending && irq_enabled);
}
static int RemapM117(int addr)
{
//addr &= 0x7007; // i don't know all of which bits are decoded, but this breaks stuff
switch (addr)
{
//prg
case 0x0000: return 0x0000;
case 0x0001: return 0x0001;
case 0x0002: return 0x1000;
//chr
case 0x2000: return 0x2000;
case 0x2001: return 0x2001;
case 0x2002: return 0x3000;
case 0x2003: return 0x3001;
case 0x2004: return 0x4000;
case 0x2005: return 0x4001;
case 0x2006: return 0x5000;
case 0x2007: return 0x5001;
//irq
// fake addressees to activate different irq handling logic
case 0x4001: return 0x10001;
case 0x4002: return 0x10002;
case 0x4003: return 0x10003;
case 0x6000: return 0x10004;
//mir
case 0x5000: return 0x6000;
//probably nothing at all
default: return 0xffff;
}
}
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
@ -80,6 +113,14 @@ namespace BizHawk.Emulation.Consoles.Nintendo
else
throw new Exception("Unknown PCB type for VRC7");
break;
case "MAPPER117":
// not sure quite what this is
// different address mapping, and somewhat different irq logic
Cart.vram_size = 0;
Cart.wram_size = 0;
remap = RemapM117;
fm = null;
break;
default:
return false;
}
@ -222,6 +263,24 @@ namespace BizHawk.Emulation.Consoles.Nintendo
irq_enabled = irq_autoen;
SyncIRQ();
break;
// special irq logic for M117
// RemapM117() sends some addresses to these "virtual addresses" for irq handling
case 0x10001:
irq_reload = (byte)(237 - value); // what
break;
case 0x10002:
irq_pending = false;
SyncIRQ();
break;
case 0x10003:
irq_counter = irq_reload;
break;
case 0x10004:
irq_enabled = value.Bit(0);
irq_pending = false;
SyncIRQ();
break;
}
}