nes: axrom: support 512K oversize
This commit is contained in:
parent
c6a5c9b295
commit
aa2fce885e
|
@ -9,8 +9,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
{
|
{
|
||||||
//configuration
|
//configuration
|
||||||
bool bus_conflict;
|
bool bus_conflict;
|
||||||
int vram_byte_mask;
|
int prg_mask_32k;
|
||||||
int prg_mask;
|
|
||||||
|
|
||||||
//state
|
//state
|
||||||
int prg;
|
int prg;
|
||||||
|
@ -58,49 +57,28 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
prg_mask = (Cart.prg_size / 16) - 1;
|
prg_mask_32k = Cart.prg_size / 32 - 1;
|
||||||
vram_byte_mask = 8 * 1024 - 1; //these boards always have 8KB of VRAM
|
SetMirrorType(NES.NESBoardBase.EMirrorType.OneScreenA);
|
||||||
|
|
||||||
//it is necessary to write during initialization to set the mirroring
|
|
||||||
WritePRG(0, 0);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override byte ReadPRG(int addr)
|
public override byte ReadPRG(int addr)
|
||||||
{
|
{
|
||||||
return ROM[addr + (prg << 14)];
|
return ROM[addr | prg << 15];
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void WritePRG(int addr, byte value)
|
public override void WritePRG(int addr, byte value)
|
||||||
{
|
{
|
||||||
if (ROM != null && bus_conflict) value = HandleNormalPRGConflict(addr,value);
|
if (ROM != null && bus_conflict)
|
||||||
int prg_bank = value & 7;
|
value = HandleNormalPRGConflict(addr,value);
|
||||||
prg = (prg_bank * 2) & prg_mask;
|
prg = value & prg_mask_32k;
|
||||||
if ((value & 0x10) == 0)
|
if ((value & 0x10) == 0)
|
||||||
SetMirrorType(NES.NESBoardBase.EMirrorType.OneScreenA);
|
SetMirrorType(NES.NESBoardBase.EMirrorType.OneScreenA);
|
||||||
else
|
else
|
||||||
SetMirrorType(NES.NESBoardBase.EMirrorType.OneScreenB);
|
SetMirrorType(NES.NESBoardBase.EMirrorType.OneScreenB);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override byte ReadPPU(int addr)
|
|
||||||
{
|
|
||||||
if (addr < 0x2000)
|
|
||||||
{
|
|
||||||
return VRAM[addr & vram_byte_mask];
|
|
||||||
}
|
|
||||||
else return base.ReadPPU(addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void WritePPU(int addr, byte value)
|
|
||||||
{
|
|
||||||
if (addr < 0x2000)
|
|
||||||
{
|
|
||||||
VRAM[addr & vram_byte_mask] = value;
|
|
||||||
}
|
|
||||||
else base.WritePPU(addr,value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void SyncState(Serializer ser)
|
public override void SyncState(Serializer ser)
|
||||||
{
|
{
|
||||||
base.SyncState(ser);
|
base.SyncState(ser);
|
||||||
|
|
Loading…
Reference in New Issue