From b6b1620e00a9b3a7a5586f777cd29bf21ca5ce7a Mon Sep 17 00:00:00 2001 From: Sour Date: Fri, 22 Feb 2019 18:40:39 -0500 Subject: [PATCH] DMA: Fixed (?) source bank for HDMA --- Core/DmaController.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/DmaController.cpp b/Core/DmaController.cpp index 7ef148b..4ab7eac 100644 --- a/Core/DmaController.cpp +++ b/Core/DmaController.cpp @@ -153,18 +153,18 @@ void DmaController::ProcessHdmaChannels() //5. If Line Counter is zero... if((ch.HdmaLineCounterAndRepeat & 0x7F) == 0) { //"a. Read the next byte from Address into $43xA (thus, into both Line Counter and Repeat)." - ch.HdmaLineCounterAndRepeat = _memoryManager->ReadDma(ch.HdmaTableAddress++); + ch.HdmaLineCounterAndRepeat = _memoryManager->ReadDma((ch.SrcBank << 16) | ch.HdmaTableAddress++); //"b. If Addressing Mode is Indirect, read two bytes from Address into Indirect Address(and increment Address by two bytes)." if(ch.HdmaIndirectAddressing) { if(ch.HdmaLineCounterAndRepeat == 0) { //"One oddity: if $43xA is 0 and this is the last active HDMA channel for this scanline, only load one byte for Address, //and use the $00 for the low byte.So Address ends up incremented one less than otherwise expected, and one less CPU Cycle is used." - uint8_t msb = _memoryManager->ReadDma(ch.HdmaTableAddress++); + uint8_t msb = _memoryManager->ReadDma((ch.SrcBank << 16) | ch.HdmaTableAddress++); ch.TransferSize = (msb << 8); } else { - uint8_t lsb = _memoryManager->ReadDma(ch.HdmaTableAddress++); - uint8_t msb = _memoryManager->ReadDma(ch.HdmaTableAddress++); + uint8_t lsb = _memoryManager->ReadDma((ch.SrcBank << 16) | ch.HdmaTableAddress++); + uint8_t msb = _memoryManager->ReadDma((ch.SrcBank << 16) | ch.HdmaTableAddress++); ch.TransferSize = (msb << 8) | lsb; }