BizHawk/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/CxROM.cs

44 lines
941 B
C#
Raw Normal View History

using System;
using System.Diagnostics;
namespace BizHawk.Emulation.Consoles.Nintendo.Boards
{
//generally mapper3
public class CxROM : NES.NESBoardBase
{
string type;
public CxROM(string type)
{
this.type = type;
}
public override void Initialize(NES.RomInfo romInfo, NES nes)
{
base.Initialize(romInfo, nes);
Debug.Assert(Util.IsPowerOfTwo(RomInfo.CHR_Size));
chr_mask = RomInfo.CHR_Size - 1;
bus_conflict = true;
}
public override void WritePRG(int addr, byte value)
{
2011-02-28 10:48:18 +00:00
if (bus_conflict) value = HandleNormalPRGConflict(addr,value);
chr = value&chr_mask;
2011-02-28 10:16:07 +00:00
//Console.WriteLine("at {0}, set chr={1}", NES.ppu.ppur.status.sl, chr);
}
public override byte ReadPPU(int addr)
{
if (addr < 0x2000)
{
return RomInfo.VROM[addr + (chr<<13)];
}
else return base.ReadPPU(addr);
}
int chr;
int chr_mask;
bool bus_conflict;
}
}