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

51 lines
1.1 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("Jaleco Early Mapper 1", 92)]
internal class Mapper092 : Board
{
private int chr_reg;
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
private int prg_reg;
2024-07-03 18:15:28 +08:00
2024-07-03 18:22:22 +08:00
internal override void HardReset()
{
base.HardReset();
Switch16KPRG(0, PRGArea.Area8000);
chr_reg = (prg_reg = 0);
}
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)
{
switch ((data >> 6) & 3)
{
case 0:
Switch08KCHR(chr_reg);
Switch16KPRG(prg_reg, PRGArea.AreaC000);
break;
case 1:
chr_reg = data & 0xF;
break;
case 2:
prg_reg = data & 0xF;
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(chr_reg);
stream.Write(prg_reg);
}
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);
chr_reg = stream.ReadInt32();
prg_reg = stream.ReadInt32();
}
}
2024-07-03 15:40:13 +08:00
}