nes-add mapper 227

This commit is contained in:
zeromus 2012-04-09 18:13:58 +00:00
parent a78a0fc5db
commit a561f8b7e7
6 changed files with 131 additions and 1 deletions

View File

@ -140,6 +140,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper164.cs" /> <Compile Include="Consoles\Nintendo\NES\Boards\Mapper164.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper180.cs" /> <Compile Include="Consoles\Nintendo\NES\Boards\Mapper180.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper193.cs" /> <Compile Include="Consoles\Nintendo\NES\Boards\Mapper193.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper227.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper240.cs" /> <Compile Include="Consoles\Nintendo\NES\Boards\Mapper240.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper242.cs" /> <Compile Include="Consoles\Nintendo\NES\Boards\Mapper242.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper078.cs" /> <Compile Include="Consoles\Nintendo\NES\Boards\Mapper078.cs" />

View File

@ -113,7 +113,7 @@ Open bus and bus conflict emulation is not considered complete or thorough in an
210 Namcot Decent {{See 019}} 210 Namcot Decent {{See 019}}
225 Multicart Junk 225 Multicart Junk
226 Multicart Junk 226 Multicart Junk
227 Multicart Junk 227 Multicart Decebt
228 Unlicensed Nothing 228 Unlicensed Nothing
230 Multicart Junk 230 Multicart Junk
231 Multicart Junk 231 Multicart Junk

View File

@ -0,0 +1,121 @@
using System;
using System.IO;
using System.Diagnostics;
namespace BizHawk.Emulation.Consoles.Nintendo
{
class Mapper227 : NES.NESBoardBase
{
//configuration
int prg_bank_mask_16k;
//state
int prg;
bool vram_protected;
ByteBuffer prg_banks_16k = new ByteBuffer(2);
//1200-in-1
//[NJXXX] Xiang Shuai Chuan Qi
public override bool Configure(NES.EDetectionOrigin origin)
{
//configure
switch (Cart.board_type)
{
case "MAPPER227":
//AssertVram(16);
Cart.vram_size = 16;
break;
default:
return false;
}
prg_bank_mask_16k = (Cart.prg_size / 16) - 1;
SetMirrorType(EMirrorType.Vertical);
vram_protected = false;
prg_banks_16k[0] = prg_banks_16k[1] = 0;
return true;
}
public override byte ReadPRG(int addr)
{
int bank_16k = addr >> 14;
int ofs = addr & ((1 << 14) - 1);
bank_16k = prg_banks_16k[bank_16k];
bank_16k &= prg_bank_mask_16k;
addr = (bank_16k << 14) | ofs;
return ROM[addr];
}
public override void WritePRG(int addr, byte value)
{
bool S = addr.Bit(0);
bool M_horz = addr.Bit(1);
int p = (addr >> 2) & 0x1F;
p += addr.Bit(8) ? 0x20 : 0;
bool o = addr.Bit(7);
bool L = addr.Bit(9);
//virtuaNES doesnt do this.
//fceux does it...
//if we do it, [NJXXX] Xiang Shuai Chuan Qi will not be able to set any patterns
//maybe only the multicarts do it, to keep the game from clobbering vram on accident
//vram_protected = o;
if (o == true && S == false)
{
prg_banks_16k[0] = (byte)(p);
prg_banks_16k[1] = (byte)(p);
}
if (o == true && S == true)
{
prg_banks_16k[0] = (byte)((p & ~1));
prg_banks_16k[1] = (byte)((p & ~1) + 1);
}
if (o == false && S == false && L == false)
{
prg_banks_16k[0] = (byte)p;
prg_banks_16k[1] = (byte)(p & 0x38);
}
if (o == false && S == true && L == false)
{
prg_banks_16k[0] = (byte)(p & 0x3E);
prg_banks_16k[1] = (byte)(p & 0x38);
}
if (o == false && S == false && L == true)
{
prg_banks_16k[0] = (byte)p;
prg_banks_16k[1] = (byte)(p | 0x07);
}
if (o == false && S == true && L == true)
{
prg_banks_16k[0] = (byte)(p & 0x3E);
prg_banks_16k[1] = (byte)(p | 0x07);
}
prg_banks_16k[0] = (byte)(prg_banks_16k[0]&prg_bank_mask_16k);
prg_banks_16k[1] = (byte)(prg_banks_16k[1]&prg_bank_mask_16k);
if (M_horz) SetMirrorType(EMirrorType.Horizontal);
else SetMirrorType(EMirrorType.Vertical);
}
public override void WritePPU(int addr, byte value)
{
if (addr < 0x2000)
{
if (vram_protected)
return;
else base.WritePPU(addr, value);
}
else base.WritePPU(addr, value);
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("prg", ref prg);
}
}
}

View File

@ -114,6 +114,7 @@ static string ClassifyTable = @"
191 -1 -1 -1 -1 MAPPER191 191 -1 -1 -1 -1 MAPPER191
193 -1 -1 -1 -1 MAPPER193 193 -1 -1 -1 -1 MAPPER193
210 -1 -1 -1 -1 MAPPER210 210 -1 -1 -1 -1 MAPPER210
227 -1 -1 -1 -1 MAPPER227
232 -1 -1 -1 -1 MAPPER232 232 -1 -1 -1 -1 MAPPER232
240 -1 -1 -1 -1 MAPPER240 240 -1 -1 -1 -1 MAPPER240
242 -1 -1 -1 -1 MAPPER242 242 -1 -1 -1 -1 MAPPER242

View File

@ -82,6 +82,7 @@ namespace BizHawk
case "I": Game.Status = RomStatus.BIOS; break; case "I": Game.Status = RomStatus.BIOS; break;
case "D": Game.Status = RomStatus.Homebrew; break; case "D": Game.Status = RomStatus.Homebrew; break;
case "H": Game.Status = RomStatus.Hack; break; case "H": Game.Status = RomStatus.Hack; break;
case "U": Game.Status = RomStatus.Unknown; break;
default: Game.Status = RomStatus.GoodDump; break; default: Game.Status = RomStatus.GoodDump; break;
} }
Game.Name = items[2]; Game.Name = items[2];

View File

@ -10,6 +10,7 @@ namespace BizHawk
Homebrew, Homebrew,
TranslatedRom, TranslatedRom,
Hack, Hack,
Unknown,
BIOS, BIOS,
Overdump, Overdump,
NotInDatabase NotInDatabase
@ -17,6 +18,11 @@ namespace BizHawk
public class GameInfo public class GameInfo
{ {
public bool IsRomStatusBad()
{
return Status == RomStatus.BadDump || Status == RomStatus.Overdump;
}
public string Name; public string Name;
public string System; public string System;
public string Hash; public string Hash;