/* Branch Instructions *********************************************************************** */
#ifndef SA1_OPCODES
#define BranchCheck0()\
- if( CPU.BranchSkip)\
+ if (CPU.BranchSkip)\
{\
- CPU.BranchSkip = FALSE;\
- if (!Settings.SoundSkipMethod)\
- if( CPU.PC - CPU.PCBase > OpAddress)\
- return;\
+ CPU.BranchSkip = FALSE;\
+ if (!Settings.SoundSkipMethod)\
+ if( CPU.PC - CPU.PCBase > OpAddress)\
+ return;\
}
#define BranchCheck1()\
- if( CPU.BranchSkip)\
+ if (CPU.BranchSkip)\
{\
- CPU.BranchSkip = FALSE;\
- if (!Settings.SoundSkipMethod) {\
- if( CPU.PC - CPU.PCBase > OpAddress)\
- return;\
- } else \
- if (Settings.SoundSkipMethod == 1)\
- return;\
- if (Settings.SoundSkipMethod == 3)\
- if( CPU.PC - CPU.PCBase > OpAddress)\
- return;\
- else\
- CPU.PC = CPU.PCBase + OpAddress;\
- }
+ CPU.BranchSkip = FALSE;\
+ if (!Settings.SoundSkipMethod) {\
+ if( CPU.PC - CPU.PCBase > OpAddress)\
+ return;\
+ } else if (Settings.SoundSkipMethod == 1) {\
+ return;\
+ } else if (Settings.SoundSkipMethod == 3) {\
+ if( CPU.PC - CPU.PCBase > OpAddress)\
+ return;\
+ else\
+ CPU.PC = CPU.PCBase + OpAddress;\
+ }\
+ }
#define BranchCheck2()\
- if( CPU.BranchSkip)\
+ if (CPU.BranchSkip)\
{\
- CPU.BranchSkip = FALSE;\
- if (!Settings.SoundSkipMethod) {\
- if( CPU.PC - CPU.PCBase > OpAddress)\
- return;\
- } else \
- if (Settings.SoundSkipMethod == 1)\
- CPU.PC = CPU.PCBase + OpAddress;\
- if (Settings.SoundSkipMethod == 3)\
- if (CPU.PC - CPU.PCBase > OpAddress)\
- return;\
- else\
- CPU.PC = CPU.PCBase + OpAddress;\
+ CPU.BranchSkip = FALSE;\
+ if (!Settings.SoundSkipMethod) {\
+ if( CPU.PC - CPU.PCBase > OpAddress)\
+ return;\
+ } else if (Settings.SoundSkipMethod == 1) {\
+ CPU.PC = CPU.PCBase + OpAddress;\
+ } else if (Settings.SoundSkipMethod == 3) {\
+ if (CPU.PC - CPU.PCBase > OpAddress)\
+ return;\
+ else\
+ CPU.PC = CPU.PCBase + OpAddress;\
+ }\
}
+
#else
#define BranchCheck0()
#define BranchCheck1()
R15++;
CLRFLAGS;
R1++;
-
+
#ifdef CHECK_LIMITS
if(y >= GSU.vScreenHeight) return;
#endif
- c = (uint8)GSU.vColorReg;
- if(GSU.vPlotOptionReg & 0x10)
- if( !(GSU.vPlotOptionReg & 0x01) && !(c&0xf)) return;
- else
- if( !(GSU.vPlotOptionReg & 0x01) && !c) return;
+ c = (uint8)GSU.vColorReg;
+ if(GSU.vPlotOptionReg & 0x10) {
+ if( !(GSU.vPlotOptionReg & 0x01) && !(c&0xf)) return;
+ } else {
+ if( !(GSU.vPlotOptionReg & 0x01) && !c) return;
+ }
a = GSU.apvScreen[y >> 3] + GSU.x[x >> 3] + ((y & 7) << 1);
v = 128 >> (x&7);
#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;
// Define an inline function to handle which BGs are being displayed
#define DISPLAY(n) \
-(!(PPU.BG_Forced & n) && \
-(GFX.r212c & n) || \
-((GFX.r212d & n) && subadd))
+ ( \
+ (!(PPU.BG_Forced & n) && (GFX.r212c & n)) || \
+ (((GFX.r212d & n) && subadd)) \
+ )
uint8 subadd = GFX.r2131 & 0x3f;
// go through all BGS are check if they need to be displayed
- bool8_32 BG0 = DISPLAY(1) && !(Settings.os9x_hack & GFX_IGNORE_BG0);
- bool8_32 BG1 = DISPLAY(2) && !(Settings.os9x_hack & GFX_IGNORE_BG1);
- bool8_32 BG2 = DISPLAY(4) && !(Settings.os9x_hack & GFX_IGNORE_BG2);
- bool8_32 BG3 = DISPLAY(8) && !(Settings.os9x_hack & GFX_IGNORE_BG3);
- bool8_32 OB = DISPLAY(16) && !(Settings.os9x_hack & GFX_IGNORE_OBJ);
+ bool BG0 = DISPLAY(1) && !(Settings.os9x_hack & GFX_IGNORE_BG0);
+ bool BG1 = DISPLAY(2) && !(Settings.os9x_hack & GFX_IGNORE_BG1);
+ bool BG2 = DISPLAY(4) && !(Settings.os9x_hack & GFX_IGNORE_BG2);
+ bool BG3 = DISPLAY(8) && !(Settings.os9x_hack & GFX_IGNORE_BG3);
+ bool OB = DISPLAY(16) && !(Settings.os9x_hack & GFX_IGNORE_OBJ);
if (PPU.BGMode <= 1)
{
#endif
#define COLOR_ADD1_2(C1, C2) \
-(((((C1) & RGB_REMOVE_LOW_BITS_MASK) + \
- ((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1) + \
- ((C1) & (C2) & RGB_LOW_BITS_MASK) | ALPHA_BITS_MASK)
+ ((((((C1) & RGB_REMOVE_LOW_BITS_MASK) + \
+ ((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1) + \
+ ((C1) & (C2) & RGB_LOW_BITS_MASK)) | ALPHA_BITS_MASK)
#if defined(OLD_COLOUR_BLENDING)
#define COLOR_SUB(C1, C2) \
-GFX.ZERO_OR_X2 [(((C1) | RGB_HI_BITS_MASKx2) - \
+ GFX.ZERO_OR_X2 [(((C1) | RGB_HI_BITS_MASKx2) - \
((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1]
#else
#define COLOR_SUB(C1, C2) \
-(GFX.ZERO_OR_X2 [(((C1) | RGB_HI_BITS_MASKx2) - \
+ (GFX.ZERO_OR_X2 [(((C1) | RGB_HI_BITS_MASKx2) - \
((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1] + \
-((C1) & RGB_LOW_BITS_MASK) - ((C2) & RGB_LOW_BITS_MASK))
+ ((C1) & RGB_LOW_BITS_MASK) - ((C2) & RGB_LOW_BITS_MASK))
#endif
#define COLOR_SUB1_2(C1, C2) \
-GFX.ZERO [(((C1) | RGB_HI_BITS_MASKx2) - \
+ GFX.ZERO [(((C1) | RGB_HI_BITS_MASKx2) - \
((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1]
typedef void (*NormalTileRenderer) (uint32 Tile, uint32 Offset,
CPU.BranchSkip = TRUE;
break;
}
- if (Address & 3 < 2)
+ if ((Address & 3) < 2)
{
int r = rand();
if (r & 2)
{
if (r & 4)
- return (Address & 3 == 1 ? 0xaa : 0xbb);
+ return ((Address & 3) == 1 ? 0xaa : 0xbb);
else
return ((r >> 3) & 0xff);
}