AxibugEmuOnline/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper229.cs

54 lines
1.3 KiB
C#
Raw Normal View History

2024-08-03 22:26:53 +08:00
//////////////////////////////////////////////////////////////////////////
// Mapper229 31-in-1 //
//////////////////////////////////////////////////////////////////////////
using static VirtualNes.MMU;
using BYTE = System.Byte;
2024-08-16 10:20:00 +08:00
2024-08-03 22:26:53 +08:00
namespace VirtualNes.Core
{
public class Mapper229 : Mapper
{
public Mapper229(NES parent) : base(parent)
{
}
2024-08-16 10:20:00 +08:00
public override void Reset()
{
2024-08-03 22:26:53 +08:00
SetPROM_32K_Bank(0);
SetVROM_8K_Bank(0);
}
//void Mapper229::Write(WORD addr, BYTE data)
public override void Write(ushort addr, byte data)
{
if ((addr & 0x001E) != 0)
{
BYTE prg = (byte)(addr & 0x001F);
SetPROM_8K_Bank(4, prg * 2 + 0);
SetPROM_8K_Bank(5, prg * 2 + 1);
SetPROM_8K_Bank(6, prg * 2 + 0);
SetPROM_8K_Bank(7, prg * 2 + 1);
SetVROM_8K_Bank(addr & 0x0FFF);
}
else
{
SetPROM_32K_Bank(0);
SetVROM_8K_Bank(0);
}
if ((addr & 0x0020) != 0)
{
SetVRAM_Mirror(VRAM_HMIRROR);
}
else
{
SetVRAM_Mirror(VRAM_VMIRROR);
}
}
}
}