Fix some bugs responsible for out-of-bounds array access crash on ym2612

This commit is contained in:
beirich 2012-04-29 01:40:38 +00:00
parent 7f1292d4f9
commit d322c3c00f
3 changed files with 17 additions and 3 deletions

View File

@ -3,7 +3,7 @@ using System.Globalization;
using System.IO;
// This Z80 emulator is a modified version of Ben Ryves 'Brazil' emulator.
// It is MIT licensed (not public domain). (See Licenses)
// It is MIT licensed.
namespace BizHawk.Emulation.CPUs.Z80
{
@ -33,6 +33,15 @@ namespace BizHawk.Emulation.CPUs.Z80
TotalExecutedCycles = 0;
}
/// <summary>
/// Reset the Z80 to its initial state, but don't modify cycle counters. For use where Z80 may be reset
/// </summary>
public void SoftReset()
{
ResetRegisters();
ResetInterrupts();
}
// Memory Access
public Func<ushort, byte> ReadMemory;

View File

@ -116,7 +116,7 @@ namespace BizHawk.Emulation.Consoles.Sega
{
Z80Reset = (value & 1) == 0;
if (Z80Reset)
SoundCPU.Reset();
SoundCPU.SoftReset();
//Console.WriteLine("z80 reset: " + Z80Reset);
return;
}
@ -182,7 +182,7 @@ namespace BizHawk.Emulation.Consoles.Sega
{
Z80Reset = (value & 0x100) == 0;
if (Z80Reset)
SoundCPU.Reset();
SoundCPU.SoftReset();
//Console.WriteLine("z80 reset: " + Z80Reset);
return;
}

View File

@ -28,6 +28,11 @@ namespace BizHawk.Emulation.Sound
public void BeginFrame(int clock)
{
frameStartClock = clock;
while (commands.Count > 0)
{
var cmd = commands.Dequeue();
WriteCommand(cmd);
}
}
public void EndFrame(int clock)