AxibugEmuOnline/OtherCore/MyNes.Standard2/MyNes.Core/Mapper088.cs

68 lines
1.5 KiB
C#

using System.IO;
namespace MyNes.Core
{
[BoardInfo("Namco 118", 88)]
internal class Mapper088 : Board
{
private int address_8001;
internal override void HardReset()
{
base.HardReset();
Switch16KPRG(PRG_ROM_16KB_Mask, PRGArea.AreaC000);
}
internal override void WritePRG(ref ushort address, ref byte data)
{
switch (address & 0x8001)
{
case 32768:
address_8001 = data & 7;
break;
case 32769:
switch (address_8001)
{
case 0:
Switch02KCHR((data & 0x3F) >> 1, CHRArea.Area0000);
break;
case 1:
Switch02KCHR((data & 0x3F) >> 1, CHRArea.Area0800);
break;
case 2:
Switch01KCHR(data | 0x40, CHRArea.Area1000);
break;
case 3:
Switch01KCHR(data | 0x40, CHRArea.Area1400);
break;
case 4:
Switch01KCHR(data | 0x40, CHRArea.Area1800);
break;
case 5:
Switch01KCHR(data | 0x40, CHRArea.Area1C00);
break;
case 6:
Switch08KPRG(data, PRGArea.Area8000);
break;
case 7:
Switch08KPRG(data, PRGArea.AreaA000);
break;
}
break;
}
}
internal override void WriteStateData(ref BinaryWriter stream)
{
base.WriteStateData(ref stream);
stream.Write(address_8001);
}
internal override void ReadStateData(ref BinaryReader stream)
{
base.ReadStateData(ref stream);
address_8001 = stream.ReadInt32();
}
}
}