nes-a bit of reorg, and support mapper 48
This commit is contained in:
parent
3d5798c179
commit
8efd076f99
|
@ -95,7 +95,6 @@
|
|||
<Compile Include="Consoles\Nintendo\NES\Boards\GxROM.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\HVC_UNROM_74HC08.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\IC_74x377.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
@ -111,6 +110,7 @@
|
|||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper089.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper093.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper107.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper180.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper240.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper242.cs" />
|
||||
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper078.cs" />
|
||||
|
@ -261,6 +261,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" />
|
||||
|
|
|
@ -42,7 +42,7 @@ Open bus and bus conflict emulation is not considered complete or thorough in an
|
|||
045 Multicart Junk
|
||||
046 Multicart Junk
|
||||
047 MMC3Multi Decent
|
||||
048 MMC3Variant Needed (similar to mmc3, should inherit)
|
||||
048 MMC3Variant Decent
|
||||
049 Multicart Junk
|
||||
050 Pirate Junk
|
||||
052 Multicart Junk
|
||||
|
|
|
@ -119,7 +119,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
public byte mirror;
|
||||
int a12_old;
|
||||
byte irq_reload, irq_counter;
|
||||
bool irq_pending, irq_enable;
|
||||
protected 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.
|
||||
|
@ -151,7 +151,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
ser.Sync("wram_write_protect", ref wram_write_protect);
|
||||
}
|
||||
|
||||
void SyncIRQ()
|
||||
protected virtual void SyncIRQ()
|
||||
{
|
||||
board.NES.irq_cart = irq_pending;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
}
|
||||
}
|
||||
|
||||
public void ClockPPU()
|
||||
public virtual void ClockPPU()
|
||||
{
|
||||
if (separator_counter > 0)
|
||||
separator_counter--;
|
||||
|
@ -241,7 +241,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
}
|
||||
|
||||
|
||||
public void AddressPPU(int addr)
|
||||
public virtual void AddressPPU(int addr)
|
||||
{
|
||||
int a12 = (addr >> 12) & 1;
|
||||
bool rising_edge = (a12 == 1 && a12_old == 0);
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Text;
|
|||
|
||||
namespace BizHawk.Emulation.Consoles.Nintendo
|
||||
{
|
||||
class HVC_UNROM_74HC08 : NES.NESBoardBase
|
||||
class Mapper180 : NES.NESBoardBase
|
||||
{
|
||||
//Mapper 180
|
||||
//Crazy Climber (J)
|
|
@ -11,26 +11,76 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
//Don Doko Don
|
||||
//Insector X
|
||||
|
||||
//also mapper 048 (same as 33 but with an extra chip)
|
||||
|
||||
class TAITO_TC0190FMC : NES.NESBoardBase
|
||||
{
|
||||
//configuration
|
||||
int prg_bank_mask, chr_bank_mask;
|
||||
bool pal16;
|
||||
|
||||
class MMC3Variant : MMC3
|
||||
{
|
||||
public MMC3Variant(NES.NESBoardBase board)
|
||||
: base(board,0)
|
||||
{
|
||||
}
|
||||
|
||||
bool pending;
|
||||
int delay;
|
||||
|
||||
public override void SyncState(Serializer ser)
|
||||
{
|
||||
base.SyncState(ser);
|
||||
ser.BeginSection("mmc3variant");
|
||||
ser.Sync("pending", ref pending);
|
||||
ser.Sync("delay", ref delay);
|
||||
ser.EndSection();
|
||||
}
|
||||
|
||||
protected override void SyncIRQ()
|
||||
{
|
||||
if (irq_pending && !pending)
|
||||
delay = 12; //supposed to be 4 cpu clocks
|
||||
if (!irq_pending)
|
||||
{
|
||||
delay = 0;
|
||||
board.NES.irq_cart = false;
|
||||
}
|
||||
pending = irq_pending;
|
||||
}
|
||||
|
||||
public override void ClockPPU()
|
||||
{
|
||||
base.ClockPPU();
|
||||
|
||||
if (delay > 0)
|
||||
{
|
||||
delay--;
|
||||
if(delay==0)
|
||||
board.NES.irq_cart = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//state
|
||||
ByteBuffer prg_regs_8k = new ByteBuffer(4);
|
||||
ByteBuffer chr_regs_1k = new ByteBuffer(8);
|
||||
int mirror_mode;
|
||||
MMC3Variant mmc3;
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
prg_regs_8k.Dispose();
|
||||
chr_regs_1k.Dispose();
|
||||
if (mmc3 != null) mmc3.Dispose();
|
||||
}
|
||||
|
||||
public override void SyncState(Serializer ser)
|
||||
{
|
||||
base.SyncState(ser);
|
||||
if(mmc3 != null) mmc3.SyncState(ser);
|
||||
ser.Sync("prg_regs_8k", ref prg_regs_8k);
|
||||
ser.Sync("chr_regs_1k", ref chr_regs_1k);
|
||||
ser.Sync("mirror_mode", ref mirror_mode);
|
||||
|
@ -44,6 +94,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
case "TAITO-TC0190FMC":
|
||||
case "TAITO-TC0350FMR":
|
||||
AssertPrg(128); AssertChr(128,256); AssertWram(0); AssertVram(0);
|
||||
pal16 = false;
|
||||
break;
|
||||
case "TAITO-TC0190FMC+PAL16R4":
|
||||
//this is the same as the base TAITO-TC0190FMC, with an added PAL16R4ACN which is a "programmable TTL device", presumably just the IRQ and mirroring
|
||||
AssertPrg(128,256); AssertChr(256); AssertWram(0); AssertVram(0);
|
||||
pal16 = true;
|
||||
mmc3 = new MMC3Variant(this);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
@ -71,7 +128,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
|
||||
public override void WritePRG(int addr, byte value)
|
||||
{
|
||||
addr &= 0xA003;
|
||||
if (pal16)
|
||||
addr &= 0xE003;
|
||||
else
|
||||
addr &= 0xA003;
|
||||
switch (addr)
|
||||
{
|
||||
//$8000 [.MPP PPPP]
|
||||
|
@ -79,7 +139,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
//P = PRG Reg 0 (8k @ $8000)
|
||||
case 0x0000:
|
||||
prg_regs_8k[0] = (byte)(value & 0x3F);
|
||||
mirror_mode = (value >> 6) & 1;
|
||||
if(!pal16) mirror_mode = (value >> 6) & 1;
|
||||
SyncMirror();
|
||||
break;
|
||||
|
||||
|
@ -109,6 +169,28 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
case 0x2003: //$A003 [CCCC CCCC] CHR Reg 5 (1k @ $1C00)
|
||||
chr_regs_1k[7] = value;
|
||||
break;
|
||||
|
||||
case 0x4000:
|
||||
if (!pal16) break;
|
||||
mmc3.WritePRG(0x4000, (byte)(value ^ 0xFF));
|
||||
break;
|
||||
case 0x4001:
|
||||
if (!pal16) break;
|
||||
mmc3.WritePRG(0x4001, value);
|
||||
break;
|
||||
case 0x4002:
|
||||
if (!pal16) break;
|
||||
mmc3.WritePRG(0x6000, value);
|
||||
break;
|
||||
case 0x4003:
|
||||
if (!pal16) break;
|
||||
mmc3.WritePRG(0x6001, value);
|
||||
break;
|
||||
|
||||
case 0x6000:
|
||||
if(pal16) mirror_mode = (value >> 6) & 1;
|
||||
SyncMirror();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,5 +218,17 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
addr = (bank_8k << 13) | ofs;
|
||||
return ROM[addr];
|
||||
}
|
||||
|
||||
public override void ClockPPU()
|
||||
{
|
||||
if(pal16)
|
||||
mmc3.ClockPPU();
|
||||
}
|
||||
|
||||
public override void AddressPPU(int addr)
|
||||
{
|
||||
if (pal16)
|
||||
mmc3.AddressPPU(addr);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue