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

62 lines
1.3 KiB
C#
Raw Normal View History

using BizHawk.Common;
using BizHawk.Common.NumberExtensions;
2013-11-14 13:15:41 +00:00
namespace BizHawk.Emulation.Cores.Nintendo.NES
2011-04-18 02:26:42 +00:00
{
2012-04-05 18:55:34 +00:00
/*
2011-04-18 02:26:42 +00:00
PCB Class: Unknown
iNES Mapper 242
2011-04-18 02:26:42 +00:00
PRG-ROM: 32KB
PRG-RAM: None
CHR-ROM: 16KB
CHR-RAM: None
Battery is not available
mirroring - both
2012-04-05 18:55:34 +00:00
*
* Games:
* Wai Xing Zhan Shi (Ch)
*/
public sealed class Mapper242 : NES.NESBoardBase
2012-04-05 18:55:34 +00:00
{
int prg;
2011-04-18 02:26:42 +00:00
2012-04-05 18:55:34 +00:00
public override bool Configure(NES.EDetectionOrigin origin)
{
//configure
2011-04-18 02:26:42 +00:00
switch (Cart.board_type)
{
case "MAPPER242":
2011-04-18 02:26:42 +00:00
break;
default:
return false;
}
2012-04-05 18:55:34 +00:00
SetMirrorType(NES.NESBoardBase.EMirrorType.Vertical);
return true;
}
2011-04-18 02:26:42 +00:00
2012-04-05 18:55:34 +00:00
public override byte ReadPRG(int addr)
{
return ROM[addr + (prg * 0x8000)];
}
2011-04-18 02:26:42 +00:00
2012-04-05 18:55:34 +00:00
public override void WritePRG(int addr, byte value)
{
2011-04-18 23:01:29 +00:00
prg = (addr >> 3) & 15;
2012-04-05 18:55:34 +00:00
//fceux had different logic here for the mirroring, but that didnt match with experiments on dragon quest 8 nor disch's docs
//i changed it at the same time
bool mirror = addr.Bit(1);
if (mirror)
SetMirrorType(NES.NESBoardBase.EMirrorType.Horizontal);
else
SetMirrorType(NES.NESBoardBase.EMirrorType.Vertical);
}
2011-04-18 02:26:42 +00:00
public override void SyncState(Serializer ser)
2012-04-05 18:55:34 +00:00
{
2011-04-18 02:26:42 +00:00
base.SyncState(ser);
2012-04-05 18:55:34 +00:00
ser.Sync("prg", ref prg);
}
}
2011-04-18 02:26:42 +00:00
}