neshawk: add mapper 29. some sort of homebrew? nothing to test it on

This commit is contained in:
goyuken 2014-01-15 18:28:21 +00:00
parent 1ad4d0ee2a
commit 69a4d2d327
2 changed files with 62 additions and 0 deletions

View File

@ -262,6 +262,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\JALECO_JF_19.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\JALECO_SS8806.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper015.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper029.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper036.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper038.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper040.cs" />

View File

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
// what is this?
public class Mapper029 : NES.NESBoardBase
{
int prg;
int chr;
int prg_bank_mask_16k;
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "Mapper029":
case "UNIF_JERKFACE":
case "UNIF_RET-CUFROM":
break;
default:
return false;
}
SetMirrorType(EMirrorType.Vertical);
AssertChr(0);
AssertPrg(32, 64, 128, 256, 512, 1024);
Cart.wram_size = 8;
Cart.vram_size = 32;
prg_bank_mask_16k = Cart.prg_size / 16 - 1;
return true;
}
public override void WritePRG(int addr, byte value)
{
chr = value & 3;
prg = (value >> 2) & prg_bank_mask_16k;
}
public override byte ReadPRG(int addr)
{
int bank = addr >= 0x4000 ? prg_bank_mask_16k : prg;
return ROM[bank << 14 | addr & 0x3fff];
}
public override byte ReadPPU(int addr)
{
if (addr < 0x2000)
return VRAM[addr | chr << 13];
else
return base.ReadPPU(addr);
}
public override void WritePPU(int addr, byte value)
{
if (addr < 0x2000)
VRAM[addr | chr << 13] = value;
else
base.WritePPU(addr, value);
}
}
}