2011-03-08 07:25:35 +00:00
|
|
|
namespace BizHawk.Emulation.Consoles.Nintendo
|
2011-02-28 10:16:07 +00:00
|
|
|
{
|
|
|
|
|
2013-08-25 01:08:17 +00:00
|
|
|
public sealed class CPROM : NES.NESBoardBase
|
2011-02-28 10:16:07 +00:00
|
|
|
{
|
2011-03-01 09:32:12 +00:00
|
|
|
//generally mapper 13
|
|
|
|
|
|
|
|
//state
|
2011-02-28 10:16:07 +00:00
|
|
|
int chr;
|
|
|
|
|
2011-03-20 02:12:10 +00:00
|
|
|
public override bool Configure(NES.EDetectionOrigin origin)
|
2011-02-28 10:16:07 +00:00
|
|
|
{
|
2011-03-07 10:41:46 +00:00
|
|
|
//configure
|
2011-03-08 07:25:35 +00:00
|
|
|
switch (Cart.board_type)
|
2011-03-07 10:41:46 +00:00
|
|
|
{
|
2012-03-22 06:20:10 +00:00
|
|
|
case "MAPPER013":
|
|
|
|
break;
|
|
|
|
|
2011-03-08 07:25:35 +00:00
|
|
|
case "NES-CPROM": //videomation
|
|
|
|
AssertPrg(32); AssertChr(0); AssertVram(16); AssertWram(0);
|
2011-03-07 10:41:46 +00:00
|
|
|
break;
|
2011-03-08 07:25:35 +00:00
|
|
|
|
2011-03-07 10:41:46 +00:00
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-04-18 22:35:40 +00:00
|
|
|
//TODO - assert that mirror type is vertical?
|
|
|
|
//set it in the cart?
|
|
|
|
|
|
|
|
SetMirrorType(NES.NESBoardBase.EMirrorType.Vertical);
|
2011-03-07 10:41:46 +00:00
|
|
|
|
|
|
|
return true;
|
2011-02-28 10:16:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void WritePRG(int addr, byte value)
|
|
|
|
{
|
|
|
|
value = HandleNormalPRGConflict(addr,value);
|
|
|
|
chr = value&3;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override byte ReadPPU(int addr)
|
|
|
|
{
|
|
|
|
if (addr < 0x1000)
|
2011-03-08 07:25:35 +00:00
|
|
|
return VRAM[addr];
|
2011-02-28 10:16:07 +00:00
|
|
|
else if(addr<0x2000)
|
2011-03-08 07:25:35 +00:00
|
|
|
return VRAM[addr - 0x1000 + (chr << 12)];
|
2011-02-28 10:16:07 +00:00
|
|
|
else return base.ReadPPU(addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void WritePPU(int addr, byte value)
|
|
|
|
{
|
|
|
|
if (addr < 0x1000)
|
2011-03-08 07:25:35 +00:00
|
|
|
VRAM[addr] = value;
|
2011-02-28 10:16:07 +00:00
|
|
|
else if (addr < 0x2000)
|
2011-03-08 07:25:35 +00:00
|
|
|
VRAM[addr - 0x1000 + (chr << 12)] = value;
|
2011-02-28 10:16:07 +00:00
|
|
|
else base.WritePPU(addr,value);
|
|
|
|
}
|
2011-03-01 09:32:12 +00:00
|
|
|
|
2011-04-17 22:51:53 +00:00
|
|
|
public override void SyncState(Serializer ser)
|
2011-03-01 09:32:12 +00:00
|
|
|
{
|
2011-04-17 22:51:53 +00:00
|
|
|
base.SyncState(ser);
|
|
|
|
ser.Sync("chr",ref chr);
|
2011-03-01 09:32:12 +00:00
|
|
|
}
|
|
|
|
|
2011-03-21 06:03:58 +00:00
|
|
|
|
2011-02-28 10:16:07 +00:00
|
|
|
}
|
|
|
|
}
|