Commodore64: Fix EasyFlash registers- the address mask is actually 0x2.

This commit is contained in:
saxxonpike 2013-08-19 08:30:37 +00:00
parent b5fcb81727
commit a28f8e5062
1 changed files with 17 additions and 19 deletions

View File

@ -26,6 +26,8 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
private byte[] currentBankA; private byte[] currentBankA;
private byte[] currentBankB; private byte[] currentBankB;
private byte[] dummyBank; private byte[] dummyBank;
private bool jumper = false;
private int stateBits;
private byte[] ram = new byte[256]; private byte[] ram = new byte[256];
public Mapper0020(List<int> newAddresses, List<int> newBanks, List<byte[]> newData) public Mapper0020(List<int> newAddresses, List<int> newBanks, List<byte[]> newData)
@ -86,21 +88,11 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
// normally you can't read these regs // normally you can't read these regs
// but Peek is provided here for debug reasons // but Peek is provided here for debug reasons
// and may not stay around // and may not stay around
if (addr == 0x00) addr &= 0x02;
return (byte)bankNumber; if (addr == 0x00)
else if (addr == 0x02) return (byte)bankNumber;
return (byte)( else
(pinGame ? 0x00 : 0x01) | return (byte)stateBits;
(pinExRom ? 0x00 : 0x02) |
0x04 |
0x08 |
0x10 |
0x20 |
0x40 |
(boardLed ? 0x80 : 0x00)
);
else
return (byte)0xFF;
} }
public override byte PeekDF00(int addr) public override byte PeekDF00(int addr)
@ -110,9 +102,10 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
public override void PokeDE00(int addr, byte val) public override void PokeDE00(int addr, byte val)
{ {
addr &= 0x02;
if (addr == 0x00) if (addr == 0x00)
BankSet(val); BankSet(val);
else if (addr == 0x02) else
StateSet(val); StateSet(val);
} }
@ -138,9 +131,13 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
private void StateSet(byte val) private void StateSet(byte val)
{ {
pinGame = ((val & 0x01) == 0); stateBits = val &= 0x87;
if ((val & 0x04) != 0)
pinGame = ((val & 0x01) == 0);
else
pinGame = jumper;
pinExRom = ((val & 0x02) == 0); pinExRom = ((val & 0x02) == 0);
boardLed = ((val & 0x80) != 0) ? !boardLed : boardLed; boardLed = ((val & 0x80) != 0);
UpdateState(); UpdateState();
} }
@ -152,9 +149,10 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
public override void WriteDE00(int addr, byte val) public override void WriteDE00(int addr, byte val)
{ {
addr &= 0x02;
if (addr == 0x00) if (addr == 0x00)
BankSet(val); BankSet(val);
else if (addr == 0x02) else
StateSet(val); StateSet(val);
} }