From c3644d8387697d7d841a91b649817836797d4d5a Mon Sep 17 00:00:00 2001 From: saxxonpike Date: Sat, 10 Nov 2012 02:49:21 +0000 Subject: [PATCH] commodore64: restore key added, connected to NMI signal --- .../Computers/Commodore64/C64.core.cs | 25 +++---------------- .../Computers/Commodore64/Input.cs | 3 +++ .../Computers/Commodore64/VicII.cs | 2 +- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/BizHawk.Emulation/Computers/Commodore64/C64.core.cs b/BizHawk.Emulation/Computers/Commodore64/C64.core.cs index 0d4dff0a26..ad80133123 100644 --- a/BizHawk.Emulation/Computers/Commodore64/C64.core.cs +++ b/BizHawk.Emulation/Computers/Commodore64/C64.core.cs @@ -103,24 +103,7 @@ namespace BizHawk.Emulation.Computers.Commodore64 public void PollInput() { input.Poll(); - - /* - cia0portAData = 0xFF; - cia0portBData = 0xFF; - - if (Controller["P1 Up"]) cia0portBData &= 0xFE; - if (Controller["P1 Down"]) cia0portBData &= 0xFD; - if (Controller["P1 Left"]) cia0portBData &= 0xFB; - if (Controller["P1 Right"]) cia0portBData &= 0xF7; - if (Controller["P1 Button"]) cia0portBData &= 0xEF; - if (Controller["P2 Up"]) cia0portAData &= 0xFE; - if (Controller["P2 Down"]) cia0portAData &= 0xFD; - if (Controller["P2 Left"]) cia0portAData &= 0xFB; - if (Controller["P2 Right"]) cia0portAData &= 0xF7; - if (Controller["P2 Button"]) cia0portAData &= 0xEF; - */ - - + signal.KeyboardNMI = input.restorePressed; } public byte ReadMemory(ushort addr) @@ -138,8 +121,8 @@ namespace BizHawk.Emulation.Computers.Commodore64 { private bool[] _CiaSerialInput = new bool[2]; private bool[] _CiaIRQOutput = new bool[2]; + private bool _KeyboardNMIOutput; private bool _VicAECOutput; - private bool _VicBAOutput; private bool _VicIRQOutput; private bool _VicLPInput; @@ -149,8 +132,8 @@ namespace BizHawk.Emulation.Computers.Commodore64 public bool CiaSerial1 { get { return _CiaSerialInput[1]; } } public bool CpuAEC { get { return _VicAECOutput; } } public bool CpuIRQ { get { return _VicIRQOutput | _CiaIRQOutput[0]; } } - public bool CpuNMI { get { return _CiaIRQOutput[1]; } } - public bool CpuRDY { get { return _VicBAOutput; } } + public bool CpuNMI { get { return _CiaIRQOutput[1] | _KeyboardNMIOutput; } } + public bool KeyboardNMI { get { return _KeyboardNMIOutput; } set { _KeyboardNMIOutput = value; } } public bool LPOutput { get { return _VicLPInput; } set { _VicLPInput = value; } } public bool VicAEC { get { return _VicAECOutput; } set { _VicAECOutput = value; } } public bool VicIRQ { get { return _VicIRQOutput; } set { _VicIRQOutput = value; } } diff --git a/BizHawk.Emulation/Computers/Commodore64/Input.cs b/BizHawk.Emulation/Computers/Commodore64/Input.cs index 48b0944bba..b8cf3aaa7a 100644 --- a/BizHawk.Emulation/Computers/Commodore64/Input.cs +++ b/BizHawk.Emulation/Computers/Commodore64/Input.cs @@ -26,6 +26,7 @@ namespace BizHawk.Emulation.Computers.Commodore64 }; public IController controller; + public bool restorePressed; private byte[] joystickLatch = new byte[2]; private byte keyboardColumnData = 0xFF; @@ -69,6 +70,8 @@ namespace BizHawk.Emulation.Computers.Commodore64 public void Poll() { + restorePressed = controller["Key Restore"]; + for (int i = 0; i < 2; i++) joystickLatch[i] = GetJoystickBits(i); for (int i = 0; i < 8; i++) diff --git a/BizHawk.Emulation/Computers/Commodore64/VicII.cs b/BizHawk.Emulation/Computers/Commodore64/VicII.cs index ef1f91f627..ef141161fe 100644 --- a/BizHawk.Emulation/Computers/Commodore64/VicII.cs +++ b/BizHawk.Emulation/Computers/Commodore64/VicII.cs @@ -816,7 +816,7 @@ namespace BizHawk.Emulation.Computers.Commodore64 if ((spriteFetchIndex & 1) == 0) { // first half of the fetch cycle, always fetch pointer - ushort pointerOffset = (ushort)((regs.VM << 10) + 0x3F8 + spriteIndex); + ushort pointerOffset = (ushort)((regs.VM << 10) | 0x3F8 | spriteIndex); regs.MPTR[spriteIndex] = mem.VicRead(pointerOffset); // also fetch upper 8 bits if enabled