commodore64: add mapper 000B (some educational titles) and mapper 0011 (a couple obscure games), increase PLA memory map efficiency
This commit is contained in:
parent
31faf359e9
commit
c1f9a131d5
|
@ -84,7 +84,9 @@
|
|||
<Compile Include="Computers\Commodore64\Cartridges\Mapper0000.cs" />
|
||||
<Compile Include="Computers\Commodore64\C64.Input.cs" />
|
||||
<Compile Include="Computers\Commodore64\Cartridges\Mapper0005.cs" />
|
||||
<Compile Include="Computers\Commodore64\Cartridges\Mapper000B.cs" />
|
||||
<Compile Include="Computers\Commodore64\Cartridges\Mapper000F.cs" />
|
||||
<Compile Include="Computers\Commodore64\Cartridges\Mapper0011.cs" />
|
||||
<Compile Include="Computers\Commodore64\Cartridges\Mapper0012.cs" />
|
||||
<Compile Include="Computers\Commodore64\Cartridges\Mapper0013.cs" />
|
||||
<Compile Include="Computers\Commodore64\Cartridges\Mapper0020.cs" />
|
||||
|
|
|
@ -167,10 +167,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
|
||||
public void ExecutePhase1()
|
||||
{
|
||||
// sync cartridge lines (these can change)
|
||||
pla.ExRom = cartPort.ExRom;
|
||||
pla.Game = cartPort.Game;
|
||||
|
||||
pla.UpdatePins();
|
||||
cia0.ExecutePhase1();
|
||||
cia1.ExecutePhase1();
|
||||
sid.ExecutePhase1();
|
||||
|
@ -180,6 +177,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
|
||||
public void ExecutePhase2()
|
||||
{
|
||||
pla.UpdatePins();
|
||||
cia0.ExecutePhase2();
|
||||
cia1.ExecutePhase2();
|
||||
sid.ExecutePhase2();
|
||||
|
|
|
@ -70,9 +70,15 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridges
|
|||
case 0x0005:
|
||||
result = new Mapper0005(chipAddress, chipBank, chipData);
|
||||
break;
|
||||
case 0x000B:
|
||||
result = new Mapper000B(chipAddress, chipBank, chipData);
|
||||
break;
|
||||
case 0x000F:
|
||||
result = new Mapper000F(chipAddress, chipBank, chipData);
|
||||
break;
|
||||
case 0x0011:
|
||||
result = new Mapper0011(chipAddress, chipBank, chipData);
|
||||
break;
|
||||
case 0x0012:
|
||||
result = new Mapper0012(chipAddress, chipBank, chipData);
|
||||
break;
|
||||
|
@ -83,7 +89,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridges
|
|||
result = new Mapper0020(chipAddress, chipBank, chipData);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
throw new Exception("This cartridge file uses an unrecognized mapper: " + mapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BizHawk.Emulation.Computers.Commodore64.Cartridges
|
||||
{
|
||||
// Westermann Learning mapper.
|
||||
// Starts up with both banks enabled, any read to DFxx
|
||||
// turns off the high bank by bringing GAME high.
|
||||
// I suspect that the game loads by copying all hirom to
|
||||
// the RAM underneath (BASIC variable values probably)
|
||||
// and then disables once loaded.
|
||||
|
||||
public class Mapper000B : Cartridge
|
||||
{
|
||||
private byte[] rom = new byte[0x4000];
|
||||
|
||||
public Mapper000B(List<uint> newAddresses, List<uint> newBanks, List<byte[]> newData)
|
||||
{
|
||||
validCartridge = false;
|
||||
|
||||
for (uint i = 0; i < 0x4000; i++)
|
||||
rom[i] = 0xFF;
|
||||
|
||||
if (newAddresses[0] == 0x8000)
|
||||
{
|
||||
Array.Copy(newData[0], rom, Math.Min(newData[0].Length, 0x4000));
|
||||
validCartridge = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override byte Peek8000(int addr)
|
||||
{
|
||||
return rom[addr];
|
||||
}
|
||||
|
||||
public override byte PeekA000(int addr)
|
||||
{
|
||||
return rom[addr | 0x2000];
|
||||
}
|
||||
|
||||
public override byte Read8000(ushort addr)
|
||||
{
|
||||
return rom[addr];
|
||||
}
|
||||
|
||||
public override byte ReadA000(ushort addr)
|
||||
{
|
||||
return rom[addr | 0x2000];
|
||||
}
|
||||
|
||||
public override byte ReadDF00(ushort addr)
|
||||
{
|
||||
pinGame = true;
|
||||
return base.ReadDF00(addr);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -89,7 +89,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridges
|
|||
BankSet(0);
|
||||
}
|
||||
|
||||
private void BankSet(uint index)
|
||||
protected void BankSet(uint index)
|
||||
{
|
||||
bankNumber = index & bankMask;
|
||||
UpdateState();
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BizHawk.Emulation.Computers.Commodore64.Cartridges
|
||||
{
|
||||
// This mapper comes from Dinamic. It is in fact identical
|
||||
// to the System 3 mapper (000F) except that bank switching is
|
||||
// done by reads to the DExx region instead of writes.
|
||||
// This is why mapper 0011 inherits directly from 000F.
|
||||
|
||||
public class Mapper0011 : Mapper000F
|
||||
{
|
||||
public Mapper0011(List<uint> newAddresses, List<uint> newBanks, List<byte[]> newData)
|
||||
: base(newAddresses, newBanks, newData)
|
||||
{
|
||||
// required to pass information to base class
|
||||
}
|
||||
|
||||
public override void PokeDE00(int addr, byte val)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
public override byte ReadDE00(ushort addr)
|
||||
{
|
||||
BankSet((uint)addr);
|
||||
return base.ReadDE00(addr);
|
||||
}
|
||||
|
||||
public override void WriteDE00(ushort addr, byte val)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
|
@ -100,12 +100,12 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridges
|
|||
currentBank = banks[bankNumber];
|
||||
if (romEnable)
|
||||
{
|
||||
pinExRom = true;
|
||||
pinExRom = false;
|
||||
pinGame = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
pinExRom = false;
|
||||
pinExRom = true;
|
||||
pinGame = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,25 +75,25 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
public bool Charen
|
||||
{
|
||||
get { return pinCharen; }
|
||||
set { pinCharen = value; UpdateMap(); }
|
||||
set { if (pinCharen != value) { pinCharen = value; UpdateMap(); } }
|
||||
}
|
||||
|
||||
public bool ExRom
|
||||
{
|
||||
get { return pinExRom; }
|
||||
set { pinExRom = value; UpdateMap(); }
|
||||
set { if (pinExRom != value) { pinExRom = value; UpdateMap(); } }
|
||||
}
|
||||
|
||||
public bool Game
|
||||
{
|
||||
get { return pinGame; }
|
||||
set { pinGame = value; UpdateMap(); }
|
||||
set { if (pinGame != value) { pinGame = value; UpdateMap(); } }
|
||||
}
|
||||
|
||||
public bool HiRam
|
||||
{
|
||||
get { return pinHiRam; }
|
||||
set { pinHiRam = value; UpdateMap(); }
|
||||
set { if (pinHiRam != value) { pinHiRam = value; UpdateMap(); } }
|
||||
}
|
||||
|
||||
public bool InputWasRead
|
||||
|
@ -105,7 +105,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
public bool LoRam
|
||||
{
|
||||
get { return pinLoRam; }
|
||||
set { pinLoRam = value; UpdateMap(); }
|
||||
set { if (pinLoRam != value) { pinLoRam = value; UpdateMap(); } }
|
||||
}
|
||||
|
||||
public bool UltimaxMode
|
||||
|
@ -303,6 +303,15 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
}
|
||||
}
|
||||
|
||||
public void UpdatePins()
|
||||
{
|
||||
// called after all cartridge routines in case
|
||||
// game/exrom configuration changes
|
||||
|
||||
Game = chips.cartPort.Game;
|
||||
ExRom = chips.cartPort.ExRom;
|
||||
}
|
||||
|
||||
// ------------------------------------
|
||||
|
||||
private PLABank Bank(ushort addr)
|
||||
|
|
Loading…
Reference in New Issue