NesHawk - mapper 6 - fix vram and mirroring logic
This commit is contained in:
parent
0efd72c409
commit
0e94191b97
|
@ -5,6 +5,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
public class Mapper006 : NES.NESBoardBase
|
public class Mapper006 : NES.NESBoardBase
|
||||||
{
|
{
|
||||||
private int _reg;
|
private int _reg;
|
||||||
|
private int _mirr;
|
||||||
|
|
||||||
private int IRQa, mirr;
|
private int IRQa, mirr;
|
||||||
private int IRQCount, IRQLatch;
|
private int IRQCount, IRQLatch;
|
||||||
|
|
||||||
|
@ -39,15 +41,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
// Mirroring
|
// Mirroring
|
||||||
if (addr == 0x2FE || addr == 0x2FF)
|
if (addr == 0x2FE || addr == 0x2FF)
|
||||||
{
|
{
|
||||||
int mirr = ((addr << 1) & 2) | ((addr >> 4) & 1);
|
_mirr = ((addr << 1) & 2) | ((addr >> 4) & 1);
|
||||||
SetMirror(mirr);
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
// IRQ
|
// IRQ
|
||||||
else if (addr >= 0x500 && addr <= 0x503)
|
else if (addr >= 0x500 && addr <= 0x503)
|
||||||
{
|
{
|
||||||
switch (addr)
|
switch (addr)
|
||||||
{
|
{
|
||||||
case 0x501:
|
case 0x501:
|
||||||
|
int zzz = 0;
|
||||||
break;
|
break;
|
||||||
case 0x502:
|
case 0x502:
|
||||||
break;
|
break;
|
||||||
|
@ -61,6 +65,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
public override void WritePRG(int addr, byte value)
|
public override void WritePRG(int addr, byte value)
|
||||||
{
|
{
|
||||||
_reg = value;
|
_reg = value;
|
||||||
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override byte ReadPRG(int addr)
|
public override byte ReadPRG(int addr)
|
||||||
|
@ -89,13 +94,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
{
|
{
|
||||||
VRAM[((_reg & 3) * 0x2000) + (addr & 0x1FFF)] = value;
|
VRAM[((_reg & 3) * 0x2000) + (addr & 0x1FFF)] = value;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
base.WritePPU(addr, value);
|
base.WritePPU(addr, value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void SetMirror(int mirr)
|
private void Sync()
|
||||||
{
|
{
|
||||||
switch (mirr)
|
switch (_mirr)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
SetMirrorType(EMirrorType.OneScreenA);
|
SetMirrorType(EMirrorType.OneScreenA);
|
||||||
|
@ -107,7 +114,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
SetMirrorType(EMirrorType.Vertical);
|
SetMirrorType(EMirrorType.Vertical);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
SetMirrorType(EMirrorType.Horizontal);
|
SetMirrorType(EMirrorType.Vertical);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue