add mapper038: "Crime Busters (Unl).nes" boots but the game requires zapper...

This commit is contained in:
goyuken 2012-10-13 17:20:22 +00:00
parent 402508e4e5
commit e1fa9c0a4a
2 changed files with 77 additions and 0 deletions

View File

@ -152,6 +152,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\Mapper038.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper045.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper057.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper058.cs" />

View File

@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Consoles.Nintendo
{
// Crime Busters (Brazil) (Unl)
public class Mapper038 : NES.NESBoardBase
{
//configuraton
int prg_mask, chr_mask;
//state
int prg, chr;
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "MAPPER038":
case "UNL-PCI556":
break;
default:
return false;
}
AssertPrg(128);
AssertChr(32);
AssertVram(0);
AssertWram(0);
prg_mask = Cart.prg_size / 32 - 1;
chr_mask = Cart.chr_size / 8 - 1;
SetMirrorType(Cart.pad_h, Cart.pad_v);
return true;
}
public override byte ReadPRG(int addr)
{
return ROM[addr + (prg << 15)];
}
public override byte ReadPPU(int addr)
{
if (addr < 0x2000)
{
return VROM[addr + (chr << 13)];
}
else return base.ReadPPU(addr);
}
void writereg(byte value)
{
prg = value & 3 & prg_mask;
chr = (value >> 2) & 3 & chr_mask;
}
// the standard way to access this register is at 7000:7fff, but due to
// hardware design, f000:ffff also works
public override void WritePRG(int addr, byte value)
{
//if ((addr & 0x7000) == 0x7000)
// writereg(value);
}
public override void WriteWRAM(int addr, byte value)
{
if ((addr & 0x1000) == 0x1000)
writereg(value);
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("chr", ref chr);
ser.Sync("prg", ref prg);
}
}
}