commodore64: connect IRQ and NMI lines to cartridge port (no games seem to use them but it is in the schematic)

This commit is contained in:
saxxonpike 2012-11-30 23:20:35 +00:00
parent ae8566a0df
commit 3049098afb
2 changed files with 20 additions and 42 deletions

View File

@ -80,6 +80,14 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
// note: this will not disconnect any attached media
}
public bool IRQ
{
get
{
return true; //todo: hook this up to cartridge
}
}
public bool IsConnected
{
get
@ -87,5 +95,13 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
return connected;
}
}
public bool NMI
{
get
{
return true; //todo: hook this up to cartridge
}
}
}
}

View File

@ -15,16 +15,12 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
private C64Chips chips;
private MOS6502X cpu;
private bool freezeCpu;
private bool pinAEC;
private bool pinCassetteButton;
private bool pinCassetteMotor;
private bool pinCassetteOutput;
private bool pinCharen;
private bool pinIRQ;
private bool pinLoram;
private bool pinHiram;
private bool pinNMI;
private bool pinRDY;
private byte portDir;
private bool unusedPin0;
private bool unusedPin1;
@ -66,19 +62,16 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
public void ExecutePhase1()
{
UpdatePins();
}
public void ExecutePhase2()
{
UpdatePins();
if (pinAEC && !freezeCpu)
if (chips.vic.AEC && !freezeCpu)
{
// the 6502 core expects active high
// so we reverse the polarity here
cpu.NMI = !pinNMI;
cpu.IRQ = !pinIRQ;
cpu.NMI = !(chips.cia1.IRQ & chips.cartPort.NMI);
cpu.IRQ = !(chips.vic.IRQ && chips.cia0.IRQ && chips.cartPort.IRQ);
cpu.ExecuteOne();
}
@ -94,17 +87,6 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
unusedPinTTL1--;
}
private void UpdatePins()
{
pinAEC = chips.vic.AEC;
pinIRQ = chips.vic.IRQ && chips.cia0.IRQ;
pinNMI = chips.cia1.IRQ;
pinRDY = chips.vic.BA;
if (pinRDY)
freezeCpu = false;
}
// ------------------------------------
public byte Peek(int addr)
@ -130,7 +112,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
public byte Read(ushort addr)
{
// cpu freezes after first read when RDY is low
if (!pinRDY)
if (!chips.vic.BA)
freezeCpu = true;
if (addr == 0x0000)
@ -152,11 +134,6 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
// ------------------------------------
public bool AEC
{
get { return pinAEC; }
}
public bool Charen
{
get { return pinCharen; }
@ -167,26 +144,11 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
get { return pinHiram; }
}
public bool IRQ
{
get { return pinIRQ; }
}
public bool LoRam
{
get { return pinLoram; }
}
public bool NMI
{
get { return pinNMI; }
}
public bool RDY
{
get { return pinRDY; }
}
public byte PortData
{
get