2013-11-04 00:36:15 +00:00
|
|
|
|
using BizHawk.Common;
|
|
|
|
|
|
2013-11-13 03:32:25 +00:00
|
|
|
|
namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
2012-03-31 20:53:14 +00:00
|
|
|
|
{
|
2012-04-29 21:01:06 +00:00
|
|
|
|
/*
|
|
|
|
|
3F (Tigervision)
|
|
|
|
|
-----
|
|
|
|
|
|
|
|
|
|
Traditionally, this method was used on the Tigervision games. The ROMs were all 8K, and
|
|
|
|
|
there's two 2K pages in the 4K of address space. The upper bank is fixed to the last 2K
|
|
|
|
|
of the ROM.
|
|
|
|
|
|
|
|
|
|
The first 2K is selectable by writing to any location between 0000 and 003F. Yes, this
|
|
|
|
|
overlaps the TIA, but this is not a big deal. You simply use the mirrors of the TIA at
|
|
|
|
|
40-7F instead! To select a bank, the games write to 3Fh, because it's not implemented
|
|
|
|
|
on the TIA.
|
|
|
|
|
|
|
|
|
|
The homebrew community has decided that if 8K is good, more ROM is better! This mapper
|
|
|
|
|
can support up to 512K bytes of ROM just by implementing all 8 bits on the mapper
|
|
|
|
|
register, and this has been done... however I do not think 512K ROMs have been made just
|
|
|
|
|
yet.
|
|
|
|
|
*/
|
|
|
|
|
|
2014-04-02 21:27:14 +00:00
|
|
|
|
internal class m3F : MapperBase
|
2012-03-31 20:53:14 +00:00
|
|
|
|
{
|
2013-04-16 00:42:57 +00:00
|
|
|
|
int lowbank_2k;
|
2012-03-31 20:53:14 +00:00
|
|
|
|
|
2012-10-18 22:22:09 +00:00
|
|
|
|
public override void SyncState(Serializer ser)
|
|
|
|
|
{
|
|
|
|
|
base.SyncState(ser);
|
|
|
|
|
ser.Sync("lowbank_2k", ref lowbank_2k);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override byte ReadMemory(ushort addr)
|
|
|
|
|
{
|
|
|
|
|
if (addr < 0x1000)
|
|
|
|
|
{
|
|
|
|
|
return base.ReadMemory(addr);
|
|
|
|
|
}
|
|
|
|
|
else if (addr < 0x17FF) //Low 2k Bank
|
|
|
|
|
{
|
|
|
|
|
int a = addr & 0x07FF; //2K
|
|
|
|
|
int bank = lowbank_2k << 11;
|
|
|
|
|
return core.rom[bank + a];
|
|
|
|
|
}
|
|
|
|
|
else if (addr < 0x2000) //High bank fixed to last 2k of ROM
|
|
|
|
|
{
|
|
|
|
|
return core.rom[(core.rom.Length - 2048) + (addr & 0x07FF)];
|
|
|
|
|
}
|
|
|
|
|
return base.ReadMemory(addr);
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-11 01:46:12 +00:00
|
|
|
|
public override byte PeekMemory(ushort addr)
|
|
|
|
|
{
|
|
|
|
|
return ReadMemory(addr);
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-18 22:22:09 +00:00
|
|
|
|
public override void WriteMemory(ushort addr, byte value)
|
|
|
|
|
{
|
|
|
|
|
if (addr < 0x0040)
|
|
|
|
|
{
|
|
|
|
|
if ((value << 11) < core.rom.Length)
|
|
|
|
|
{
|
|
|
|
|
lowbank_2k = value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lowbank_2k = value & (core.rom.Length >> 11);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
base.WriteMemory(addr, value);
|
|
|
|
|
}
|
2012-03-31 20:53:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|