NESHawk: fix regression in apu
This commit is contained in:
parent
b45b552b9d
commit
d113d76c6a
|
@ -694,6 +694,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
// happens when a write triggered refill that sets length to zero happens too close to an automatic DMA
|
// happens when a write triggered refill that sets length to zero happens too close to an automatic DMA
|
||||||
// (causes 1-cycle blips in dmc_dma_start_test_v2)
|
// (causes 1-cycle blips in dmc_dma_start_test_v2)
|
||||||
public bool fill_glitch_2;
|
public bool fill_glitch_2;
|
||||||
|
public bool fill_glitch_2_end;
|
||||||
|
|
||||||
|
public bool timer_just_reloaded;
|
||||||
|
|
||||||
public int sample => out_deltacounter /* - 64*/;
|
public int sample => out_deltacounter /* - 64*/;
|
||||||
|
|
||||||
|
@ -719,6 +722,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
ser.Sync(nameof(out_silence), ref out_silence);
|
ser.Sync(nameof(out_silence), ref out_silence);
|
||||||
ser.Sync(nameof(fill_glitch), ref fill_glitch);
|
ser.Sync(nameof(fill_glitch), ref fill_glitch);
|
||||||
ser.Sync(nameof(fill_glitch_2), ref fill_glitch_2);
|
ser.Sync(nameof(fill_glitch_2), ref fill_glitch_2);
|
||||||
|
ser.Sync(nameof(fill_glitch_2_end), ref fill_glitch_2_end);
|
||||||
|
ser.Sync(nameof(timer_just_reloaded), ref timer_just_reloaded);
|
||||||
|
|
||||||
ser.Sync(nameof(delay), ref delay);
|
ser.Sync(nameof(delay), ref delay);
|
||||||
|
|
||||||
|
@ -728,11 +733,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
|
timer_just_reloaded = false;
|
||||||
if (timer > 0) timer--;
|
if (timer > 0) timer--;
|
||||||
if (timer == 0)
|
if (timer == 0)
|
||||||
{
|
{
|
||||||
timer = timer_reload;
|
timer = timer_reload;
|
||||||
Clock();
|
Clock();
|
||||||
|
timer_just_reloaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Any time the sample buffer is in an empty state and bytes remaining is not zero, the following occur:
|
// Any time the sample buffer is in an empty state and bytes remaining is not zero, the following occur:
|
||||||
|
@ -753,6 +760,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
//Console.WriteLine("fill glitch 2");
|
//Console.WriteLine("fill glitch 2");
|
||||||
apu.dmc_dma_countdown = 4;
|
apu.dmc_dma_countdown = 4;
|
||||||
apu.DMC_RDY_check = -1;
|
apu.DMC_RDY_check = -1;
|
||||||
|
fill_glitch_2_end = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -861,6 +869,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
if ((timer <= 3) && (out_bits_remaining == 0) && (sample_length != 0))
|
if ((timer <= 3) && (out_bits_remaining == 0) && (sample_length != 0))
|
||||||
{
|
{
|
||||||
Console.WriteLine("glitch 2 " + timer);
|
Console.WriteLine("glitch 2 " + timer);
|
||||||
|
fill_glitch_2 = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timer_just_reloaded && (sample_length != 0))
|
||||||
|
{
|
||||||
|
Console.WriteLine("glitch 3 " + timer);
|
||||||
//fill_glitch_2 = true;
|
//fill_glitch_2 = true;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -584,11 +584,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
|
|
||||||
// DMC was started in the APU, but in this case it only lasts 1 cycle and is then aborted, so put this here
|
// DMC was started in the APU, but in this case it only lasts 1 cycle and is then aborted, so put this here
|
||||||
// TODO: should this clock controllers?
|
// TODO: should this clock controllers?
|
||||||
if (apu.dmc.fill_glitch_2)
|
if (apu.dmc.fill_glitch_2_end)
|
||||||
{
|
{
|
||||||
apu.dmc_dma_countdown = -1;
|
apu.dmc_dma_countdown = -1;
|
||||||
dmc_dma_exec = false;
|
dmc_dma_exec = false;
|
||||||
apu.dmc.fill_glitch_2 = false;
|
apu.dmc.fill_glitch_2 = false;
|
||||||
|
apu.dmc.fill_glitch_2_end = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu.ExecuteOne();
|
cpu.ExecuteOne();
|
||||||
|
|
Loading…
Reference in New Issue