Atari 2600 - implement homebrew mapper 0840

This commit is contained in:
adelikat 2014-04-03 21:25:02 +00:00
parent 72b3ca7204
commit 58732cf627
2 changed files with 55 additions and 4 deletions

View File

@ -1,4 +1,4 @@
using System;
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Atari.Atari2600
{
@ -23,9 +23,59 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
*/
internal class m0840 : MapperBase
{
public m0840()
private int _bank4K;
private byte ReadMem(ushort addr, bool peek)
{
throw new NotImplementedException();
if (!peek)
{
Address(addr);
}
if (addr < 0x1000)
{
return base.ReadMemory(addr);
}
return core.rom[(_bank4K << 12) + (addr & 0xFFF)];
}
public override byte ReadMemory(ushort addr)
{
return ReadMem(addr, false);
}
public override byte PeekMemory(ushort addr)
{
return ReadMem(addr, true);
}
public override void WriteMemory(ushort addr, byte value)
{
Address(addr);
if (addr < 0x1000)
{
base.WriteMemory(addr, value);
}
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("bank_4k", ref _bank4K);
}
private void Address(ushort addr)
{
switch (addr & 0x1840)
{
case 0x0800:
_bank4K = 0;
break;
case 0x0840:
_bank4K = 1;
break;
}
}
}
}

View File

@ -2696,4 +2696,5 @@ sha1:3797959E4A3236B6562CE15AF7D96633F6720FC8 Fu Kung! - 2 Dancing Babies Demo
sha1:95D67B058EC40E8C5525365714D221E4C6B3C97D Ruby Runner Demo (4A50 Bankswitching) (2006) (John Payson) (WIP) A26 m=4A50
sha1:9CD8217DCCBE60F9A25A930D614EE5384F432A83 Boulder Dash (2005) (Andrew Davie) (WIP) A26 m=3E
sha1:00CCF622E7BA4D0A39DCBABAB771CE815B0FB8FE Boulder Dash (2005) (Andrew Davie) (WIP) (PAL A26 m=3E
sha1:650DA2339D41D1D2F180A6CAFE8DC311AC588ACD Boulder Dash Intro Tune (2005) (Erik Ehrling) A26 m=3E
sha1:650DA2339D41D1D2F180A6CAFE8DC311AC588ACD Boulder Dash Intro Tune (2005) (Erik Ehrling) A26 m=3E
sha1:F28E52921646A18467577370808454F494C15EFE 0840 EconoBanking A26 m=0840