Skip to content

Commit

Permalink
- Updated readme.md
Browse files Browse the repository at this point in the history
- Additional fixes for DMA bank switching logic.
  • Loading branch information
bubble2k2 committed Oct 15, 2016
1 parent 79901d8 commit 8c3925d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
7 changes: 6 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
32 changes: 16 additions & 16 deletions source/dma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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; \
}
Expand Down

0 comments on commit 8c3925d

Please sign in to comment.