C64: Soft/Hard reset: it's about time

This commit is contained in:
SaxxonPike 2019-07-06 01:19:58 -05:00
parent d48964b642
commit 6ed11de85b
5 changed files with 64 additions and 2 deletions

View File

@ -21,6 +21,32 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
_board.Cpu.TraceCallback = null;
}
if (controller.IsPressed("Power"))
{
if (!_powerPressed)
{
_powerPressed = true;
HardReset();
}
}
else
{
_powerPressed = false;
}
if (controller.IsPressed("Reset"))
{
if (!_resetPressed)
{
_resetPressed = true;
SoftReset();
}
}
else
{
_resetPressed = false;
}
if (controller.IsPressed("Next Disk") && !_nextPressed)
{
_nextPressed = true;

View File

@ -191,6 +191,24 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
CartPort.HardReset();
}
public void SoftReset()
{
// equivalent to a hard reset EXCEPT cpu, color ram, memory
Bus = 0xFF;
InputRead = false;
Cia0.HardReset();
Cia1.HardReset();
Serial.HardReset();
Sid.HardReset();
Vic.HardReset();
User.HardReset();
Cassette.HardReset();
Serial.HardReset();
Cpu.SoftReset();
CartPort.HardReset();
}
public void Init()
{
CartPort.ReadOpenBus = ReadOpenBus;

View File

@ -34,6 +34,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
_cyclesPerFrame = _board.Vic.CyclesPerFrame;
_memoryCallbacks = new MemoryCallbackSystem(new[] { "System Bus" });
InitMedia(_roms[_currentDisk]);
HardReset();
switch (SyncSettings.VicType)
@ -137,7 +138,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
"Key Commodore", "Key Left Shift", "Key Z", "Key X", "Key C", "Key V", "Key B", "Key N", "Key M", "Key Comma", "Key Period", "Key Slash", "Key Right Shift", "Key Cursor Up/Down", "Key Cursor Left/Right",
"Key Space",
"Key F1", "Key F3", "Key F5", "Key F7",
"Previous Disk", "Next Disk"
"Previous Disk", "Next Disk",
"Power", "Reset"
}
};
@ -147,6 +149,10 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
private int _frame;
private readonly ITraceable _tracer;
// Power stuff
private bool _powerPressed;
private bool _resetPressed;
// Disk stuff
private bool _nextPressed;
@ -358,8 +364,12 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
private void HardReset()
{
InitMedia(_roms[_currentDisk]);
_board.HardReset();
}
private void SoftReset()
{
_board.SoftReset();
}
}
}

View File

@ -97,6 +97,13 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
_pinNmiLast = true;
}
public void SoftReset()
{
_cpu.NESSoftReset();
_port.Direction = 0x00;
_port.Latch = 0xFF;
}
// ------------------------------------
public void ExecutePhase()
{

View File

@ -137,6 +137,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
_xScroll = 0;
_yScroll = 0;
_cycle = 0;
_cycleIndex = 0;
// reset sprites
for (var i = 0; i < 8; i++)