commodore64: restore key added, connected to NMI signal

This commit is contained in:
saxxonpike 2012-11-10 02:49:21 +00:00
parent 4c20f94b74
commit c3644d8387
3 changed files with 8 additions and 22 deletions

View File

@ -103,24 +103,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
public void PollInput() public void PollInput()
{ {
input.Poll(); input.Poll();
signal.KeyboardNMI = input.restorePressed;
/*
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;
*/
} }
public byte ReadMemory(ushort addr) public byte ReadMemory(ushort addr)
@ -138,8 +121,8 @@ namespace BizHawk.Emulation.Computers.Commodore64
{ {
private bool[] _CiaSerialInput = new bool[2]; private bool[] _CiaSerialInput = new bool[2];
private bool[] _CiaIRQOutput = new bool[2]; private bool[] _CiaIRQOutput = new bool[2];
private bool _KeyboardNMIOutput;
private bool _VicAECOutput; private bool _VicAECOutput;
private bool _VicBAOutput;
private bool _VicIRQOutput; private bool _VicIRQOutput;
private bool _VicLPInput; private bool _VicLPInput;
@ -149,8 +132,8 @@ namespace BizHawk.Emulation.Computers.Commodore64
public bool CiaSerial1 { get { return _CiaSerialInput[1]; } } public bool CiaSerial1 { get { return _CiaSerialInput[1]; } }
public bool CpuAEC { get { return _VicAECOutput; } } public bool CpuAEC { get { return _VicAECOutput; } }
public bool CpuIRQ { get { return _VicIRQOutput | _CiaIRQOutput[0]; } } public bool CpuIRQ { get { return _VicIRQOutput | _CiaIRQOutput[0]; } }
public bool CpuNMI { get { return _CiaIRQOutput[1]; } } public bool CpuNMI { get { return _CiaIRQOutput[1] | _KeyboardNMIOutput; } }
public bool CpuRDY { get { return _VicBAOutput; } } public bool KeyboardNMI { get { return _KeyboardNMIOutput; } set { _KeyboardNMIOutput = value; } }
public bool LPOutput { get { return _VicLPInput; } set { _VicLPInput = value; } } public bool LPOutput { get { return _VicLPInput; } set { _VicLPInput = value; } }
public bool VicAEC { get { return _VicAECOutput; } set { _VicAECOutput = value; } } public bool VicAEC { get { return _VicAECOutput; } set { _VicAECOutput = value; } }
public bool VicIRQ { get { return _VicIRQOutput; } set { _VicIRQOutput = value; } } public bool VicIRQ { get { return _VicIRQOutput; } set { _VicIRQOutput = value; } }

View File

@ -26,6 +26,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
}; };
public IController controller; public IController controller;
public bool restorePressed;
private byte[] joystickLatch = new byte[2]; private byte[] joystickLatch = new byte[2];
private byte keyboardColumnData = 0xFF; private byte keyboardColumnData = 0xFF;
@ -69,6 +70,8 @@ namespace BizHawk.Emulation.Computers.Commodore64
public void Poll() public void Poll()
{ {
restorePressed = controller["Key Restore"];
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
joystickLatch[i] = GetJoystickBits(i); joystickLatch[i] = GetJoystickBits(i);
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)

View File

@ -816,7 +816,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
if ((spriteFetchIndex & 1) == 0) if ((spriteFetchIndex & 1) == 0)
{ {
// first half of the fetch cycle, always fetch pointer // 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); regs.MPTR[spriteIndex] = mem.VicRead(pointerOffset);
// also fetch upper 8 bits if enabled // also fetch upper 8 bits if enabled