BizHawk/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/AxROM.cs

89 lines
2.3 KiB
C#
Raw Normal View History

using BizHawk.Common;
2013-11-14 13:15:41 +00:00
namespace BizHawk.Emulation.Cores.Nintendo.NES
2011-02-28 09:39:24 +00:00
{
//generally mapper7
[NES.INESBoardImplPriority]
public sealed class AxROM : NES.NESBoardBase
2011-02-28 09:39:24 +00:00
{
2011-03-01 09:32:12 +00:00
//configuration
2011-02-28 09:39:24 +00:00
bool bus_conflict;
2014-03-19 16:06:51 +00:00
int prg_mask_32k;
2011-03-01 09:32:12 +00:00
//state
2011-02-28 09:39:24 +00:00
int prg;
public override bool Configure(NES.EDetectionOrigin origin)
2011-02-28 09:39:24 +00:00
{
//configure
switch (Cart.board_type)
2011-02-28 09:39:24 +00:00
{
case "MAPPER007":
bus_conflict = false;
Cart.vram_size = 8;
break;
case "NES-ANROM": //marble madness
AssertPrg(128); AssertChr(0); AssertVram(8); AssertWram(0);
bus_conflict = false;
break;
case "NES-AN1ROM": //R.C. Pro-Am
AssertPrg(64); AssertChr(0); AssertVram(8); AssertWram(0);
bus_conflict = false;
break;
case "NES-AMROM": //time lord
2014-01-16 00:22:40 +00:00
case "HVC-AMROM":
2013-10-18 06:11:36 +00:00
//http://forums.nesdev.com/viewtopic.php?p=95438
//adding 723 cycles to FrameAdvance_ppudead() does indeed fix it
AssertPrg(128); AssertChr(0); AssertVram(8); AssertWram(0);
2013-10-18 06:11:36 +00:00
bus_conflict = false;
break;
case "NES-AOROM": //battletoads
case "HVC-AOROM":
AssertPrg(128, 256); AssertChr(0); AssertVram(8); AssertWram(0);
bus_conflict = false; //adelikat: I could not find an example of a game that needs bus conflicts, please enlightening me of a case where a game fails because of the lack of conflicts!
break;
case "ACCLAIM-AOROM": // wizards and warriors 3
AssertPrg(256); AssertChr(0); AssertVram(8); AssertWram(0);
bus_conflict = true; // not enough chips on the pcb to disable bus conflicts?
break;
default:
return false;
2011-02-28 09:39:24 +00:00
}
2014-03-19 16:06:51 +00:00
prg_mask_32k = Cart.prg_size / 32 - 1;
SetMirrorType(NES.NESBoardBase.EMirrorType.OneScreenA);
return true;
2011-02-28 09:39:24 +00:00
}
public override byte ReadPRG(int addr)
{
2014-03-19 16:06:51 +00:00
return ROM[addr | prg << 15];
2011-02-28 09:39:24 +00:00
}
public override void WritePRG(int addr, byte value)
{
2014-03-19 16:06:51 +00:00
if (ROM != null && bus_conflict)
value = HandleNormalPRGConflict(addr,value);
prg = value & prg_mask_32k;
2011-02-28 09:39:24 +00:00
if ((value & 0x10) == 0)
2011-04-18 22:35:40 +00:00
SetMirrorType(NES.NESBoardBase.EMirrorType.OneScreenA);
2011-02-28 09:39:24 +00:00
else
2011-04-18 22:35:40 +00:00
SetMirrorType(NES.NESBoardBase.EMirrorType.OneScreenB);
2011-02-28 09:39:24 +00:00
}
public override void SyncState(Serializer ser)
2011-03-01 09:32:12 +00:00
{
base.SyncState(ser);
ser.Sync("prg",ref prg);
2011-03-01 09:32:12 +00:00
}
2011-02-28 09:39:24 +00:00
}
}