fix most compiler code style warnings
authorJavier S. Pedro <javier@javispedro.com>
Mon, 19 Oct 2009 18:38:48 +0000 (20:38 +0200)
committerJavier S. Pedro <javier@javispedro.com>
Mon, 19 Oct 2009 18:38:48 +0000 (20:38 +0200)
65c816ops.inc
fxinst.cpp
getset.h
gfx.cpp
gfx.h
ppu.cpp

index fbc7e71..a36bbfa 100644 (file)
@@ -2447,47 +2447,48 @@ static void Op0CM0 ()
 /* Branch Instructions *********************************************************************** */
 #ifndef SA1_OPCODES
 #define BranchCheck0()\
 /* 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()\
     }
 
 #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()\
 
 #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()
 #else
 #define BranchCheck0()
 #define BranchCheck1()
index fe12de1..a3db07b 100644 (file)
@@ -453,15 +453,16 @@ static void fx_plot_8bit()
     R15++;
     CLRFLAGS;
     R1++;
     R15++;
     CLRFLAGS;
     R1++;
-    
+
 #ifdef CHECK_LIMITS
     if(y >= GSU.vScreenHeight) return;
 #endif
 #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);
 
     a = GSU.apvScreen[y >> 3] + GSU.x[x >> 3] + ((y & 7) << 1);
     v = 128 >> (x&7);
index 90396c6..26e2709 100644 (file)
--- a/getset.h
+++ b/getset.h
@@ -457,12 +457,16 @@ INLINE void S9xSetWord (uint16 Word, uint32 Address)
 #endif
        if (CPU.Memory_SRAMMask)
        {
 #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;
            CPU.SRAMModified = TRUE;
        }
        return;
diff --git a/gfx.cpp b/gfx.cpp
index ce2421b..79f8feb 100644 (file)
--- a/gfx.cpp
+++ b/gfx.cpp
@@ -3786,18 +3786,19 @@ else \
 
 // Define an inline function to handle which BGs are being displayed
 #define DISPLAY(n) \
 
 // 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
 
                    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)
                    {
 
                    if (PPU.BGMode <= 1)
                    {
diff --git a/gfx.h b/gfx.h
index 281f418..51ddc21 100644 (file)
--- a/gfx.h
+++ b/gfx.h
@@ -183,23 +183,23 @@ GFX.X2 [((((C1) & RGB_REMOVE_LOW_BITS_MASK) + \
 #endif
 
 #define COLOR_ADD1_2(C1, C2) \
 #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) \
 
 #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) \
                 ((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] + \
                   ((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) \
 #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, 
           ((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1]
 
 typedef void (*NormalTileRenderer) (uint32 Tile, uint32 Offset, 
diff --git a/ppu.cpp b/ppu.cpp
index 1bc2d41..b9a5963 100644 (file)
--- a/ppu.cpp
+++ b/ppu.cpp
@@ -1338,13 +1338,13 @@ uint8 S9xGetPPU(uint16 Address)
                                                CPU.BranchSkip = TRUE;
                                                break;
                                }
                                                CPU.BranchSkip = TRUE;
                                                break;
                                }
-                               if (Address & 3 < 2)
+                               if ((Address & 3) < 2)
                                {
                                        int r = rand();
                                        if (r & 2)
                                        {
                                                if (r & 4)
                                {
                                        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);
                                        }
                                                else
                                                        return ((r >> 3) & 0xff);
                                        }