Version 4.6a with another 5% speedup on games that scroll (AD&D, TNT Cowboy, Space Spartans, etc). This is a big improvement for the DS-Lite/Phat.

This commit is contained in:
Dave Bernazzani 2024-01-16 20:23:33 -05:00
parent 1500c3805f
commit ac6dfbc789
2 changed files with 6 additions and 11 deletions

Binary file not shown.

View File

@ -1006,7 +1006,7 @@ ITCM_CODE void AY38900::copyBackgroundBufferToStagingArea()
if (!((nextSourcePixel | (u32)nextPixelStore0) & 3)) // We're on a 32-bit boundary
{
// At this point, everything is 16-bit aligned so we can blast 32-bits at a time...
// At this point, everything is 32-bit aligned so we can blast 32-bits at a time...
UINT32 *backColor = (UINT32*) &backgroundBuffer[nextSourcePixel];
UINT32 *pix0 = (UINT32*) nextPixelStore0;
UINT32 *pix1 = (UINT32*) nextPixelStore1;
@ -1019,20 +1019,15 @@ ITCM_CODE void AY38900::copyBackgroundBufferToStagingArea()
}
else
{
short int idx = nextSourcePixel;
if (nextSourcePixel & 1)
// If we're on an odd byte, just do one pixel to get is on an even 16-bit boundary
if ((u32)nextPixelStore0 & 1)
{
*nextPixelStore0 = backgroundBuffer[idx];
*nextPixelStore1 = backgroundBuffer[idx++];
*nextPixelStore0++ = backgroundBuffer[nextSourcePixel];
*nextPixelStore1++ = backgroundBuffer[nextSourcePixel];
}
// This is technically wrong... we're shifting the pixel store by 1 pixel to align it with the background buffer.
// One pixel shift won't be noticable to the game player - but it gives us a very signifcant boost in performance.
if ((u32)nextPixelStore0 & 1) nextPixelStore0++;
if ((u32)nextPixelStore1 & 1) nextPixelStore1++;
// At this point, everything is 16-bit aligned so we can blast 16-bits at a time...
UINT16 *backColor = (UINT16*) &backgroundBuffer[idx];
UINT16 *backColor = (UINT16*) &backgroundBuffer[nextSourcePixel&0xFFFE];
UINT16 *pix0 = (UINT16*) nextPixelStore0;
UINT16 *pix1 = (UINT16*) nextPixelStore1;