NES - add mappers 200 & 231, PRG mapping isn't quite right on either but some games work

This commit is contained in:
adelikat 2012-07-17 04:06:48 +00:00
parent ee5db4cc06
commit bbf5be7d74
3 changed files with 208 additions and 0 deletions

View File

@ -156,8 +156,10 @@
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper178.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper180.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper193.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper200.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper207.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper227.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper231.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper240.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper241.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper242.cs" />

View File

@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Consoles.Nintendo
{
class Mapper200 : NES.NESBoardBase
{
/*
Here are Disch's original notes:
========================
= Mapper 200 =
========================
Example Games:
--------------------------
1200-in-1
36-in-1
Registers:
---------------------------
$8000-FFFF: A~[.... .... .... MRRR]
M = Mirroring (0=Vert, 1=Horz)
R = PRG/CHR Reg
CHR Setup:
---------------------------
$0000 $0400 $0800 $0C00 $1000 $1400 $1800 $1C00
+---------------------------------------------------------------+
| $8000 |
+---------------------------------------------------------------+
PRG Setup:
---------------------------
$8000 $A000 $C000 $E000
+---------------+---------------+
| $8000 | $8000 |
+---------------+---------------+
*/
int reg;
int prg_bank_mask_16k;
bool low;
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "MAPPER200":
case "MAPPER229":
break;
default:
return false;
}
prg_bank_mask_16k = Cart.prg_size / 16 - 1;
return true;
}
public override void SyncState(Serializer ser)
{
ser.Sync("reg", ref reg);
base.SyncState(ser);
}
public override void WritePRG(int addr, byte value)
{
if (addr.Bit(3))
{
SetMirrorType(EMirrorType.Horizontal);
}
else
{
SetMirrorType(EMirrorType.Vertical);
}
reg = addr & 0x07;
low = addr.Bit(0);
}
public override byte ReadPRG(int addr)
{
if (addr < 0x4000)
{
return ROM[(reg * 0x4000) + addr];
}
else
{
int bank = reg >> 1;
return ROM[(bank * 0x4000) + addr];
}
}
public override byte ReadPPU(int addr)
{
if (addr < 0x2000)
{
return VROM[(reg * 0x2000) + addr];
}
return base.ReadPPU(addr);
}
}
}

View File

@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Consoles.Nintendo
{
class Mapper231 : NES.NESBoardBase
{
/*
* Here are Disch's original notes:
========================
= Mapper 231 =
========================
Example Game:
--------------------------
20-in-1
Registers:
---------------------------
$8000-FFFF: A~[.... .... M.LP PPP.]
M = Mirroring (0=Vert, 1=Horz)
L = Low bit of PRG
P = High bits of PRG
PRG Setup:
---------------------------
Note that 'L' and 'P' bits make up the PRG reg, and the 'L' is the low bit.
$8000 $A000 $C000 $E000
+---------------+---------------+
| $8000 AND $1E | $8000 |
+---------------+---------------+
*/
public int reg;
public bool low;
public int prg_bank_mask_16k;
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "MAPPER231":
break;
default:
return false;
}
prg_bank_mask_16k = Cart.prg_size / 16 - 1;
return true;
}
public override void SyncState(Serializer ser)
{
ser.Sync("reg", ref reg);
ser.Sync("low", ref low);
base.SyncState(ser);
}
public override void WritePRG(int addr, byte value)
{
if (addr.Bit(7))
{
SetMirrorType(EMirrorType.Horizontal);
}
else
{
SetMirrorType(EMirrorType.Vertical);
}
low = addr.Bit(5);
reg = addr & 0x1E;
}
public override byte ReadPRG(int addr)
{
if (low)
{
int bank = ((reg >> 1) & 0x0F) & (prg_bank_mask_16k >> 1);
return ROM[(bank * 0x8000) + addr];
}
else
{
return ROM[((reg & prg_bank_mask_16k) * 0x4000) + addr];
}
}
}
}