AxibugEmuOnline/AxibugEmuOnline.Client/Assets/MyNes.Core/Mapper233.cs

69 lines
1.5 KiB
C#
Raw Normal View History

2024-07-03 18:15:28 +08:00
using System.IO;
2024-07-03 18:22:22 +08:00
namespace MyNes.Core
2024-07-03 18:15:28 +08:00
{
2024-07-03 18:22:22 +08:00
[BoardInfo("Unknown", 233)]
internal class Mapper233 : Board
{
private int title;
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
private int bank;
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
internal override void HardReset()
{
base.HardReset();
bank = (title = 0);
}
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
internal override void SoftReset()
{
base.SoftReset();
bank = 0;
title ^= 32;
}
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
internal override void WritePRG(ref ushort address, ref byte data)
{
bank = data & 0x1F;
if ((data & 0x20) == 32)
{
Switch16KPRG(title | bank, PRGArea.Area8000);
Switch16KPRG(title | bank, PRGArea.AreaC000);
}
else
{
Switch32KPRG((title >> 1) | (bank >> 1), PRGArea.Area8000);
}
switch ((data >> 6) & 3)
{
case 0:
Switch01KNMT(128);
break;
case 1:
Switch01KNMTFromMirroring(Mirroring.Vert);
break;
case 2:
Switch01KNMTFromMirroring(Mirroring.Horz);
break;
case 3:
Switch01KNMTFromMirroring(Mirroring.OneScB);
break;
}
}
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
internal override void WriteStateData(ref BinaryWriter stream)
{
base.WriteStateData(ref stream);
stream.Write(title);
stream.Write(bank);
}
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
internal override void ReadStateData(ref BinaryReader stream)
{
base.ReadStateData(ref stream);
title = stream.ReadInt32();
bank = stream.ReadInt32();
}
}
2024-07-03 15:40:13 +08:00
}