nes-support mapper 076

This commit is contained in:
zeromus 2012-06-15 19:55:29 +00:00
parent 21b1bde8af
commit 540be07cf2
6 changed files with 85 additions and 39 deletions

View File

@ -169,6 +169,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\TVROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\TxROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Namcot1xx\DRROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Namcot1xx\Mapper076.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Namcot1xx\Mapper095.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Namcot1xx\Mapper206.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Namcot1xx\Namcot1xx.cs" />

View File

@ -63,7 +63,7 @@ Open bus and bus conflict emulation is not considered complete or thorough in an
073 VRC3 Good
074 Pirate (CN) Junk
075 VRC1 Complete
076 Misc (J) Nothing
076 Misc (J) Complete (namcot108 variant)
077 Misc (J) Complete
078 Misc Complete
079 NINA-06 Complete

View File

@ -14,8 +14,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
//state
int reg_addr;
bool chr_mode, prg_mode;
ByteBuffer chr_regs_1k = new ByteBuffer(8);
ByteBuffer prg_regs_8k = new ByteBuffer(4);
ByteBuffer regs = new ByteBuffer(8);
public byte mirror;
@ -31,6 +29,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
int separator_counter;
int irq_countdown;
//volatile state
ByteBuffer chr_regs_1k = new ByteBuffer(8);
ByteBuffer prg_regs_8k = new ByteBuffer(4);
//configuration
public enum EMMC3Type
@ -51,9 +52,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
public void Dispose()
{
regs.Dispose();
chr_regs_1k.Dispose();
prg_regs_8k.Dispose();
regs.Dispose();
}
public NES.NESBoardBase.EMirrorType MirrorType { get { return mirror == 0 ? NES.NESBoardBase.EMirrorType.Vertical : NES.NESBoardBase.EMirrorType.Horizontal; } }

View File

@ -5,7 +5,7 @@ using System.Diagnostics;
namespace BizHawk.Emulation.Consoles.Nintendo
{
//aka mapper 118
//wires the mapper outputs to control the nametables. check out the companion board Mapper095
//wires the mapper outputs to control the nametables
public class TLSROM : MMC3Board_Base
{
public override bool Configure(NES.EDetectionOrigin origin)

View File

@ -0,0 +1,47 @@
using System;
using System.IO;
using System.Diagnostics;
namespace BizHawk.Emulation.Consoles.Nintendo
{
//aka NAMCOT-3446
public class Mapper076 : Namcot108Board_Base
{
public override bool Configure(NES.EDetectionOrigin origin)
{
//analyze board type
switch (Cart.board_type)
{
case "NAMCOT-3446": //Megami Tensei: Digital Devil Story
case "MAPPER076":
break;
default:
return false;
}
BaseSetup();
SetMirrorType(EMirrorType.Vertical);
return true;
}
int RewireCHR(int addr)
{
int mapper_addr = addr >> 1;
int bank_1k = mapper.Get_CHRBank_1K(mapper_addr + 0x1000);
int ofs = addr & ((1 << 11) - 1);
return (bank_1k << 11) + ofs;
}
public override byte ReadPPU(int addr)
{
if (addr < 0x2000) return VROM[RewireCHR(addr)];
else return base.ReadPPU(addr);
}
public override void WritePPU(int addr, byte value)
{
if (addr < 0x2000) { }
else base.WritePPU(addr, value);
}
}
}

View File

@ -14,6 +14,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
{
//state
int reg_addr;
ByteBuffer regs = new ByteBuffer(8);
//volatile state
ByteBuffer chr_regs_1k = new ByteBuffer(8);
ByteBuffer prg_regs_8k = new ByteBuffer(4);
@ -22,23 +25,12 @@ namespace BizHawk.Emulation.Consoles.Nintendo
{
this.board = board;
prg_regs_8k[0] = 0;
prg_regs_8k[1] = 1;
prg_regs_8k[2] = 0xFE; //constant
prg_regs_8k[3] = 0xFF; //constant
chr_regs_1k[0] = 0;
chr_regs_1k[1] = 1;
chr_regs_1k[2] = 2;
chr_regs_1k[3] = 3;
chr_regs_1k[4] = 4;
chr_regs_1k[5] = 5;
chr_regs_1k[6] = 6;
chr_regs_1k[7] = 7;
Sync();
}
public void Dispose()
{
regs.Dispose();
chr_regs_1k.Dispose();
prg_regs_8k.Dispose();
}
@ -46,8 +38,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
public virtual void SyncState(Serializer ser)
{
ser.Sync("reg_addr", ref reg_addr);
ser.Sync("chr_regs_1k", ref chr_regs_1k);
ser.Sync("prg_regs_8k", ref prg_regs_8k);
ser.Sync("regs", ref regs);
Sync();
}
public virtual void WritePRG(int addr, byte value)
@ -58,29 +50,34 @@ namespace BizHawk.Emulation.Consoles.Nintendo
reg_addr = (value & 7);
break;
case 0x0001: //$8001
switch (reg_addr)
{
//bottom bits of these chr regs are ignored
case 0:
chr_regs_1k[0] = (byte)(value & ~1);
chr_regs_1k[1] = (byte)(value | 1);
break;
case 1:
chr_regs_1k[2] = (byte)(value & ~1);
chr_regs_1k[3] = (byte)(value | 1);
break;
case 2: chr_regs_1k[4] = value; break;
case 3: chr_regs_1k[5] = value; break;
case 4: chr_regs_1k[6] = value; break;
case 5: chr_regs_1k[7] = value; break;
case 6: prg_regs_8k[0] = value; break;
case 7: prg_regs_8k[1] = value; break;
}
regs[reg_addr] = value;
Sync();
break;
}
}
void Sync()
{
prg_regs_8k[0] = regs[6];
prg_regs_8k[1] = regs[7];
prg_regs_8k[2] = 0xFE;
prg_regs_8k[3] = 0xFF;
byte r0_0 = (byte)(regs[0] & ~1);
byte r0_1 = (byte)(regs[0] | 1);
byte r1_0 = (byte)(regs[1] & ~1);
byte r1_1 = (byte)(regs[1] | 1);
chr_regs_1k[0] = r0_0;
chr_regs_1k[1] = r0_1;
chr_regs_1k[2] = r1_0;
chr_regs_1k[3] = r1_1;
chr_regs_1k[4] = regs[2];
chr_regs_1k[5] = regs[3];
chr_regs_1k[6] = regs[4];
chr_regs_1k[7] = regs[5];
}
public int Get_PRGBank_8K(int addr)
{
int bank_8k = addr >> 13;