2011-02-28 09:13:27 +00:00
|
|
|
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);
|
2011-02-28 09:13:27 +00:00
|
|
|
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);
|
2011-02-28 09:13:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|