diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/CartridgePort.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/CartridgePort.cs index 90e2ca4feb..8abc9e3a4d 100644 --- a/BizHawk.Emulation/Computers/Commodore64/MOS/CartridgePort.cs +++ b/BizHawk.Emulation/Computers/Commodore64/MOS/CartridgePort.cs @@ -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 + } + } } } diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/MOS6510.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/MOS6510.cs index c45ecb64dc..5337040508 100644 --- a/BizHawk.Emulation/Computers/Commodore64/MOS/MOS6510.cs +++ b/BizHawk.Emulation/Computers/Commodore64/MOS/MOS6510.cs @@ -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