nes-add mapper 47 (mmc3 multicart)

This commit is contained in:
zeromus 2011-09-25 02:26:50 +00:00
parent 9d5c52ee7e
commit 395b10956a
4 changed files with 119 additions and 3 deletions

View File

@ -119,6 +119,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\Mapper095.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\Mapper206.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\MMC3_family.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\NES-QJ.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\TQROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\TLSROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\TVROM.cs" />
@ -261,6 +262,39 @@
<Compile Include="Interfaces\Base Implementations\NullController.cs" />
<Compile Include="Interfaces\Base Implementations\NullEmulator.cs" />
<Compile Include="Interfaces\CoreComms.cs" />
<Compile Include="Progression\Extras\ETACalculator.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Progression\Progress.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Progression\ProgressCalculators\IProgressCalculator.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Progression\ProgressCalculators\ProgressCalcAmount.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Progression\ProgressCalculators\ProgressCalcFixed.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Progression\ProgressCalculators\ProgressCalcProportional.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Progression\ProgressCalculators\ProgressCalcUnknown.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Progression\ProgressChangedInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Progression\ProgressDepth.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Progression\ProgressExtensions.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Progression\ProgressTask.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="QuickCollections.cs" />
<Compile Include="Sound\CDAudio.cs" />
<Compile Include="Sound\Utilities\BufferedAsync.cs" />

View File

@ -41,7 +41,7 @@ Open bus and bus conflict emulation is not considered complete or thorough in an
044 Multicart Junk
045 Multicart Junk
046 Multicart Junk
047 MMC3Multi Needed (1st party)
047 MMC3Multi Decent
048 MMC3Variant Needed (similar to mmc3, should inherit)
049 Multicart Junk
050 Pirate Junk

View File

@ -120,6 +120,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
int a12_old;
byte irq_reload, irq_counter;
bool irq_pending, irq_enable;
public bool wram_enable, wram_write_protect;
//it really seems like these should be the same but i cant seem to unify them.
//theres no sense in delaying the IRQ, so its logic must be tied to the separator.
@ -146,6 +147,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
ser.Sync("irq_enable", ref irq_enable);
ser.Sync("separator_counter", ref separator_counter);
ser.Sync("irq_countdown", ref irq_countdown);
ser.Sync("wram_enable", ref wram_enable);
ser.Sync("wram_write_protect", ref wram_write_protect);
}
void SyncIRQ()
@ -168,6 +171,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
break;
case 0x2001: //$A001
//wram enable/protect
wram_write_protect = value.Bit(6);
wram_enable = value.Bit(7);
break;
case 0x4000: //$C000 - IRQ Reload value
irq_reload = value;
@ -276,9 +281,14 @@ namespace BizHawk.Emulation.Consoles.Nintendo
mapper.SyncState(ser);
}
protected virtual int Get_CHRBank_1K(int addr)
{
return mapper.Get_CHRBank_1K(addr);
}
int MapCHR(int addr)
{
int bank_1k = mapper.Get_CHRBank_1K(addr);
int bank_1k = Get_CHRBank_1K(addr);
bank_1k &= chr_mask;
addr = (bank_1k << 10) | (addr & 0x3FF);
return addr;
@ -313,9 +323,14 @@ namespace BizHawk.Emulation.Consoles.Nintendo
mapper.WritePRG(addr, value);
}
protected virtual int Get_PRGBank_8K(int addr)
{
return mapper.Get_PRGBank_8K(addr);
}
public override byte ReadPRG(int addr)
{
int bank_8k = mapper.Get_PRGBank_8K(addr);
int bank_8k = Get_PRGBank_8K(addr);
bank_8k &= prg_mask;
addr = (bank_8k << 13) | (addr & 0x1FFF);
return ROM[addr];

View File

@ -0,0 +1,67 @@
using System;
using System.IO;
using System.Diagnostics;
namespace BizHawk.Emulation.Consoles.Nintendo
{
public class NES_QJ : MMC3Board_Base
{
//state
int block;
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("block", ref block);
}
public override void WritePRG(int addr, byte value)
{
base.WritePRG(addr, value);
SetMirrorType(mmc3.MirrorType); //often redundant, but gets the job done
}
public override bool Configure(NES.EDetectionOrigin origin)
{
//analyze board type
switch (Cart.board_type)
{
case "NES-QJ": //super spike v'ball / nintendo world cup
AssertPrg(256); AssertChr(256); AssertVram(0); AssertWram(0);
AssertBattery(false);
break;
default:
return false;
}
BaseSetup();
return true;
}
protected override int Get_PRGBank_8K(int addr)
{
//base logic will return the mmc reg, which needs to be masked without awareness of the extra block
return (base.Get_PRGBank_8K(addr) & 0xF) + block * 16;
}
protected override int Get_CHRBank_1K(int addr)
{
//base logic will return the mmc reg, which needs to be masked without awareness of the extra block
return (base.Get_CHRBank_1K(addr) & 0x7F) + block * 128;
}
public override byte ReadWRAM(int addr)
{
return (byte)block;
}
public override void WriteWRAM(int addr, byte value)
{
if (mmc3.wram_enable && !mmc3.wram_write_protect)
{
block = value & 1;
}
}
}
}