summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Fabio Priuli <etabeta78@users.noreply.github.com>2010-03-09 15:17:13 +0000
committer Fabio Priuli <etabeta78@users.noreply.github.com>2010-03-09 15:17:13 +0000
commit8661e91e58569a853c6e66b643395f553e00f187 (patch)
tree7e6b443d0d6507e557d7154ce4a24a1c20e79dfa
parentcd5fff840778bed8d1be8bbb838ffb41a7d01051 (diff)
not worth mention: minor renaming of some snes_ppu struct elements
-rw-r--r--src/mame/includes/snes.h9
-rw-r--r--src/mame/machine/snes.c24
-rw-r--r--src/mame/video/snes.c34
3 files changed, 34 insertions, 33 deletions
diff --git a/src/mame/includes/snes.h b/src/mame/includes/snes.h
index 4971ec7c311..cf58eca9812 100644
--- a/src/mame/includes/snes.h
+++ b/src/mame/includes/snes.h
@@ -510,8 +510,11 @@ struct SNES_PPU_STRUCT /* once all the regs are saved in this structure, it woul
UINT8 tile_size;
UINT8 mosaic_enabled; // actually used only for layers 0->3!
+
UINT8 main_window_enabled;
UINT8 sub_window_enabled;
+ UINT8 main_bg_enabled;
+ UINT8 sub_bg_enabled;
UINT16 hoffs;
UINT16 voffs;
@@ -568,8 +571,8 @@ struct SNES_PPU_STRUCT /* once all the regs are saved in this structure, it woul
} mode7;
UINT8 mosaic_size;
- UINT8 main_color_mask;
- UINT8 sub_color_mask;
+ UINT8 clip_to_black;
+ UINT8 prevent_color_math;
UINT8 sub_add_mode;
UINT8 bg3_priority_bit;
UINT8 direct_color;
@@ -577,8 +580,6 @@ struct SNES_PPU_STRUCT /* once all the regs are saved in this structure, it woul
'previous' scroll value */
UINT8 mode7_last_scroll; /* as per Anomie's doc mode 7 scroll regs use a different value, shared with mode 7 matrix! */
- UINT8 main_bg_enabled[5]; // these would probably better fit the layer struct, but it would make worse the code in snes_update_mode_X()
- UINT8 sub_bg_enabled[5];
UINT8 ppu1_open_bus, ppu2_open_bus;
UINT8 ppu1_version, ppu2_version;
UINT8 window1_left, window1_right, window2_left, window2_right;
diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c
index cb8aee67f86..2ead27fe52c 100644
--- a/src/mame/machine/snes.c
+++ b/src/mame/machine/snes.c
@@ -1133,18 +1133,18 @@ WRITE8_HANDLER( snes_w_io )
}
break;
case TM: /* Main screen designation */
- snes_ppu.main_bg_enabled[0] = BIT(data, 0);
- snes_ppu.main_bg_enabled[1] = BIT(data, 1);
- snes_ppu.main_bg_enabled[2] = BIT(data, 2);
- snes_ppu.main_bg_enabled[3] = BIT(data, 3);
- snes_ppu.main_bg_enabled[4] = BIT(data, 4);
+ snes_ppu.layer[SNES_BG1].main_bg_enabled = BIT(data, 0);
+ snes_ppu.layer[SNES_BG2].main_bg_enabled = BIT(data, 1);
+ snes_ppu.layer[SNES_BG3].main_bg_enabled = BIT(data, 2);
+ snes_ppu.layer[SNES_BG4].main_bg_enabled = BIT(data, 3);
+ snes_ppu.layer[SNES_OAM].main_bg_enabled = BIT(data, 4);
break;
case TS: /* Subscreen designation */
- snes_ppu.sub_bg_enabled[0] = BIT(data, 0);
- snes_ppu.sub_bg_enabled[1] = BIT(data, 1);
- snes_ppu.sub_bg_enabled[2] = BIT(data, 2);
- snes_ppu.sub_bg_enabled[3] = BIT(data, 3);
- snes_ppu.sub_bg_enabled[4] = BIT(data, 4);
+ snes_ppu.layer[SNES_BG1].sub_bg_enabled = BIT(data, 0);
+ snes_ppu.layer[SNES_BG2].sub_bg_enabled = BIT(data, 1);
+ snes_ppu.layer[SNES_BG3].sub_bg_enabled = BIT(data, 2);
+ snes_ppu.layer[SNES_BG4].sub_bg_enabled = BIT(data, 3);
+ snes_ppu.layer[SNES_OAM].sub_bg_enabled = BIT(data, 4);
break;
case TMW: /* Window mask for main screen designation */
snes_ppu.layer[SNES_BG1].main_window_enabled = BIT(data, 0);
@@ -1162,8 +1162,8 @@ WRITE8_HANDLER( snes_w_io )
break;
case CGWSEL: /* Initial settings for Fixed colour addition or screen addition */
/* FIXME: We don't support direct select for modes 3 & 4 or subscreen window stuff */
- snes_ppu.main_color_mask = (data >> 6) & 0x03;
- snes_ppu.sub_color_mask = (data >> 4) & 0x03;
+ snes_ppu.clip_to_black = (data >> 6) & 0x03;
+ snes_ppu.prevent_color_math = (data >> 4) & 0x03;
snes_ppu.sub_add_mode = BIT(data, 1);
snes_ppu.direct_color = BIT(data, 0);
#ifdef SNES_DBG_REG_W
diff --git a/src/mame/video/snes.c b/src/mame/video/snes.c
index f7d9ba05c2e..de38e1333c2 100644
--- a/src/mame/video/snes.c
+++ b/src/mame/video/snes.c
@@ -76,10 +76,10 @@
#define SNES_MAINSCREEN 0
#define SNES_SUBSCREEN 1
-#define SNES_CLIP_ALL 0
+#define SNES_CLIP_NEVER 0
#define SNES_CLIP_IN 1
#define SNES_CLIP_OUT 2
-#define SNES_CLIP_ALL2 3
+#define SNES_CLIP_ALWAYS 3
#ifdef SNES_LAYER_DEBUG
struct DEBUGOPTS
@@ -136,27 +136,27 @@ enum
* between the main and sub screens.
*****************************************/
-INLINE void snes_draw_blend( UINT16 offset, UINT16 *colour, UINT8 clip, UINT8 black_pen_clip, int switch_screens )
+INLINE void snes_draw_blend( UINT16 offset, UINT16 *colour, UINT8 prevent_color_math, UINT8 black_pen_clip, int switch_screens )
{
/* when color math is applied to subscreen pixels, the blending depends on the blending used by the previous mainscreen
pixel, except for subscreen pixel 0 which has no previous mainscreen pixel, see comments in snes_refresh_scanline */
if (switch_screens && offset > 0)
offset -= 1;
- if ((black_pen_clip == SNES_CLIP_ALL2) ||
+ if ((black_pen_clip == SNES_CLIP_ALWAYS) ||
(black_pen_clip == SNES_CLIP_IN && snes_ppu.clipmasks[SNES_COLOR][offset]) ||
(black_pen_clip == SNES_CLIP_OUT && !snes_ppu.clipmasks[SNES_COLOR][offset]))
*colour = 0; //clip to black before color math
- if (clip == SNES_CLIP_ALL2) // blending mode 3 == always OFF
+ if (prevent_color_math == SNES_CLIP_ALWAYS) // blending mode 3 == always OFF
return;
#ifdef SNES_LAYER_DEBUG
if (!debug_options.transparency_disabled)
#endif /* SNES_LAYER_DEBUG */
- if ((clip == SNES_CLIP_ALL) ||
- (clip == SNES_CLIP_IN && !snes_ppu.clipmasks[SNES_COLOR][offset]) ||
- (clip == SNES_CLIP_OUT && snes_ppu.clipmasks[SNES_COLOR][offset]))
+ if ((prevent_color_math == SNES_CLIP_NEVER) ||
+ (prevent_color_math == SNES_CLIP_IN && !snes_ppu.clipmasks[SNES_COLOR][offset]) ||
+ (prevent_color_math == SNES_CLIP_OUT && snes_ppu.clipmasks[SNES_COLOR][offset]))
{
UINT16 r, g, b;
struct SCANLINE *subscreen;
@@ -655,8 +655,8 @@ INLINE void snes_update_line( UINT8 color_depth, UINT8 hires, UINT8 priority_a,
return;
#endif /* SNES_LAYER_DEBUG */
- scanlines[SNES_MAINSCREEN].enable = snes_ppu.main_bg_enabled[layer];
- scanlines[SNES_SUBSCREEN].enable = snes_ppu.sub_bg_enabled[layer];
+ scanlines[SNES_MAINSCREEN].enable = snes_ppu.layer[layer].main_bg_enabled;
+ scanlines[SNES_SUBSCREEN].enable = snes_ppu.layer[layer].sub_bg_enabled;
scanlines[SNES_MAINSCREEN].clip = snes_ppu.layer[layer].main_window_enabled;
scanlines[SNES_SUBSCREEN].clip = snes_ppu.layer[layer].sub_window_enabled;
@@ -828,8 +828,8 @@ static void snes_update_line_mode7( UINT8 priority_a, UINT8 priority_b, UINT8 la
return;
#endif /* SNES_LAYER_DEBUG */
- scanlines[SNES_MAINSCREEN].enable = snes_ppu.main_bg_enabled[layer];
- scanlines[SNES_SUBSCREEN].enable = snes_ppu.sub_bg_enabled[layer];
+ scanlines[SNES_MAINSCREEN].enable = snes_ppu.layer[layer].main_bg_enabled;
+ scanlines[SNES_SUBSCREEN].enable = snes_ppu.layer[layer].sub_bg_enabled;
scanlines[SNES_MAINSCREEN].clip = snes_ppu.layer[layer].main_window_enabled;
scanlines[SNES_SUBSCREEN].clip = snes_ppu.layer[layer].sub_window_enabled;
@@ -1120,8 +1120,8 @@ static void snes_update_objects( UINT8 priority_tbl, UINT16 curline )
return;
#endif /* SNES_LAYER_DEBUG */
- scanlines[SNES_MAINSCREEN].enable = snes_ppu.main_bg_enabled[SNES_OAM];
- scanlines[SNES_SUBSCREEN].enable = snes_ppu.sub_bg_enabled[SNES_OAM];
+ scanlines[SNES_MAINSCREEN].enable = snes_ppu.layer[SNES_OAM].main_bg_enabled;
+ scanlines[SNES_SUBSCREEN].enable = snes_ppu.layer[SNES_OAM].sub_bg_enabled;
scanlines[SNES_MAINSCREEN].clip = snes_ppu.layer[SNES_OAM].main_window_enabled;
scanlines[SNES_SUBSCREEN].clip = snes_ppu.layer[SNES_OAM].sub_window_enabled;
@@ -1531,7 +1531,7 @@ static void snes_refresh_scanline( running_machine *machine, bitmap_t *bitmap, U
/* perform color math if the layer wants it (except if it's an object > 192) */
if (!scanline1->blend_exception[x] && snes_ppu.layer[scanline1->layer[x]].color_math)
- snes_draw_blend(x, &c, snes_ppu.sub_color_mask, snes_ppu.main_color_mask, 0);
+ snes_draw_blend(x, &c, snes_ppu.prevent_color_math, snes_ppu.clip_to_black, 0);
r = ((c & 0x1f) * fade) >> 4;
g = (((c & 0x3e0) >> 5) * fade) >> 4;
@@ -1552,9 +1552,9 @@ static void snes_refresh_scanline( running_machine *machine, bitmap_t *bitmap, U
the same color math as the *next* mainscreen pixel (i.e. mainscreen pixel 0) */
if (x == 0 && !scanline1->blend_exception[0] && snes_ppu.layer[scanline1->layer[0]].color_math)
- snes_draw_blend(0, &c, snes_ppu.sub_color_mask, snes_ppu.main_color_mask, 1);
+ snes_draw_blend(0, &c, snes_ppu.prevent_color_math, snes_ppu.clip_to_black, 1);
else if (x > 0 && !scanline1->blend_exception[x - 1] && snes_ppu.layer[scanline1->layer[x - 1]].color_math)
- snes_draw_blend(x, &c, snes_ppu.sub_color_mask, snes_ppu.main_color_mask, 1);
+ snes_draw_blend(x, &c, snes_ppu.prevent_color_math, snes_ppu.clip_to_black, 1);
r = ((c & 0x1f) * fade) >> 4;