From 31c545a6803acc460669b911f3899b0e5851d429 Mon Sep 17 00:00:00 2001 From: Sour Date: Sun, 29 Sep 2024 11:42:43 +0900 Subject: [PATCH] NES: Fixed OAM DMA getting skipped when DMC DMA was aborted on the same cycle as OAM DMA was triggered --- Core/NES/NesCpu.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Core/NES/NesCpu.cpp b/Core/NES/NesCpu.cpp index 2d0bdf6e..88ceabde 100644 --- a/Core/NES/NesCpu.cpp +++ b/Core/NES/NesCpu.cpp @@ -377,8 +377,14 @@ void NesCpu::ProcessPendingDma(uint16_t readAddress) if(_abortDmcDma) { _dmcDmaRunning = false; _abortDmcDma = false; - _needDummyRead = false; - return; + + if(!_spriteDmaTransfer) { + //If DMC DMA was cancelled and OAM DMA isn't about to start, + //stop processing DMA entirely. Otherwise, OAM DMA needs to run, + //so the DMA process has to continue. + _needDummyRead = false; + return; + } } uint16_t spriteDmaCounter = 0;