mirror of https://github.com/snes9xgit/snes9x.git
Move identical VRAMReadBuffer updates to inline function
This commit is contained in:
parent
1d25cbfeca
commit
d3e21d7463
40
ppu.cpp
40
ppu.cpp
|
@ -716,15 +716,7 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
|||
PPU.VMA.Address &= 0xff00;
|
||||
PPU.VMA.Address |= Byte;
|
||||
|
||||
if (PPU.VMA.FullGraphicCount)
|
||||
{
|
||||
uint32 addr = PPU.VMA.Address;
|
||||
uint32 rem = addr & PPU.VMA.Mask1;
|
||||
uint32 address = (addr & ~PPU.VMA.Mask1) + (rem >> PPU.VMA.Shift) + ((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
|
||||
PPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((address << 1) & 0xffff));
|
||||
}
|
||||
else
|
||||
PPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) & 0xffff));
|
||||
S9xUpdateVRAMReadBuffer();
|
||||
|
||||
break;
|
||||
|
||||
|
@ -732,15 +724,7 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
|||
PPU.VMA.Address &= 0x00ff;
|
||||
PPU.VMA.Address |= Byte << 8;
|
||||
|
||||
if (PPU.VMA.FullGraphicCount)
|
||||
{
|
||||
uint32 addr = PPU.VMA.Address;
|
||||
uint32 rem = addr & PPU.VMA.Mask1;
|
||||
uint32 address = (addr & ~PPU.VMA.Mask1) + (rem >> PPU.VMA.Shift) + ((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
|
||||
PPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((address << 1) & 0xffff));
|
||||
}
|
||||
else
|
||||
PPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) & 0xffff));
|
||||
S9xUpdateVRAMReadBuffer();
|
||||
|
||||
break;
|
||||
|
||||
|
@ -1311,15 +1295,7 @@ uint8 S9xGetPPU (uint16 Address)
|
|||
byte = PPU.VRAMReadBuffer & 0xff;
|
||||
if (!PPU.VMA.High)
|
||||
{
|
||||
if (PPU.VMA.FullGraphicCount)
|
||||
{
|
||||
uint32 addr = PPU.VMA.Address;
|
||||
uint32 rem = addr & PPU.VMA.Mask1;
|
||||
uint32 address = (addr & ~PPU.VMA.Mask1) + (rem >> PPU.VMA.Shift) + ((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
|
||||
PPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((address << 1) & 0xffff));
|
||||
}
|
||||
else
|
||||
PPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) & 0xffff));
|
||||
S9xUpdateVRAMReadBuffer();
|
||||
|
||||
PPU.VMA.Address += PPU.VMA.Increment;
|
||||
}
|
||||
|
@ -1333,15 +1309,7 @@ uint8 S9xGetPPU (uint16 Address)
|
|||
byte = (PPU.VRAMReadBuffer >> 8) & 0xff;
|
||||
if (PPU.VMA.High)
|
||||
{
|
||||
if (PPU.VMA.FullGraphicCount)
|
||||
{
|
||||
uint32 addr = PPU.VMA.Address;
|
||||
uint32 rem = addr & PPU.VMA.Mask1;
|
||||
uint32 address = (addr & ~PPU.VMA.Mask1) + (rem >> PPU.VMA.Shift) + ((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
|
||||
PPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((address << 1) & 0xffff));
|
||||
}
|
||||
else
|
||||
PPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) & 0xffff));
|
||||
S9xUpdateVRAMReadBuffer();
|
||||
|
||||
PPU.VMA.Address += PPU.VMA.Increment;
|
||||
}
|
||||
|
|
13
ppu.h
13
ppu.h
|
@ -420,6 +420,19 @@ static inline void FLUSH_REDRAW (void)
|
|||
S9xUpdateScreen();
|
||||
}
|
||||
|
||||
static inline void S9xUpdateVRAMReadBuffer()
|
||||
{
|
||||
if (PPU.VMA.FullGraphicCount)
|
||||
{
|
||||
uint32 addr = PPU.VMA.Address;
|
||||
uint32 rem = addr & PPU.VMA.Mask1;
|
||||
uint32 address = (addr & ~PPU.VMA.Mask1) + (rem >> PPU.VMA.Shift) + ((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
|
||||
PPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((address << 1) & 0xffff));
|
||||
}
|
||||
else
|
||||
PPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) & 0xffff));
|
||||
}
|
||||
|
||||
static inline void REGISTER_2104 (uint8 Byte)
|
||||
{
|
||||
if (!(PPU.OAMFlip & 1))
|
||||
|
|
Loading…
Reference in New Issue