NES - Implement board HVC_UNROM_74HC08 (Mapper 180). Crazy Climber (J) now works. Testing is limited since it uses a crazy climber controller that we don't emulate

This commit is contained in:
andres.delikat 2011-09-24 18:28:07 +00:00
parent 452e6768a8
commit d64a985d97
3 changed files with 69 additions and 1 deletions

View File

@ -94,6 +94,7 @@
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Consoles\Nintendo\NES\Boards\HVC_UN1ROM.cs" /> <Compile Include="Consoles\Nintendo\NES\Boards\HVC_UN1ROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\HVC_UNROM_74HC08.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\IC_74x377.cs"> <Compile Include="Consoles\Nintendo\NES\Boards\IC_74x377.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>

View File

@ -95,7 +95,7 @@ Open bus and bus conflict emulation is not considered complete or thorough in an
159 Bandai {{See 016}} 159 Bandai {{See 016}}
164 Pirate Junk 164 Pirate Junk
165 Pirate Junk 165 Pirate Junk
180 Misc (J) Nothing 180 Misc (J) Complete (but we don't implement the crazy climber controller)
182 MMC3Variant Nothing 182 MMC3Variant Nothing
184 Sunsoft-1 Complete 184 Sunsoft-1 Complete
185 Misc (J) {{See 003}} This one will be an organizational pain as the games need additional data in gamedb 185 Misc (J) {{See 003}} This one will be an organizational pain as the games need additional data in gamedb

View File

@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Consoles.Nintendo
{
class HVC_UNROM_74HC08 : NES.NESBoardBase
{
//Mapper 180
//Crazy Climber (J)
int prg_bank_mask_16k;
byte prg_bank_16k;
ByteBuffer prg_banks_16k = new ByteBuffer(2);
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "HVC-UNROM+74HC08":
break;
default:
return false;
}
SetMirrorType(Cart.pad_h, Cart.pad_v);
prg_bank_mask_16k = (Cart.prg_size / 16) - 1;
prg_banks_16k[0] = 0;
return true;
}
public override void Dispose()
{
prg_banks_16k.Dispose();
base.Dispose();
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("prg_bank_mask_16k", ref prg_bank_mask_16k);
ser.Sync("prg_bank_16k", ref prg_bank_16k);
ser.Sync("prg_banks_16k", ref prg_banks_16k);
}
void SyncPRG()
{
prg_banks_16k[1] = prg_bank_16k;
}
public override void WritePRG(int addr, byte value)
{
prg_bank_16k = (byte)(value & 7);
SyncPRG();
}
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];
}
}
}