nes-support m015

This commit is contained in:
zeromus 2012-06-19 21:23:24 +00:00
parent 11de294bf5
commit 6156188676
5 changed files with 97 additions and 3 deletions

View File

@ -144,6 +144,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\JALECO_JF_13.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\JALECO_JF_17.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\JALECO_JF_19.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper015.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper069.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper107.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper164.cs" />

View File

@ -25,7 +25,7 @@ Open bus and bus conflict emulation is not considered complete or thorough in an
011 Misc Complete
012 DBZ5 Decent (mmc3 variant)
013 CPROM Complete
015 Multicart Junk
015 Multicart Decent (some things uncertain)
016 Bandai Decent
018 Jaleco* Nothing
019 Namcot106 Decent (but no sound) (+210)

View File

@ -145,7 +145,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
{
byte old_value = value;
value &= ReadPRG(addr);
Debug.Assert(old_value == value, "Found a test case of bus conflict. please report.");
//Debug.Assert(old_value == value, "Found a test case of bus conflict. please report.");
//report: pinball quest (J)
return value;
}

View File

@ -0,0 +1,90 @@
using System;
using System.IO;
using System.Diagnostics;
namespace BizHawk.Emulation.Consoles.Nintendo
{
class Mapper015 : NES.NESBoardBase
{
//configuration
int prg_bank_mask_8k;
//state
ByteBuffer prg_banks_8k = new ByteBuffer(4);
public override bool Configure(NES.EDetectionOrigin origin)
{
//configure
switch (Cart.board_type)
{
case "MAPPER015":
break;
default:
return false;
}
prg_bank_mask_8k = (Cart.prg_size / 16) - 1;
prg_banks_8k[0] = 0;
prg_banks_8k[1] = 1;
prg_banks_8k[2] = 2;
prg_banks_8k[3] = 3;
ApplyMemoryMapMask(prg_bank_mask_8k, prg_banks_8k);
return true;
}
public override byte ReadPRG(int addr)
{
addr = ApplyMemoryMap(13, prg_banks_8k, addr);
return ROM[addr];
}
public override void WritePRG(int addr, byte value)
{
int mode = addr & 3;
int prg_high = value & 0x3F;
bool prg_low = value.Bit(7);
int prg_low_val = prg_low ? 1 : 0;
bool mirror = value.Bit(6);
SetMirrorType(mirror ? EMirrorType.Horizontal : EMirrorType.Vertical);
switch(mode)
{
case 0:
prg_banks_8k[0] = (byte)((prg_high * 2 + 0) ^ prg_low_val);
prg_banks_8k[1] = (byte)((prg_high * 2 + 1) ^ prg_low_val);
prg_banks_8k[2] = (byte)((prg_high * 2 + 2) ^ prg_low_val);
prg_banks_8k[3] = (byte)((prg_high * 2 + 3) ^ prg_low_val);
break;
case 1:
prg_banks_8k[0] = (byte)((prg_high*2+0) ^ prg_low_val);
prg_banks_8k[1] = (byte)((prg_high*2+1) ^ prg_low_val);
prg_banks_8k[2] = (byte)(0xFE);
prg_banks_8k[3] = (byte)(0xFF);
//maybe all 4?
break;
case 2:
prg_banks_8k[0] = (byte)((prg_high * 2 + 0) ^ prg_low_val);
prg_banks_8k[1] = (byte)((prg_high * 2 + 0) ^ prg_low_val);
prg_banks_8k[2] = (byte)((prg_high * 2 + 0) ^ prg_low_val);
prg_banks_8k[3] = (byte)((prg_high * 2 + 0) ^ prg_low_val);
break;
case 3:
prg_banks_8k[0] = (byte)((prg_high * 2 + 0) ^ prg_low_val);
prg_banks_8k[1] = (byte)((prg_high * 2 + 1) ^ prg_low_val);
prg_banks_8k[2] = (byte)((prg_high * 2 + 0) ^ prg_low_val);
prg_banks_8k[3] = (byte)((prg_high * 2 + 1) ^ prg_low_val);
break;
}
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("prg_banks_8k", ref prg_banks_8k);
}
}
}

View File

@ -7,6 +7,8 @@ using System;
using System.IO;
using System.Diagnostics;
//TODO - prg is 4 bits, chr is 6 bits
namespace BizHawk.Emulation.Consoles.Nintendo
{
//also, Namcot109, Namcot118, Namcot119 chips are this exact same thing
@ -44,6 +46,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
public virtual void WritePRG(int addr, byte value)
{
//($8001-$9FFF, odd)
switch (addr & 0x6001)
{
case 0x0000: //$8000
@ -123,7 +126,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
return mapper.Get_PRGBank_8K(addr);
}
int MapCHR(int addr)
protected int MapCHR(int addr)
{
int bank_1k = Get_CHRBank_1K(addr);
bank_1k &= chr_mask;