#ifdef __memcheck__
mem_check+=(Address>>16)+Address;
#endif
-#if defined(VAR_CYCLES) || defined(CPU_SHUTDOWN)
- int block;
- uint8 *GetAddress = Memory.Map [block = (Address >> MEMMAP_SHIFT) & MEMMAP_MASK];
-#else
- uint8 *GetAddress = Memory.Map [(Address >> MEMMAP_SHIFT) & MEMMAP_MASK];
-#endif
- if (GetAddress >= (uint8 *) CMemory::MAP_LAST)
- {
+ const int block = (Address >> MEMMAP_SHIFT) & MEMMAP_MASK;
+ uint8 *GetAddress = Memory.Map[block];
+
+ if (GetAddress >= (uint8 *) CMemory::MAP_LAST)
+ {
#ifdef VAR_CYCLES
- CPU.Cycles += Memory.MemorySpeed [block];
+ CPU.Cycles += Memory.MemorySpeed [block];
#endif
#ifdef CPU_SHUTDOWN
- if (Memory.BlockIsRAM [block])
- CPU.WaitAddress = CPU.PCAtOpcodeStart;
+ if (Memory.BlockIsRAM [block])
+ CPU.WaitAddress = CPU.PCAtOpcodeStart;
#endif
- return (*(GetAddress + (Address & 0xffff)));
- }
+ return (*(GetAddress + (Address & 0xffff)));
+ }
- switch ((int) GetAddress)
+ switch ((CMemory::Types)(intptr_t) GetAddress)
{
case CMemory::MAP_PPU:
#ifdef VAR_CYCLES
#ifdef __memcheck__
mem_check+=(Address>>16)+Address;
#endif
- if ((Address & 0x1fff) == 0x1fff)
- {
- return (S9xGetByte (Address) | (S9xGetByte (Address + 1) << 8));
- }
-#if defined(VAR_CYCLES) || defined(CPU_SHUTDOWN)
- int block;
- uint8 *GetAddress = Memory.Map [block = (Address >> MEMMAP_SHIFT) & MEMMAP_MASK];
-#else
- uint8 *GetAddress = Memory.Map [(Address >> MEMMAP_SHIFT) & MEMMAP_MASK];
-#endif
+ if ((Address & 0x1fff) == 0x1fff)
+ {
+ return (S9xGetByte (Address) | (S9xGetByte (Address + 1) << 8));
+ }
+
+ const int block = (Address >> MEMMAP_SHIFT) & MEMMAP_MASK;
+ uint8 *GetAddress = Memory.Map[block];
+
if (GetAddress >= (uint8 *) CMemory::MAP_LAST)
{
#ifdef VAR_CYCLES
#endif
}
- switch ((int) GetAddress)
+ switch ((CMemory::Types)(intptr_t) GetAddress)
{
case CMemory::MAP_PPU:
#ifdef VAR_CYCLES
#if defined(CPU_SHUTDOWN)
CPU.WaitAddress = NULL;
#endif
-#if defined(VAR_CYCLES)
- int block;
- uint8 *SetAddress = Memory.WriteMap [block = ((Address >> MEMMAP_SHIFT) & MEMMAP_MASK)];
-#else
- uint8 *SetAddress = Memory.WriteMap [(Address >> MEMMAP_SHIFT) & MEMMAP_MASK];
-#endif
+ const int block = (Address >> MEMMAP_SHIFT) & MEMMAP_MASK;
+ uint8 *SetAddress = Memory.WriteMap[block];
if (SetAddress >= (uint8 *) CMemory::MAP_LAST)
{
return;
}
- switch ((int) SetAddress)
+ switch ((CMemory::Types)(intptr_t) SetAddress)
{
case CMemory::MAP_PPU:
#ifdef VAR_CYCLES
#if defined(CPU_SHUTDOWN)
CPU.WaitAddress = NULL;
#endif
-#if defined (VAR_CYCLES)
- int block;
- uint8 *SetAddress = Memory.WriteMap [block = ((Address >> MEMMAP_SHIFT) & MEMMAP_MASK)];
-#else
- uint8 *SetAddress = Memory.WriteMap [(Address >> MEMMAP_SHIFT) & MEMMAP_MASK];
-#endif
+ const int block = (Address >> MEMMAP_SHIFT) & MEMMAP_MASK;
+ uint8 *SetAddress = Memory.WriteMap[block];
if (SetAddress >= (uint8 *) CMemory::MAP_LAST)
{
return;
}
- switch ((int) SetAddress)
+ switch ((CMemory::Types)(intptr_t) SetAddress)
{
case CMemory::MAP_PPU:
#ifdef VAR_CYCLES
#endif
if (CPU.Memory_SRAMMask)
{
- *(Memory.SRAM +
- (((Address & 0x7fff) - 0x6000 +
- ((Address & 0xf0000) >> MEMMAP_SHIFT) & CPU.Memory_SRAMMask))) = (uint8) Word;
- *(Memory.SRAM +
- ((((Address + 1) & 0x7fff) - 0x6000 +
- (((Address + 1) & 0xf0000) >> MEMMAP_SHIFT) & CPU.Memory_SRAMMask))) = (uint8) (Word >> 8);
+ *(Memory.SRAM +
+ ((Address & 0x7fff) - 0x6000) +
+ (((Address & 0xf0000) >> MEMMAP_SHIFT) & CPU.Memory_SRAMMask)
+ ) = (uint8) Word;
+
+ *(Memory.SRAM +
+ (((Address + 1) & 0x7fff) - 0x6000) +
+ ((((Address + 1) & 0xf0000) >> MEMMAP_SHIFT) & CPU.Memory_SRAMMask)
+ ) = (uint8) (Word >> 8);
+
CPU.SRAMModified = TRUE;
}
return;
if (GetAddress >= (uint8 *) CMemory::MAP_LAST)
return (GetAddress);
- switch ((int) GetAddress)
+ switch ((CMemory::Types)(intptr_t) GetAddress)
{
case CMemory::MAP_PPU:
return (Memory.FillRAM - 0x2000);
if (GetAddress >= (uint8 *) CMemory::MAP_LAST)
return (GetAddress + (Address & 0xffff));
- switch ((int) GetAddress)
+ switch ((CMemory::Types)(intptr_t) GetAddress)
{
case CMemory::MAP_PPU:
return (Memory.FillRAM - 0x2000 + (Address & 0xffff));
return;
}
- switch ((int) GetAddress)
+ switch ((CMemory::Types)(intptr_t) GetAddress)
{
case CMemory::MAP_PPU:
#ifdef VAR_CYCLES