commodore64: VIC reads from proper bank, increased performance
This commit is contained in:
parent
32a1ac645e
commit
1e6fdc2659
|
@ -149,7 +149,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
cartPort = new CartridgePort();
|
||||
cia0 = new MOS6526(initRegion);
|
||||
cia1 = new MOS6526(initRegion);
|
||||
pla = new MOSPLA(this, cia1.ReadPort0);
|
||||
pla = new MOSPLA(this);
|
||||
switch (initRegion)
|
||||
{
|
||||
case Region.NTSC:
|
||||
|
|
|
@ -53,12 +53,11 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
private bool pinHiRam;
|
||||
private bool pinLoRam;
|
||||
private bool ultimax;
|
||||
private Func<byte> vicBankPortRead;
|
||||
private ushort vicBank;
|
||||
|
||||
public MOSPLA(C64Chips newChips, Func<byte>newVicBankPortRead)
|
||||
public MOSPLA(C64Chips newChips)
|
||||
{
|
||||
chips = newChips;
|
||||
vicBankPortRead = newVicBankPortRead;
|
||||
pinExRom = true;
|
||||
pinGame = true;
|
||||
}
|
||||
|
@ -408,6 +407,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
break;
|
||||
case PLABank.Cia1:
|
||||
chips.cia1.Poke(addr, val);
|
||||
UpdateVicBank();
|
||||
break;
|
||||
case PLABank.ColorRam:
|
||||
chips.colorRam.Poke(addr, val);
|
||||
|
@ -500,21 +500,22 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
}
|
||||
else
|
||||
{
|
||||
addr |= vicBank;
|
||||
if ((addr & 0x7000) == 0x1000)
|
||||
{
|
||||
return chips.charRom.Read(addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint bank = (vicBankPortRead() & (uint)0x3);
|
||||
switch (bank)
|
||||
{
|
||||
case 0: addr |= 0xC000; break;
|
||||
case 1: addr |= 0x8000; break;
|
||||
case 2: addr |= 0x4000; break;
|
||||
}
|
||||
return chips.ram.Read(addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateVicBank()
|
||||
{
|
||||
switch (chips.cia1.ReadPort0() & 0x3)
|
||||
{
|
||||
case 0: vicBank = 0xC000; break;
|
||||
case 1: vicBank = 0x8000; break;
|
||||
case 2: vicBank = 0x4000; break;
|
||||
case 3: vicBank = 0x0000; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -539,6 +540,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
break;
|
||||
case PLABank.Cia1:
|
||||
chips.cia1.Write(addr, val);
|
||||
UpdateVicBank();
|
||||
break;
|
||||
case PLABank.ColorRam:
|
||||
chips.colorRam.Write(addr, val);
|
||||
|
|
|
@ -1032,7 +1032,6 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
break;
|
||||
case 0x1A:
|
||||
WriteRegister(addr, val);
|
||||
UpdatePins();
|
||||
break;
|
||||
case 0x1E:
|
||||
case 0x1F:
|
||||
|
@ -1153,12 +1152,14 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
intSpriteDataCollision = ((val & 0x02) != 0);
|
||||
intSpriteCollision = ((val & 0x04) != 0);
|
||||
intLightPen = ((val & 0x08) != 0);
|
||||
UpdatePins();
|
||||
break;
|
||||
case 0x1A:
|
||||
enableIntRaster = ((val & 0x01) != 0);
|
||||
enableIntSpriteDataCollision = ((val & 0x02) != 0);
|
||||
enableIntSpriteCollision = ((val & 0x04) != 0);
|
||||
enableIntLightPen = ((val & 0x08) != 0);
|
||||
UpdatePins();
|
||||
break;
|
||||
case 0x1B:
|
||||
sprites[0].priority = ((val & 0x01) != 0);
|
||||
|
|
Loading…
Reference in New Issue