diff --git a/readme.md b/readme.md index 74a5329..d93b6a0 100644 --- a/readme.md +++ b/readme.md @@ -103,7 +103,12 @@ Castlevania - Dracula X ##Change History v0.63 -- +- Fixed bug in DMA when the source address comes from Save RAM. This fixes a number of Super Mario World Hacks so that text is readable on BG layer 3. +- Fixed menu key lock issue to improve usability when exiting from menu back into the game. +- Fixed DKC tile corruption issue. This probably also fixes most (if not all) tile corruption issues in other games, if you play a game for too long in a single sitting. +- Fixed sound problems when auto-saving SRAM. Somehow the hardware or the library doesn't like us stopping and starting the CSND too often. Not too sure what the problem is. +- Added an auto-save SRAM option to tell the emulator when to save SRAM (1 second, 10 seconds, 60 seconds, or disable auto-save). +Note that regardless of the setting, the emulator will always save any modified SRAM every time you touch the bottom screen to activate the menu. v0.62 - Improved Mode 7 zoomed-in textures. Games like Seiken Densetsu, ActRaiser 1/2 look better when viewing the Mode 7 textures near to the ground. Thanks for Discostew for the motivation! diff --git a/source/dma.cpp b/source/dma.cpp index b0ddee6..910e54f 100644 --- a/source/dma.cpp +++ b/source/dma.cpp @@ -195,22 +195,23 @@ void S9xDoDMA (uint8 Channel) int inc = d->AAddressFixed ? 0 : (!d->AAddressDecrement ? 1 : -1); //printf ("DMA: $21%02x len:%d inc:%d\n", d->BAddress, count, inc); - - /* +/* + uint32 finalAddress = (d->ABank << 16) + d->AAddress; + uint8 *GetAddress = Memory.Map [(finalAddress >> MEMMAP_SHIFT) & MEMMAP_MASK]; if ((uint32) GetAddress == CMemory::MAP_HIROM_SRAM || (uint32) GetAddress == CMemory::MAP_LOROM_SRAM) { - printf ("DMA[%d]: %s Mode: %d 0x%02X%04X->0x21%02X Bytes: %d (%s) V-Line:%ld", - Channel, d->TransferDirection ? "read" : "write", + printf ("DMA%d: %s M:%d 0x%02X%04X->0x21%02X Bytes:%d (%s) VLine:%ld", + Channel, d->TransferDirection ? "R" : "W", d->TransferMode, d->ABank, d->AAddress, d->BAddress, d->TransferBytes, - d->AAddressFixed ? "fixed" : - (d->AAddressDecrement ? "dec" : "inc"), + d->AAddressFixed ? "0" : + (d->AAddressDecrement ? "-1" : "+1"), CPU.V_Counter); if (d->BAddress == 0x18 || d->BAddress == 0x19 || d->BAddress == 0x39 || d->BAddress == 0x3a) - printf (" VRAM: %04X (Inc:%d, FGC:%d) %s", + printf (" VRAM:%04X (Inc:%d,FGC:%d) %s", PPU.VMA.Address, PPU.VMA.Increment, PPU.VMA.FullGraphicCount, - PPU.VMA.High ? "word" : "byte"); + PPU.VMA.High ? "W" : "B"); else if (d->BAddress == 0x22 || d->BAddress == 0x3b) @@ -572,6 +573,7 @@ void S9xDoDMA (uint8 Channel) uint8 *base = 0; uint16 p; uint32 memmap = S9xComputeDMABasePointer(d->ABank, d->AAddress, &base, &p); + uint16 tAAddress = d->AAddress; if (!base) base = Memory.ROM; @@ -886,19 +888,17 @@ void S9xDoDMA (uint8 Channel) // In the interests of speed, this piece of code // only runs when the source address is in SRAM. // - uint16 tAAddress = d->AAddress & 0xf000; - uint32 bankCounter; - if (inc == 0) - bankCounter = 0xfffff; - else if (inc == 1) - bankCounter = 0x1000 - (d->AAddress & 0xfff); + uint32 bankCounter = 0xfffff; + if (inc == 1) + bankCounter = 0x1000 - (tAAddress & 0xfff); else if (inc == -1) - bankCounter = (d->AAddress & 0xfff) + 1; + bankCounter = (tAAddress & 0xfff) + 1; + tAAddress = tAAddress & 0xf000; #define UPDATEBASEPOINTER() \ bankCounter--; \ if (bankCounter == 0) { \ - tAAddress = tAAddress + inc * 0x1000; \ + tAAddress = (tAAddress + inc * 0x1000) & 0xffff; \ S9xComputeDMABasePointer(d->ABank, tAAddress, &base, &p); \ bankCounter = 0x1000; \ }