NESHawk: proper DMC address wrap

This commit is contained in:
alyosha-tas 2022-01-08 19:53:47 -05:00
parent 9b88ae48e8
commit 934a3ae266
2 changed files with 7 additions and 7 deletions

View File

@ -957,8 +957,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
sample_buffer_filled = true; sample_buffer_filled = true;
sample_address = (ushort)(sample_address + 1); sample_address = (ushort)(sample_address + 1);
//sample address wraps to 0xC000 //sample address wraps to 0x8000, even though this cannot be reached by write to address reg
if (sample_address == 0) { sample_address = 0xC000;} if (sample_address == 0) { sample_address = 0x8000; }
// Console.WriteLine(sample_length); // Console.WriteLine(sample_length);
// Console.WriteLine(user_length); // Console.WriteLine(user_length);

View File

@ -532,22 +532,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
do_the_reread_2007++; do_the_reread_2007++;
} }
*/ */
if ((apu.dmc.sample_address & 0x401F) != 0x4016) if ((apu.dmc.sample_address & 0x1F) != 0x16)
{ {
do_the_reread_cont_1++; do_the_reread_cont_1++;
} }
if ((apu.dmc.sample_address & 0x401F) == 0x4016) if ((apu.dmc.sample_address & 0x1F) == 0x16)
{ {
reread_opp_4016++; reread_opp_4016++;
} }
if ((apu.dmc.sample_address & 0x401F) != 0x4017) if ((apu.dmc.sample_address & 0x1F) != 0x17)
{ {
do_the_reread_cont_2++; do_the_reread_cont_2++;
} }
if ((apu.dmc.sample_address & 0x401F) == 0x4017) if ((apu.dmc.sample_address & 0x1F) == 0x17)
{ {
reread_opp_4017++; reread_opp_4017++;
} }
@ -582,7 +582,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
cpu.IRQ = _irq_apu || Board.IrqSignal; cpu.IRQ = _irq_apu || Board.IrqSignal;
// 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? // NOTE: for some famicoms, this will also clock controllers, this will need to be handled if emulating additional models
if (apu.dmc.fill_glitch_2_end) if (apu.dmc.fill_glitch_2_end)
{ {
apu.dmc_dma_countdown = -1; apu.dmc_dma_countdown = -1;